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);
| Davide Libenzi | Re: [patch 7/8] fdmap v2 - implement sys_socket2 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Mariusz Kozlowski | [KJ PATCHES] mostly kmalloc + memset conversion to k[cz]alloc |
git: | |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
| Stefan Richter | Re: [GIT]: Networking |
| David Miller | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Gerrit Renker | [PATCH 0/37] dccp: Feature negotiation - last call for comments |
