aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode_dotl.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_dotl.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_dotl.c')
-rw-r--r--fs/9p/vfs_inode_dotl.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index c6d9677dcb6e..5c04d66afb1d 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -484,6 +484,7 @@ int v9fs_vfs_setattr_dotl(struct dentry *dentry, struct iattr *iattr)
484void 484void
485v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode) 485v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
486{ 486{
487 struct v9fs_inode *v9inode = V9FS_I(inode);
487 488
488 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) { 489 if ((stat->st_result_mask & P9_STATS_BASIC) == P9_STATS_BASIC) {
489 inode->i_atime.tv_sec = stat->st_atime_sec; 490 inode->i_atime.tv_sec = stat->st_atime_sec;
@@ -542,6 +543,7 @@ v9fs_stat2inode_dotl(struct p9_stat_dotl *stat, struct inode *inode)
542 /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION 543 /* Currently we don't support P9_STATS_BTIME and P9_STATS_DATA_VERSION
543 * because the inode structure does not have fields for them. 544 * because the inode structure does not have fields for them.
544 */ 545 */
546 v9inode->cache_validity &= ~V9FS_INO_INVALID_ATTR;
545} 547}
546 548
547static int 549static int
@@ -822,6 +824,31 @@ ndset:
822 return NULL; 824 return NULL;
823} 825}
824 826
827int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode)
828{
829 loff_t i_size;
830 struct p9_stat_dotl *st;
831 struct v9fs_session_info *v9ses;
832
833 v9ses = v9fs_inode2v9ses(inode);
834 st = p9_client_getattr_dotl(fid, P9_STATS_ALL);
835 if (IS_ERR(st))
836 return PTR_ERR(st);
837
838 spin_lock(&inode->i_lock);
839 /*
840 * We don't want to refresh inode->i_size,
841 * because we may have cached data
842 */
843 i_size = inode->i_size;
844 v9fs_stat2inode_dotl(st, inode);
845 if (v9ses->cache)
846 inode->i_size = i_size;
847 spin_unlock(&inode->i_lock);
848 kfree(st);
849 return 0;
850}
851
825const struct inode_operations v9fs_dir_inode_operations_dotl = { 852const struct inode_operations v9fs_dir_inode_operations_dotl = {
826 .create = v9fs_vfs_create_dotl, 853 .create = v9fs_vfs_create_dotl,
827 .lookup = v9fs_vfs_lookup, 854 .lookup = v9fs_vfs_lookup,