diff options
author | Arne Jansen <sensille@gmx.net> | 2012-02-09 09:09:02 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.cz> | 2012-02-15 10:40:24 -0500 |
commit | 859acaf1a29bbacf6256f1159210c8d6df992b33 (patch) | |
tree | 0e08eca0d031161762623049076a5bf3bf1186c0 /fs/btrfs/scrub.c | |
parent | 2cac13e41bf5b99ffc426bd28dfd2248df1dfa67 (diff) |
btrfs: don't check DUP chunks twice
Because scrub enumerates the dev extent tree to find the chunks to scrub,
it currently finds each DUP chunk twice and also scrubs it twice. This
patch makes sure that scrub_chunk only checks that part of the chunk the
dev extent has been found for. This only changes the behaviour for DUP
chunks.
Reported-and-tested-by: Stefan Behrens <sbehrens@giantdisaster.de>
Signed-off-by: Arne Jansen <sensille@gmx.net>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 9770cc5bfb76..abc0fbffa510 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -1367,7 +1367,8 @@ out: | |||
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static noinline_for_stack int scrub_chunk(struct scrub_dev *sdev, | 1369 | static noinline_for_stack int scrub_chunk(struct scrub_dev *sdev, |
1370 | u64 chunk_tree, u64 chunk_objectid, u64 chunk_offset, u64 length) | 1370 | u64 chunk_tree, u64 chunk_objectid, u64 chunk_offset, u64 length, |
1371 | u64 dev_offset) | ||
1371 | { | 1372 | { |
1372 | struct btrfs_mapping_tree *map_tree = | 1373 | struct btrfs_mapping_tree *map_tree = |
1373 | &sdev->dev->dev_root->fs_info->mapping_tree; | 1374 | &sdev->dev->dev_root->fs_info->mapping_tree; |
@@ -1391,7 +1392,8 @@ static noinline_for_stack int scrub_chunk(struct scrub_dev *sdev, | |||
1391 | goto out; | 1392 | goto out; |
1392 | 1393 | ||
1393 | for (i = 0; i < map->num_stripes; ++i) { | 1394 | for (i = 0; i < map->num_stripes; ++i) { |
1394 | if (map->stripes[i].dev == sdev->dev) { | 1395 | if (map->stripes[i].dev == sdev->dev && |
1396 | map->stripes[i].physical == dev_offset) { | ||
1395 | ret = scrub_stripe(sdev, map, i, chunk_offset, length); | 1397 | ret = scrub_stripe(sdev, map, i, chunk_offset, length); |
1396 | if (ret) | 1398 | if (ret) |
1397 | goto out; | 1399 | goto out; |
@@ -1487,7 +1489,7 @@ int scrub_enumerate_chunks(struct scrub_dev *sdev, u64 start, u64 end) | |||
1487 | break; | 1489 | break; |
1488 | } | 1490 | } |
1489 | ret = scrub_chunk(sdev, chunk_tree, chunk_objectid, | 1491 | ret = scrub_chunk(sdev, chunk_tree, chunk_objectid, |
1490 | chunk_offset, length); | 1492 | chunk_offset, length, found_key.offset); |
1491 | btrfs_put_block_group(cache); | 1493 | btrfs_put_block_group(cache); |
1492 | if (ret) | 1494 | if (ret) |
1493 | break; | 1495 | break; |