Skip to content

Commit 9bb0ce2

Browse files
committed
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: Sage Weil <sage@newdream.net>
1 parent 773e9b4 commit 9bb0ce2

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

net/ceph/osd_client.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc,
477477
calc_layout(osdc, vino, layout, off, plen, req, ops);
478478
req->r_file_layout = *layout; /* keep a copy */
479479

480-
/* in case it differs from natural alignment that calc_layout
481-
filled in for us */
480+
/* in case it differs from natural (file) alignment that
481+
calc_layout filled in for us */
482+
req->r_num_pages = calc_pages_for(page_align, *plen);
482483
req->r_page_alignment = page_align;
483484

484485
ceph_osdc_build_request(req, off, plen, ops,
@@ -2027,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con,
20272028
int want = calc_pages_for(req->r_page_alignment, data_len);
20282029

20292030
if (unlikely(req->r_num_pages < want)) {
2030-
pr_warning("tid %lld reply %d > expected %d pages\n",
2031-
tid, want, m->nr_pages);
2031+
pr_warning("tid %lld reply has %d bytes %d pages, we"
2032+
" had only %d pages ready\n", tid, data_len,
2033+
want, req->r_num_pages);
20322034
*skip = 1;
20332035
ceph_msg_put(m);
20342036
m = NULL;

0 commit comments

Comments
 (0)