Commit 9bb0ce2b authored by Sage Weil's avatar Sage Weil

libceph: fix page calculation for non-page-aligned io

Set the page count correctly for non-page-aligned IO.  We were already
doing this correctly for alignment, but not the page count.  Fixes
DIRECT_IO writes from unaligned pages.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent 773e9b44
...@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, ...@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
calc_layout(osdc, vino, layout, off, plen, req, ops); calc_layout(osdc, vino, layout, off, plen, req, ops);
req->r_file_layout = *layout; /* keep a copy */ req->r_file_layout = *layout; /* keep a copy */
/* in case it differs from natural alignment that calc_layout /* in case it differs from natural (file) alignment that
filled in for us */ calc_layout filled in for us */
req->r_num_pages = calc_pages_for(page_align, *plen);
req->r_page_alignment = page_align; req->r_page_alignment = page_align;
ceph_osdc_build_request(req, off, plen, ops, ceph_osdc_build_request(req, off, plen, ops,
...@@ -2027,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, ...@@ -2027,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
int want = calc_pages_for(req->r_page_alignment, data_len); int want = calc_pages_for(req->r_page_alignment, data_len);
if (unlikely(req->r_num_pages < want)) { if (unlikely(req->r_num_pages < want)) {
pr_warning("tid %lld reply %d > expected %d pages\n", pr_warning("tid %lld reply has %d bytes %d pages, we"
tid, want, m->nr_pages); " had only %d pages ready\n", tid, data_len,
want, req->r_num_pages);
*skip = 1; *skip = 1;
ceph_msg_put(m); ceph_msg_put(m);
m = NULL; m = NULL;
......
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