diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2006-01-06 03:19:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:55 -0500 |
commit | 4633a22e7added835fd1d4b072dbcc4474aa3017 (patch) | |
tree | 99561b341f42be443ac27257658a0237abc15a84 /fs | |
parent | 0aa7c6990e7de06131cdc14ef4abfcab017c24a0 (diff) |
[PATCH] fuse: clean up page offset calculation
Use page_offset() instead of doing page offset calculation by hand.
Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/fuse/file.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 2ca86141d13a..18aafa6c9af4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -272,7 +272,6 @@ static int fuse_readpage(struct file *file, struct page *page) | |||
272 | { | 272 | { |
273 | struct inode *inode = page->mapping->host; | 273 | struct inode *inode = page->mapping->host; |
274 | struct fuse_conn *fc = get_fuse_conn(inode); | 274 | struct fuse_conn *fc = get_fuse_conn(inode); |
275 | loff_t pos = (loff_t) page->index << PAGE_CACHE_SHIFT; | ||
276 | struct fuse_req *req = fuse_get_request(fc); | 275 | struct fuse_req *req = fuse_get_request(fc); |
277 | int err = -EINTR; | 276 | int err = -EINTR; |
278 | if (!req) | 277 | if (!req) |
@@ -281,7 +280,7 @@ static int fuse_readpage(struct file *file, struct page *page) | |||
281 | req->out.page_zeroing = 1; | 280 | req->out.page_zeroing = 1; |
282 | req->num_pages = 1; | 281 | req->num_pages = 1; |
283 | req->pages[0] = page; | 282 | req->pages[0] = page; |
284 | fuse_send_read(req, file, inode, pos, PAGE_CACHE_SIZE); | 283 | fuse_send_read(req, file, inode, page_offset(page), PAGE_CACHE_SIZE); |
285 | err = req->out.h.error; | 284 | err = req->out.h.error; |
286 | fuse_put_request(fc, req); | 285 | fuse_put_request(fc, req); |
287 | if (!err) | 286 | if (!err) |
@@ -295,7 +294,7 @@ static int fuse_readpage(struct file *file, struct page *page) | |||
295 | static int fuse_send_readpages(struct fuse_req *req, struct file *file, | 294 | static int fuse_send_readpages(struct fuse_req *req, struct file *file, |
296 | struct inode *inode) | 295 | struct inode *inode) |
297 | { | 296 | { |
298 | loff_t pos = (loff_t) req->pages[0]->index << PAGE_CACHE_SHIFT; | 297 | loff_t pos = page_offset(req->pages[0]); |
299 | size_t count = req->num_pages << PAGE_CACHE_SHIFT; | 298 | size_t count = req->num_pages << PAGE_CACHE_SHIFT; |
300 | unsigned i; | 299 | unsigned i; |
301 | req->out.page_zeroing = 1; | 300 | req->out.page_zeroing = 1; |
@@ -402,7 +401,7 @@ static int fuse_commit_write(struct file *file, struct page *page, | |||
402 | unsigned count = to - offset; | 401 | unsigned count = to - offset; |
403 | struct inode *inode = page->mapping->host; | 402 | struct inode *inode = page->mapping->host; |
404 | struct fuse_conn *fc = get_fuse_conn(inode); | 403 | struct fuse_conn *fc = get_fuse_conn(inode); |
405 | loff_t pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + offset; | 404 | loff_t pos = page_offset(page) + offset; |
406 | struct fuse_req *req = fuse_get_request(fc); | 405 | struct fuse_req *req = fuse_get_request(fc); |
407 | if (!req) | 406 | if (!req) |
408 | return -EINTR; | 407 | return -EINTR; |