Commit d7f124f1 authored by Sage Weil's avatar Sage Weil

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: default avatarSage Weil <sage@newdream.net>
parent 9bb0ce2b
...@@ -476,9 +476,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, ...@@ -476,9 +476,6 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
else else
pos = *offset; pos = *offset;
io_align = pos & ~PAGE_MASK;
buf_align = (unsigned long)data & ~PAGE_MASK;
ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left); ret = filemap_write_and_wait_range(inode->i_mapping, pos, pos + left);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -502,6 +499,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, ...@@ -502,6 +499,8 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
* boundary. this isn't atomic, unfortunately. :( * boundary. this isn't atomic, unfortunately. :(
*/ */
more: more:
io_align = pos & ~PAGE_MASK;
buf_align = (unsigned long)data & ~PAGE_MASK;
len = left; len = left;
if (file->f_flags & O_DIRECT) { if (file->f_flags & O_DIRECT) {
/* write from beginning of first page, regardless of /* write from beginning of first page, regardless of
...@@ -591,6 +590,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data, ...@@ -591,6 +590,7 @@ static ssize_t ceph_sync_write(struct file *file, const char __user *data,
pos += len; pos += len;
written += len; written += len;
left -= len; left -= len;
data += written;
if (left) if (left)
goto more; goto more;
......
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