diff options
-rw-r--r-- | fs/ceph/file.c | 14 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 10 |
2 files changed, 12 insertions, 12 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 9542f07d0b93..4698a5c553dc 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -290,7 +290,6 @@ static int striped_read(struct inode *inode, | |||
290 | struct ceph_inode_info *ci = ceph_inode(inode); | 290 | struct ceph_inode_info *ci = ceph_inode(inode); |
291 | u64 pos, this_len; | 291 | u64 pos, this_len; |
292 | int io_align, page_align; | 292 | int io_align, page_align; |
293 | int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */ | ||
294 | int left, pages_left; | 293 | int left, pages_left; |
295 | int read; | 294 | int read; |
296 | struct page **page_pos; | 295 | struct page **page_pos; |
@@ -326,12 +325,11 @@ more: | |||
326 | ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : ""); | 325 | ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : ""); |
327 | 326 | ||
328 | if (ret > 0) { | 327 | if (ret > 0) { |
329 | int didpages = | 328 | int didpages = (page_align + ret) >> PAGE_CACHE_SHIFT; |
330 | ((pos & ~PAGE_CACHE_MASK) + ret) >> PAGE_CACHE_SHIFT; | ||
331 | 329 | ||
332 | if (read < pos - off) { | 330 | if (read < pos - off) { |
333 | dout(" zero gap %llu to %llu\n", off + read, pos); | 331 | dout(" zero gap %llu to %llu\n", off + read, pos); |
334 | ceph_zero_page_vector_range(page_off + read, | 332 | ceph_zero_page_vector_range(page_align + read, |
335 | pos - off - read, pages); | 333 | pos - off - read, pages); |
336 | } | 334 | } |
337 | pos += ret; | 335 | pos += ret; |
@@ -356,7 +354,7 @@ more: | |||
356 | left = inode->i_size - pos; | 354 | left = inode->i_size - pos; |
357 | 355 | ||
358 | dout("zero tail %d\n", left); | 356 | dout("zero tail %d\n", left); |
359 | ceph_zero_page_vector_range(page_off + read, left, | 357 | ceph_zero_page_vector_range(page_align + read, left, |
360 | pages); | 358 | pages); |
361 | read += left; | 359 | read += left; |
362 | } | 360 | } |
@@ -478,9 +476,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
478 | else | 476 | else |
479 | pos = *offset; | 477 | pos = *offset; |
480 | 478 | ||
481 | io_align = pos & ~PAGE_MASK; | ||
482 | buf_align = (unsigned long)data & ~PAGE_MASK; | ||
483 | |||
484 | ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); | 479 | ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); |
485 | if (ret < 0) | 480 | if (ret < 0) |
486 | return ret; | 481 | return ret; |
@@ -504,6 +499,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, | |||
504 | * boundary. this isn't atomic, unfortunately. :( | 499 | * boundary. this isn't atomic, unfortunately. :( |
505 | */ | 500 | */ |
506 | more: | 501 | more: |
502 | io_align = pos & ~PAGE_MASK; | ||
503 | buf_align = (unsigned long)data & ~PAGE_MASK; | ||
507 | len = left; | 504 | len = left; |
508 | if (file->f_flags & O_DIRECT) { | 505 | if (file->f_flags & O_DIRECT) { |
509 | /* write from beginning of first page, regardless of | 506 | /* write from beginning of first page, regardless of |
@@ -593,6 +590,7 @@ out: | |||
593 | pos += len; | 590 | pos += len; |
594 | written += len; | 591 | written += len; |
595 | left -= len; | 592 | left -= len; |
593 | data += written; | ||
596 | if (left) | 594 | if (left) |
597 | goto more; | 595 | goto more; |
598 | 596 | ||
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 9cb627a4073a..7330c2757c0c 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -477,8 +477,9 @@ struct ceph_osd_request *ceph_osdc_new_request(struct ceph_osd_client *osdc, | |||
477 | calc_layout(osdc, vino, layout, off, plen, req, ops); | 477 | calc_layout(osdc, vino, layout, off, plen, req, ops); |
478 | req->r_file_layout = *layout; /* keep a copy */ | 478 | req->r_file_layout = *layout; /* keep a copy */ |
479 | 479 | ||
480 | /* in case it differs from natural alignment that calc_layout | 480 | /* in case it differs from natural (file) alignment that |
481 | filled in for us */ | 481 | calc_layout filled in for us */ |
482 | req->r_num_pages = calc_pages_for(page_align, *plen); | ||
482 | req->r_page_alignment = page_align; | 483 | req->r_page_alignment = page_align; |
483 | 484 | ||
484 | ceph_osdc_build_request(req, off, plen, ops, | 485 | ceph_osdc_build_request(req, off, plen, ops, |
@@ -2027,8 +2028,9 @@ static struct ceph_msg *get_reply(struct ceph_connection *con, | |||
2027 | int want = calc_pages_for(req->r_page_alignment, data_len); | 2028 | int want = calc_pages_for(req->r_page_alignment, data_len); |
2028 | 2029 | ||
2029 | if (unlikely(req->r_num_pages < want)) { | 2030 | if (unlikely(req->r_num_pages < want)) { |
2030 | pr_warning("tid %lld reply %d > expected %d pages\n", | 2031 | pr_warning("tid %lld reply has %d bytes %d pages, we" |
2031 | tid, want, m->nr_pages); | 2032 | " had only %d pages ready\n", tid, data_len, |
2033 | want, req->r_num_pages); | ||
2032 | *skip = 1; | 2034 | *skip = 1; |
2033 | ceph_msg_put(m); | 2035 | ceph_msg_put(m); |
2034 | m = NULL; | 2036 | m = NULL; |