diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2011-02-28 06:34:03 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@gmail.com> | 2011-03-15 10:57:39 -0400 |
commit | 6b39f6d22fbf67cf795c105b4d67c64e9c352ca4 (patch) | |
tree | 0d0926901486e334feb5422ee2b0e56b45e9a970 /fs/9p/vfs_addr.c | |
parent | a78ce05d5d342297b66122eda8add4eefa21f8a8 (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_addr.c')
-rw-r--r-- | fs/9p/vfs_addr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 566684ce55e2..ee455526ca5b 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -163,8 +163,10 @@ static int v9fs_vfs_writepage_locked(struct page *page) | |||
163 | int retval, len; | 163 | int retval, len; |
164 | loff_t offset, size; | 164 | loff_t offset, size; |
165 | mm_segment_t old_fs; | 165 | mm_segment_t old_fs; |
166 | struct v9fs_inode *v9inode; | ||
166 | struct inode *inode = page->mapping->host; | 167 | struct inode *inode = page->mapping->host; |
167 | 168 | ||
169 | v9inode = V9FS_I(inode); | ||
168 | size = i_size_read(inode); | 170 | size = i_size_read(inode); |
169 | if (page->index == size >> PAGE_CACHE_SHIFT) | 171 | if (page->index == size >> PAGE_CACHE_SHIFT) |
170 | len = size & ~PAGE_CACHE_MASK; | 172 | len = size & ~PAGE_CACHE_MASK; |
@@ -178,11 +180,11 @@ static int v9fs_vfs_writepage_locked(struct page *page) | |||
178 | 180 | ||
179 | old_fs = get_fs(); | 181 | old_fs = get_fs(); |
180 | set_fs(get_ds()); | 182 | set_fs(get_ds()); |
181 | /* We should have i_private always set */ | 183 | /* We should have writeback_fid always set */ |
182 | BUG_ON(!inode->i_private); | 184 | BUG_ON(!v9inode->writeback_fid); |
183 | 185 | ||
184 | retval = v9fs_file_write_internal(inode, | 186 | retval = v9fs_file_write_internal(inode, |
185 | (struct p9_fid *)inode->i_private, | 187 | v9inode->writeback_fid, |
186 | (__force const char __user *)buffer, | 188 | (__force const char __user *)buffer, |
187 | len, &offset, 0); | 189 | len, &offset, 0); |
188 | if (retval > 0) | 190 | if (retval > 0) |
@@ -274,23 +276,25 @@ static int v9fs_write_begin(struct file *filp, struct address_space *mapping, | |||
274 | { | 276 | { |
275 | int retval = 0; | 277 | int retval = 0; |
276 | struct page *page; | 278 | struct page *page; |
279 | struct v9fs_inode *v9inode; | ||
277 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; | 280 | pgoff_t index = pos >> PAGE_CACHE_SHIFT; |
278 | struct inode *inode = mapping->host; | 281 | struct inode *inode = mapping->host; |
279 | 282 | ||
283 | v9inode = V9FS_I(inode); | ||
280 | start: | 284 | start: |
281 | page = grab_cache_page_write_begin(mapping, index, flags); | 285 | page = grab_cache_page_write_begin(mapping, index, flags); |
282 | if (!page) { | 286 | if (!page) { |
283 | retval = -ENOMEM; | 287 | retval = -ENOMEM; |
284 | goto out; | 288 | goto out; |
285 | } | 289 | } |
286 | BUG_ON(!inode->i_private); | 290 | BUG_ON(!v9inode->writeback_fid); |
287 | if (PageUptodate(page)) | 291 | if (PageUptodate(page)) |
288 | goto out; | 292 | goto out; |
289 | 293 | ||
290 | if (len == PAGE_CACHE_SIZE) | 294 | if (len == PAGE_CACHE_SIZE) |
291 | goto out; | 295 | goto out; |
292 | 296 | ||
293 | retval = v9fs_fid_readpage(inode->i_private, page); | 297 | retval = v9fs_fid_readpage(v9inode->writeback_fid, page); |
294 | page_cache_release(page); | 298 | page_cache_release(page); |
295 | if (!retval) | 299 | if (!retval) |
296 | goto start; | 300 | goto start; |