aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-02-28 06:34:06 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:40 -0400
commitb3cbea03b4edbd6b625dbf813bf8c30c22213cb7 (patch)
tree8624d0c52b80b6de244bbca6f4ab35eb36d7cb62 /fs/9p/vfs_inode.c
parent0e432703aac3b187dd88d81ac23282f7b1c71002 (diff)
fs/9p: Add support for marking inode attribute invalid
With cached mode some of the file system operation result in updating inode attributes (ctime). Add support for marking inode attribute invalid in such cases so that we fetch the updated inode attribute on dentry revalidation. Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r--fs/9p/vfs_inode.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 334ad12a7bbe..a28fe9fa20a4 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -220,6 +220,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
220 spin_lock_init(&v9inode->fscache_lock); 220 spin_lock_init(&v9inode->fscache_lock);
221#endif 221#endif
222 v9inode->writeback_fid = NULL; 222 v9inode->writeback_fid = NULL;
223 v9inode->cache_validity = 0;
223 return &v9inode->vfs_inode; 224 return &v9inode->vfs_inode;
224} 225}
225 226
@@ -1010,6 +1011,7 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1010 char tag_name[14]; 1011 char tag_name[14];
1011 unsigned int i_nlink; 1012 unsigned int i_nlink;
1012 struct v9fs_session_info *v9ses = sb->s_fs_info; 1013 struct v9fs_session_info *v9ses = sb->s_fs_info;
1014 struct v9fs_inode *v9inode = V9FS_I(inode);
1013 1015
1014 inode->i_nlink = 1; 1016 inode->i_nlink = 1;
1015 1017
@@ -1069,6 +1071,7 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
1069 1071
1070 /* not real number of blocks, but 512 byte ones ... */ 1072 /* not real number of blocks, but 512 byte ones ... */
1071 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9; 1073 inode->i_blocks = (i_size_read(inode) + 512 - 1) >> 9;
1074 v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
1072} 1075}
1073 1076
1074/** 1077/**
@@ -1323,6 +1326,32 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1323 return retval; 1326 return retval;
1324} 1327}
1325 1328
1329int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode)
1330{
1331 loff_t i_size;
1332 struct p9_wstat *st;
1333 struct v9fs_session_info *v9ses;
1334
1335 v9ses = v9fs_inode2v9ses(inode);
1336 st = p9_client_stat(fid);
1337 if (IS_ERR(st))
1338 return PTR_ERR(st);
1339
1340 spin_lock(&inode->i_lock);
1341 /*
1342 * We don't want to refresh inode->i_size,
1343 * because we may have cached data
1344 */
1345 i_size = inode->i_size;
1346 v9fs_stat2inode(st, inode, inode->i_sb);
1347 if (v9ses->cache)
1348 inode->i_size = i_size;
1349 spin_unlock(&inode->i_lock);
1350 p9stat_free(st);
1351 kfree(st);
1352 return 0;
1353}
1354
1326static const struct inode_operations v9fs_dir_inode_operations_dotu = { 1355static const struct inode_operations v9fs_dir_inode_operations_dotu = {
1327 .create = v9fs_vfs_create, 1356 .create = v9fs_vfs_create,
1328 .lookup = v9fs_vfs_lookup, 1357 .lookup = v9fs_vfs_lookup,