aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-06-07 23:57:14 -0400
committerSage Weil <sage@newdream.net>2011-06-13 19:26:10 -0400
commit773e9b442693b250aa6c452cb0cf5a9343f51cef (patch)
treedbd2d9eacab7272c8ec8ba19a32ea92c559141bf
parent0c1f91f27140cf3b6e38dc4e892adac241c73a20 (diff)
ceph: fix page alignment corrections
dd if=/dev/urandom of=/mnt/fs_depot/dd10 bs=500 seek=8388 count=1 dd if=/mnt/fs_depot/dd10 of=/root/dd10out bs=500 skip=8388 count=1 Reported-by: Henry C Chang <henry.cy.chang@gmail.com> Signed-off-by: Sage Weil <sage@newdream.net>
-rw-r--r--fs/ceph/file.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 9542f07d0b93..2be0f35afdfb 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 }