diff options
author | Josef Bacik <josef@redhat.com> | 2011-11-17 11:34:31 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-11-20 07:42:17 -0500 |
commit | 4d479cf010d56ec9c54f3099992d039918f1296b (patch) | |
tree | efed635e7dc1d53c9a63787846912df1667e8a16 /fs/btrfs | |
parent | f7d61dcd6873c49bcc42be2caa2af1c2511aa915 (diff) |
Btrfs: sectorsize align offsets in fiemap
We've been hitting BUG()'s in btrfs_cont_expand and btrfs_fallocate and anywhere
else that calls btrfs_get_extent while running xfstests 13 in a loop. This is
because fiemap is calling btrfs_get_extent with non-sectorsize aligned offsets,
which will end up adding mappings that are not sectorsize aligned, which will
cause problems in some cases for subsequent calls to btrfs_get_extent for
similar areas that are sectorsize aligned. With this patch I ran xfstests 13 in
a loop for a couple of hours and didn't hit the problem that I could previously
hit in at most 20 minutes. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/extent_io.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index a877b8b212eb..9472d3de5e52 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3366,6 +3366,9 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3366 | return -ENOMEM; | 3366 | return -ENOMEM; |
3367 | path->leave_spinning = 1; | 3367 | path->leave_spinning = 1; |
3368 | 3368 | ||
3369 | start = ALIGN(start, BTRFS_I(inode)->root->sectorsize); | ||
3370 | len = ALIGN(len, BTRFS_I(inode)->root->sectorsize); | ||
3371 | |||
3369 | /* | 3372 | /* |
3370 | * lookup the last file extent. We're not using i_size here | 3373 | * lookup the last file extent. We're not using i_size here |
3371 | * because there might be preallocation past i_size | 3374 | * because there might be preallocation past i_size |
@@ -3413,7 +3416,7 @@ int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
3413 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, | 3416 | lock_extent_bits(&BTRFS_I(inode)->io_tree, start, start + len, 0, |
3414 | &cached_state, GFP_NOFS); | 3417 | &cached_state, GFP_NOFS); |
3415 | 3418 | ||
3416 | em = get_extent_skip_holes(inode, off, last_for_get_extent, | 3419 | em = get_extent_skip_holes(inode, start, last_for_get_extent, |
3417 | get_extent); | 3420 | get_extent); |
3418 | if (!em) | 3421 | if (!em) |
3419 | goto out; | 3422 | goto out; |