Skip to content

Commit

Permalink
ceph: update readpages osd request according to size of pages
Browse files Browse the repository at this point in the history
add_to_page_cache_lru() can fails, so the actual pages to read
can be smaller than the initial size of osd request. We need to
update osd request size in that case.

Signed-off-by: Yan, Zheng <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
  • Loading branch information
ukernel authored and idryomov committed Feb 20, 2017
1 parent 24c149a commit d641df8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions fs/ceph/addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ static int start_read(struct inode *inode, struct list_head *page_list, int max)
nr_pages = i;
if (nr_pages > 0) {
len = nr_pages << PAGE_SHIFT;
osd_req_op_extent_update(req, 0, len);
break;
}
goto out_pages;
Expand Down
3 changes: 2 additions & 1 deletion net/ceph/osd_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,8 @@ void osd_req_op_extent_update(struct ceph_osd_request *osd_req,
BUG_ON(length > previous);

op->extent.length = length;
op->indata_len -= previous - length;
if (op->op == CEPH_OSD_OP_WRITE || op->op == CEPH_OSD_OP_WRITEFULL)
op->indata_len -= previous - length;
}
EXPORT_SYMBOL(osd_req_op_extent_update);

Expand Down

0 comments on commit d641df8

Please sign in to comment.