Skip to content

Commit

Permalink
ceph: fix page alignment corrections
Browse files Browse the repository at this point in the history
 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>
  • Loading branch information
Sage Weil committed Jun 13, 2011
1 parent 0c1f91f commit 773e9b4
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions fs/ceph/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ static int striped_read(struct inode *inode,
struct ceph_inode_info *ci = ceph_inode(inode);
u64 pos, this_len;
int io_align, page_align;
int page_off = off & ~PAGE_CACHE_MASK; /* first byte's offset in page */
int left, pages_left;
int read;
struct page **page_pos;
Expand Down Expand Up @@ -326,12 +325,11 @@ static int striped_read(struct inode *inode,
ret, hit_stripe ? " HITSTRIPE" : "", was_short ? " SHORT" : "");

if (ret > 0) {
int didpages =
((pos & ~PAGE_CACHE_MASK) + ret) >> PAGE_CACHE_SHIFT;
int didpages = (page_align + ret) >> PAGE_CACHE_SHIFT;

if (read < pos - off) {
dout(" zero gap %llu to %llu\n", off + read, pos);
ceph_zero_page_vector_range(page_off + read,
ceph_zero_page_vector_range(page_align + read,
pos - off - read, pages);
}
pos += ret;
Expand All @@ -356,7 +354,7 @@ static int striped_read(struct inode *inode,
left = inode->i_size - pos;

dout("zero tail %d\n", left);
ceph_zero_page_vector_range(page_off + read, left,
ceph_zero_page_vector_range(page_align + read, left,
pages);
read += left;
}
Expand Down

0 comments on commit 773e9b4

Please sign in to comment.