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:02 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:39 -0400
commita78ce05d5d342297b66122eda8add4eefa21f8a8 (patch)
tree84b9b4009ba0279ffbbc79382bbdbc6f168f23d8 /fs/9p/vfs_inode.c
parenta12119087bd803d3fa0b067ee18497e2e5d064cd (diff)
fs/9p: Add v9fs_inode
Switch to the fscache code to v9fs_inode. We will later use v9fs_inode in cache=loose mode to track the inode cache validity timeout. Ie if we find an inode in cache older that a specific jiffie range we will consider it stale 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.c36
1 files changed, 16 insertions, 20 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 304904b40610..411c70a88b36 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -203,26 +203,23 @@ v9fs_blank_wstat(struct p9_wstat *wstat)
203 wstat->extension = NULL; 203 wstat->extension = NULL;
204} 204}
205 205
206#ifdef CONFIG_9P_FSCACHE
207/** 206/**
208 * v9fs_alloc_inode - helper function to allocate an inode 207 * v9fs_alloc_inode - helper function to allocate an inode
209 * This callback is executed before setting up the inode so that we
210 * can associate a vcookie with each inode.
211 * 208 *
212 */ 209 */
213
214struct inode *v9fs_alloc_inode(struct super_block *sb) 210struct inode *v9fs_alloc_inode(struct super_block *sb)
215{ 211{
216 struct v9fs_cookie *vcookie; 212 struct v9fs_inode *v9inode;
217 vcookie = (struct v9fs_cookie *)kmem_cache_alloc(vcookie_cache, 213 v9inode = (struct v9fs_inode *)kmem_cache_alloc(v9fs_inode_cache,
218 GFP_KERNEL); 214 GFP_KERNEL);
219 if (!vcookie) 215 if (!v9inode)
220 return NULL; 216 return NULL;
221 217#ifdef CONFIG_9P_FSCACHE
222 vcookie->fscache = NULL; 218 v9inode->fscache = NULL;
223 vcookie->qid = NULL; 219 v9inode->fscache_key = NULL;
224 spin_lock_init(&vcookie->lock); 220 spin_lock_init(&v9inode->fscache_lock);
225 return &vcookie->inode; 221#endif
222 return &v9inode->vfs_inode;
226} 223}
227 224
228/** 225/**
@@ -234,14 +231,13 @@ static void v9fs_i_callback(struct rcu_head *head)
234{ 231{
235 struct inode *inode = container_of(head, struct inode, i_rcu); 232 struct inode *inode = container_of(head, struct inode, i_rcu);
236 INIT_LIST_HEAD(&inode->i_dentry); 233 INIT_LIST_HEAD(&inode->i_dentry);
237 kmem_cache_free(vcookie_cache, v9fs_inode2cookie(inode)); 234 kmem_cache_free(v9fs_inode_cache, V9FS_I(inode));
238} 235}
239 236
240void v9fs_destroy_inode(struct inode *inode) 237void v9fs_destroy_inode(struct inode *inode)
241{ 238{
242 call_rcu(&inode->i_rcu, v9fs_i_callback); 239 call_rcu(&inode->i_rcu, v9fs_i_callback);
243} 240}
244#endif
245 241
246int v9fs_init_inode(struct v9fs_session_info *v9ses, 242int v9fs_init_inode(struct v9fs_session_info *v9ses,
247 struct inode *inode, int mode) 243 struct inode *inode, int mode)
@@ -459,7 +455,7 @@ static struct inode *v9fs_qid_iget(struct super_block *sb,
459 455
460 v9fs_stat2inode(st, inode, sb); 456 v9fs_stat2inode(st, inode, sb);
461#ifdef CONFIG_9P_FSCACHE 457#ifdef CONFIG_9P_FSCACHE
462 v9fs_vcookie_set_qid(ret, &st->qid); 458 v9fs_fscache_set_key(inode, &st->qid);
463 v9fs_cache_inode_get_cookie(inode); 459 v9fs_cache_inode_get_cookie(inode);
464#endif 460#endif
465 unlock_new_inode(inode); 461 unlock_new_inode(inode);
@@ -472,8 +468,8 @@ error:
472} 468}
473 469
474struct inode * 470struct inode *
475v9fs_inode(struct v9fs_session_info *v9ses, struct p9_fid *fid, 471v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
476 struct super_block *sb) 472 struct super_block *sb)
477{ 473{
478 struct p9_wstat *st; 474 struct p9_wstat *st;
479 struct inode *inode = NULL; 475 struct inode *inode = NULL;
@@ -572,7 +568,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
572 } 568 }
573 569
574 /* instantiate inode and assign the unopened fid to the dentry */ 570 /* instantiate inode and assign the unopened fid to the dentry */
575 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); 571 inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
576 if (IS_ERR(inode)) { 572 if (IS_ERR(inode)) {
577 err = PTR_ERR(inode); 573 err = PTR_ERR(inode);
578 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); 574 P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err);
@@ -747,7 +743,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
747 return ERR_PTR(result); 743 return ERR_PTR(result);
748 } 744 }
749 745
750 inode = v9fs_inode_from_fid(v9ses, fid, dir->i_sb); 746 inode = v9fs_get_inode_from_fid(v9ses, fid, dir->i_sb);
751 if (IS_ERR(inode)) { 747 if (IS_ERR(inode)) {
752 result = PTR_ERR(inode); 748 result = PTR_ERR(inode);
753 inode = NULL; 749 inode = NULL;