aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_file.c
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-02-28 06:34:03 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:39 -0400
commit6b39f6d22fbf67cf795c105b4d67c64e9c352ca4 (patch)
tree0d0926901486e334feb5422ee2b0e56b45e9a970 /fs/9p/vfs_file.c
parenta78ce05d5d342297b66122eda8add4eefa21f8a8 (diff)
fs/9p: Move writeback fid to v9fs_inode
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_file.c')
-rw-r--r--fs/9p/vfs_file.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c
index f7b571ddf99e..98c4307a1f03 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -56,11 +56,13 @@ static const struct vm_operations_struct v9fs_file_vm_ops;
56int v9fs_file_open(struct inode *inode, struct file *file) 56int v9fs_file_open(struct inode *inode, struct file *file)
57{ 57{
58 int err; 58 int err;
59 struct v9fs_inode *v9inode;
59 struct v9fs_session_info *v9ses; 60 struct v9fs_session_info *v9ses;
60 struct p9_fid *fid; 61 struct p9_fid *fid;
61 int omode; 62 int omode;
62 63
63 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file); 64 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p file: %p\n", inode, file);
65 v9inode = V9FS_I(inode);
64 v9ses = v9fs_inode2v9ses(inode); 66 v9ses = v9fs_inode2v9ses(inode);
65 if (v9fs_proto_dotl(v9ses)) 67 if (v9fs_proto_dotl(v9ses))
66 omode = file->f_flags; 68 omode = file->f_flags;
@@ -88,9 +90,9 @@ int v9fs_file_open(struct inode *inode, struct file *file)
88 } 90 }
89 91
90 file->private_data = fid; 92 file->private_data = fid;
91 if (v9ses->cache && !inode->i_private) { 93 if (v9ses->cache && !v9inode->writeback_fid) {
92 /* 94 /*
93 * clone a fid and add it to inode->i_private 95 * clone a fid and add it to writeback_fid
94 * we do it during open time instead of 96 * we do it during open time instead of
95 * page dirty time via write_begin/page_mkwrite 97 * page dirty time via write_begin/page_mkwrite
96 * because we want write after unlink usecase 98 * because we want write after unlink usecase
@@ -101,7 +103,7 @@ int v9fs_file_open(struct inode *inode, struct file *file)
101 err = PTR_ERR(fid); 103 err = PTR_ERR(fid);
102 goto out_error; 104 goto out_error;
103 } 105 }
104 inode->i_private = (void *) fid; 106 v9inode->writeback_fid = (void *) fid;
105 } 107 }
106#ifdef CONFIG_9P_FSCACHE 108#ifdef CONFIG_9P_FSCACHE
107 if (v9ses->cache) 109 if (v9ses->cache)
@@ -550,6 +552,7 @@ v9fs_file_mmap(struct file *file, struct vm_area_struct *vma)
550static int 552static int
551v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) 553v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
552{ 554{
555 struct v9fs_inode *v9inode;
553 struct page *page = vmf->page; 556 struct page *page = vmf->page;
554 struct file *filp = vma->vm_file; 557 struct file *filp = vma->vm_file;
555 struct inode *inode = filp->f_path.dentry->d_inode; 558 struct inode *inode = filp->f_path.dentry->d_inode;
@@ -558,9 +561,10 @@ v9fs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
558 P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n", 561 P9_DPRINTK(P9_DEBUG_VFS, "page %p fid %lx\n",
559 page, (unsigned long)filp->private_data); 562 page, (unsigned long)filp->private_data);
560 563
564 v9inode = V9FS_I(inode);
561 /* make sure the cache has finished storing the page */ 565 /* make sure the cache has finished storing the page */
562 v9fs_fscache_wait_on_page_write(inode, page); 566 v9fs_fscache_wait_on_page_write(inode, page);
563 BUG_ON(!inode->i_private); 567 BUG_ON(!v9inode->writeback_fid);
564 lock_page(page); 568 lock_page(page);
565 if (page->mapping != inode->i_mapping) 569 if (page->mapping != inode->i_mapping)
566 goto out_unlock; 570 goto out_unlock;