Commit 4633a22e authored by Miklos Szeredi's avatar Miklos Szeredi Committed by Linus Torvalds

[PATCH] fuse: clean up page offset calculation

Use page_offset() instead of doing page offset calculation by hand.
Signed-off-by: default avatarMiklos Szeredi <miklos@szeredi.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0aa7c699
...@@ -272,7 +272,6 @@ static int fuse_readpage(struct file *file, struct page *page) ...@@ -272,7 +272,6 @@ static int fuse_readpage(struct file *file, struct page *page)
{ {
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
loff_t pos = (loff_t) page->index << PAGE_CACHE_SHIFT;
struct fuse_req *req = fuse_get_request(fc); struct fuse_req *req = fuse_get_request(fc);
int err = -EINTR; int err = -EINTR;
if (!req) if (!req)
...@@ -281,7 +280,7 @@ static int fuse_readpage(struct file *file, struct page *page) ...@@ -281,7 +280,7 @@ static int fuse_readpage(struct file *file, struct page *page)
req->out.page_zeroing = 1; req->out.page_zeroing = 1;
req->num_pages = 1; req->num_pages = 1;
req->pages[0] = page; req->pages[0] = page;
fuse_send_read(req, file, inode, pos, PAGE_CACHE_SIZE); fuse_send_read(req, file, inode, page_offset(page), PAGE_CACHE_SIZE);
err = req->out.h.error; err = req->out.h.error;
fuse_put_request(fc, req); fuse_put_request(fc, req);
if (!err) if (!err)
...@@ -295,7 +294,7 @@ static int fuse_readpage(struct file *file, struct page *page) ...@@ -295,7 +294,7 @@ static int fuse_readpage(struct file *file, struct page *page)
static int fuse_send_readpages(struct fuse_req *req, struct file *file, static int fuse_send_readpages(struct fuse_req *req, struct file *file,
struct inode *inode) struct inode *inode)
{ {
loff_t pos = (loff_t) req->pages[0]->index << PAGE_CACHE_SHIFT; loff_t pos = page_offset(req->pages[0]);
size_t count = req->num_pages << PAGE_CACHE_SHIFT; size_t count = req->num_pages << PAGE_CACHE_SHIFT;
unsigned i; unsigned i;
req->out.page_zeroing = 1; req->out.page_zeroing = 1;
...@@ -402,7 +401,7 @@ static int fuse_commit_write(struct file *file, struct page *page, ...@@ -402,7 +401,7 @@ static int fuse_commit_write(struct file *file, struct page *page,
unsigned count = to - offset; unsigned count = to - offset;
struct inode *inode = page->mapping->host; struct inode *inode = page->mapping->host;
struct fuse_conn *fc = get_fuse_conn(inode); struct fuse_conn *fc = get_fuse_conn(inode);
loff_t pos = ((loff_t) page->index << PAGE_CACHE_SHIFT) + offset; loff_t pos = page_offset(page) + offset;
struct fuse_req *req = fuse_get_request(fc); struct fuse_req *req = fuse_get_request(fc);
if (!req) if (!req)
return -EINTR; return -EINTR;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment