This patch implements setattr fileop for Tux3. Tux3 now stores the
mtime properly and persistently, which I tested under UML.I'm updating the MTIME_BIT in tuxnode->present every time, before
calling inode_setattr, which marks the inode dirty. I considered
twiddling the MTIME_BIT afterwards, but I wasn't sure if that was safe
since the inode was already set dirty (and could possibly get
flushed?), so I was forced to check if the mtime/ctime was changing.Thanks to Daniel for the excellent instructions:
http://mailman.tux3.org/pipermail/tux3/2008-November/000380.html
Now we just need a git repo that works :)diff -rup linux-2.6.26.5.orig/fs/tux3/inode.c linux-2.6.26.5/fs/tux3/inode.c
--- linux-2.6.26.5.orig/fs/tux3/inode.c 2008-12-11 17:42:16.000000000 -0800
+++ linux-2.6.26.5/fs/tux3/inode.c 2008-12-11 17:50:29.000000000 -0800
@@ -218,7 +218,7 @@ static const struct file_operations tux_
static const struct inode_operations tux_file_iops = {
// .truncate = ext4_truncate,
// .permission = ext4_permission,
-// .setattr = ext4_setattr,
+ .setattr = tux3_setattr,
// .getattr = ext4_getattr
#ifdef CONFIG_EXT4DEV_FS_XATTR
// .setxattr = generic_setxattr,
@@ -324,4 +324,22 @@ struct inode *tux3_iget(struct super_blo
unlock_new_inode(inode);
return inode;
}
+
+int tux3_setattr(struct dentry *dentry, struct iattr *iattr)
+{
+ struct inode *inode = dentry->d_inode;
+ tuxnode_t *tuxnode = tux_inode(inode);
+ int error;
+
+ error = inode_change_ok(inode, iattr);
+ if (error)
+ return error;
+ if (timespec_equal(iattr->ia_valid & ATTR_MTIME ?
&iattr->ia_mtime : &inode->i_mtime,
+ iattr->ia_valid & ATTR_CTIME ?
&iattr->ia_ctime : &inode->i_ctime))
+ tuxnode->present &= ~MTIME_BIT;
+ else
+ tuxnode->present |= MTIME_BIT;
+
+ return inode_setattr(inode, iattr);
+}
#endif /* !__KERNEL__ */
diff -rup linux-2.6.26.5.orig/fs/tux3/tux3.h linux-2.6.26.5/fs/tux3/tux3.h
--- linux-2.6.26.5.orig/fs/tux3/tux3.h 2008-12-11 17:42:16.000000000 -0800
+++ linux-2.6.26.5/fs/tux3/tux3.h 2008-12-11 17:36:37.000000000 -0800
@@ -636,6 +636,7 @@ void tux3_clear_inode(struct inode *inod
int tux3_write_inode(struct inode *inode, int do_sync);
struct inode *tux_create_inode(struct inode *dir, int mode);
struct inode *tux3_iget(struct super_block *sb, inum_t inum);
+int tux3_setattr(struct dentry *dentry, struct iattr *iattr);/* xattr.c */
int xcache_dump(struct inode *inode);
| David Miller | Re: [GIT]: Networking |
| Greg KH | [GIT PATCH] driver core patches against 2.6.24 |
| debian developer | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Roland Dreier | Re: Integration of SCST in the mainstream Linux kernel |
git: | |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Paul E. McKenney | Re: iptables very slow after commit 784544739a25c30637397ace5489eeb6e15d7d49 |
