Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 352888
b: refs/heads/master
c: 4d53dc9
h: refs/heads/master
v: v3
  • Loading branch information
Maxim Patlasov authored and Miklos Szeredi committed Jan 24, 2013
1 parent 5944a11 commit eb0ba0b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b111c8c0e3e5e780ae0758fc4c1c376a7c9d5997
refs/heads/master: 4d53dc99baf139e4fa0d395f7658032cc2eb3297
25 changes: 15 additions & 10 deletions trunk/fs/fuse/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,13 +1577,24 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
unsigned int num;
unsigned int offset;
size_t total_len = 0;
int num_pages;

req = fuse_get_req(fc, FUSE_MAX_PAGES_PER_REQ);
offset = outarg->offset & ~PAGE_CACHE_MASK;
file_size = i_size_read(inode);

num = outarg->size;
if (outarg->offset > file_size)
num = 0;
else if (outarg->offset + num > file_size)
num = file_size - outarg->offset;

num_pages = (num + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
num_pages = min(num_pages, FUSE_MAX_PAGES_PER_REQ);

req = fuse_get_req(fc, num_pages);
if (IS_ERR(req))
return PTR_ERR(req);

offset = outarg->offset & ~PAGE_CACHE_MASK;

req->in.h.opcode = FUSE_NOTIFY_REPLY;
req->in.h.nodeid = outarg->nodeid;
req->in.numargs = 2;
Expand All @@ -1592,14 +1603,8 @@ static int fuse_retrieve(struct fuse_conn *fc, struct inode *inode,
req->end = fuse_retrieve_end;

index = outarg->offset >> PAGE_CACHE_SHIFT;
file_size = i_size_read(inode);
num = outarg->size;
if (outarg->offset > file_size)
num = 0;
else if (outarg->offset + num > file_size)
num = file_size - outarg->offset;

while (num && req->num_pages < FUSE_MAX_PAGES_PER_REQ) {
while (num && req->num_pages < num_pages) {
struct page *page;
unsigned int this_num;

Expand Down

0 comments on commit eb0ba0b

Please sign in to comment.