aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorQu Wenruo <quwenruo@cn.fujitsu.com>2014-07-17 21:55:43 -0400
committerChris Mason <clm@fb.com>2014-08-19 11:52:14 -0400
commit2c91943b5066314a8bb9f0a65584e5e4cd92ea63 (patch)
tree612ffb1243b1a0a01caa40766b70af8adb34e378 /fs
parente2eca69dc6c09d968d69312b9899968a9b03a4a9 (diff)
btrfs: Return right extent when fiemap gives unaligned offset and len.
When page aligned start and len passed to extent_fiemap(), the result is good, but when start and len is not aligned, e.g. start = 1 and len = 4095 is passed to extent_fiemap(), it returns no extent. The problem is that start and len is all rounded down which causes the problem. This patch will round down start and round up (start + len) to return right extent. Reported-by: Chandan Rajendra <chandan@linux.vnet.ibm.com> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Reviewed-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent_io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index a389820d158b..1c70cff4a9e1 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4213,8 +4213,8 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
4213 return -ENOMEM; 4213 return -ENOMEM;
4214 path->leave_spinning = 1; 4214 path->leave_spinning = 1;
4215 4215
4216 start = ALIGN(start, BTRFS_I(inode)->root->sectorsize); 4216 start = round_down(start, BTRFS_I(inode)->root->sectorsize);
4217 len = ALIGN(len, BTRFS_I(inode)->root->sectorsize); 4217 len = round_up(max, BTRFS_I(inode)->root->sectorsize) - start;
4218 4218
4219 /* 4219 /*
4220 * lookup the last file extent. We're not using i_size here 4220 * lookup the last file extent. We're not using i_size here