diff options
author | Maxim Patlasov <mpatlasov@parallels.com> | 2012-10-26 19:49:33 +0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-01-24 16:21:27 +0100 |
commit | 85f40aec887110ae6bbefa87988def4606a3d583 (patch) | |
tree | 1408110166343717d8b2710f337882309451b7af /fs/fuse/dev.c | |
parent | b2430d7567a376b3685627ca7e9d712f6f27d49b (diff) | |
download | op-kernel-dev-85f40aec887110ae6bbefa87988def4606a3d583.zip op-kernel-dev-85f40aec887110ae6bbefa87988def4606a3d583.tar.gz |
fuse: use req->page_descs[] for argpages cases
Previously, anyone who set flag 'argpages' only filled req->pages[] and set
per-request page_offset. This patch re-works all cases where argpages=1 to
fill req->page_descs[] properly.
Having req->page_descs[] filled properly allows to re-work fuse_copy_pages()
to copy page fragments described by req->page_descs[]. This will be useful
for next patches optimizing direct_IO.
Signed-off-by: Maxim Patlasov <mpatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'fs/fuse/dev.c')
-rw-r--r-- | fs/fuse/dev.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index db4af8f..cbae09e 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -903,11 +903,11 @@ static int fuse_copy_pages(struct fuse_copy_state *cs, unsigned nbytes, { unsigned i; struct fuse_req *req = cs->req; - unsigned offset = req->page_descs[0].offset; - unsigned count = min(nbytes, (unsigned) PAGE_SIZE - offset); for (i = 0; i < req->num_pages && (nbytes || zeroing); i++) { int err; + unsigned offset = req->page_descs[i].offset; + unsigned count = min(nbytes, req->page_descs[i].length); err = fuse_copy_page(cs, &req->pages[i], offset, count, zeroing); @@ -915,8 +915,6 @@ static int fuse_copy_pages(struct fuse_copy_state *cs, unsigned nbytes, return err; nbytes -= count; - count = min(nbytes, (unsigned) PAGE_SIZE); - offset = 0; } return 0; } @@ -1626,6 +1624,7 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode, this_num = min_t(unsigned, num, PAGE_CACHE_SIZE - offset); req->pages[req->num_pages] = page; + req->page_descs[req->num_pages].length = this_num; req->num_pages++; offset = 0; |