aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-06-13 19:22:18 -0400
committerSage Weil <sage@newdream.net>2011-06-13 19:26:22 -0400
commitd7f124f129a6aea99938e0d4172c741b56fefeda (patch)
tree25ee1b2b91de6e490ddd05b00d6a3f844a224987 /fs/ceph
parent9bb0ce2b0b734f3325ea5cd6b351856eeac94f78 (diff)
ceph: fix sync and dio writes across stripe boundaries
We were iterating across stripe boundaries properly, but not moving the write buffer pointer forward. This caused us to rewrite the same data after the break. Fix by adjusting the data pointer forward, and recalculating the io and buffer alignment after the break. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph')
-rw-r--r--fs/ceph/file.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 2be0f35afdfb..4698a5c553dc 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -476,9 +476,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
476 else 476 else
477 pos = *offset; 477 pos = *offset;
478 478
479 io_align = pos & ~PAGE_MASK;
480 buf_align = (unsigned long)data & ~PAGE_MASK;
481
482 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);
483 if (ret < 0) 480 if (ret < 0)
484 return ret; 481 return ret;
@@ -502,6 +499,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
502 * boundary. this isn't atomic, unfortunately. :( 499 * boundary. this isn't atomic, unfortunately. :(
503 */ 500 */
504more: 501more:
502 io_align = pos & ~PAGE_MASK;
503 buf_align = (unsigned long)data & ~PAGE_MASK;
505 len = left; 504 len = left;
506 if (file->f_flags & O_DIRECT) { 505 if (file->f_flags & O_DIRECT) {
507 /* write from beginning of first page, regardless of 506 /* write from beginning of first page, regardless of
@@ -591,6 +590,7 @@ out:
591 pos += len; 590 pos += len;
592 written += len; 591 written += len;
593 left -= len; 592 left -= len;
593 data += written;
594 if (left) 594 if (left)
595 goto more; 595 goto more;
596 596