diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-05 16:15:57 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-05 16:15:57 -0400 |
commit | 121782a248f11c63c7c0fc78d4a68a54e99ee37d (patch) | |
tree | fd2a93f961e472bf146c8b752ab303f612d93ed1 /fs | |
parent | a8728d35549d3203a8cb0055b9d2c217a21ac7eb (diff) | |
parent | d7f124f129a6aea99938e0d4172c741b56fefeda (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
ceph: fix sync and dio writes across stripe boundaries
libceph: fix page calculation for non-page-aligned io
ceph: fix page alignment corrections
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/file.c | 14 |
1 files changed, 6 insertions, 8 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 | ||