diff options
author | David Sterba <dsterba@suse.cz> | 2014-06-04 13:22:26 -0400 |
---|---|---|
committer | Chris Mason <clm@fb.com> | 2014-09-17 16:37:14 -0400 |
commit | 707e8a071528385a87b63a72a37c2322e463c7b8 (patch) | |
tree | 02fa581efa4d2a05b4e786a553cf9e88bd6274b3 /fs/btrfs/scrub.c | |
parent | 962a298f35110edd8f326814ae41a3dd306ecb64 (diff) |
btrfs: use nodesize everywhere, kill leafsize
The nodesize and leafsize were never of different values. Unify the
usage and make nodesize the one. Cleanup the redundant checks and
helpers.
Shaves a few bytes from .text:
text data bss dec hex filename
852418 24560 23112 900090 dbbfa btrfs.ko.before
851074 24584 23112 898770 db6d2 btrfs.ko.after
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 053dd000d4ef..4ae1c5feccbe 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c | |||
@@ -137,7 +137,6 @@ struct scrub_ctx { | |||
137 | int pages_per_rd_bio; | 137 | int pages_per_rd_bio; |
138 | u32 sectorsize; | 138 | u32 sectorsize; |
139 | u32 nodesize; | 139 | u32 nodesize; |
140 | u32 leafsize; | ||
141 | 140 | ||
142 | int is_dev_replace; | 141 | int is_dev_replace; |
143 | struct scrub_wr_ctx wr_ctx; | 142 | struct scrub_wr_ctx wr_ctx; |
@@ -438,7 +437,6 @@ struct scrub_ctx *scrub_setup_ctx(struct btrfs_device *dev, int is_dev_replace) | |||
438 | } | 437 | } |
439 | sctx->first_free = 0; | 438 | sctx->first_free = 0; |
440 | sctx->nodesize = dev->dev_root->nodesize; | 439 | sctx->nodesize = dev->dev_root->nodesize; |
441 | sctx->leafsize = dev->dev_root->leafsize; | ||
442 | sctx->sectorsize = dev->dev_root->sectorsize; | 440 | sctx->sectorsize = dev->dev_root->sectorsize; |
443 | atomic_set(&sctx->bios_in_flight, 0); | 441 | atomic_set(&sctx->bios_in_flight, 0); |
444 | atomic_set(&sctx->workers_pending, 0); | 442 | atomic_set(&sctx->workers_pending, 0); |
@@ -1758,7 +1756,6 @@ static int scrub_checksum_tree_block(struct scrub_block *sblock) | |||
1758 | BTRFS_UUID_SIZE)) | 1756 | BTRFS_UUID_SIZE)) |
1759 | ++fail; | 1757 | ++fail; |
1760 | 1758 | ||
1761 | WARN_ON(sctx->nodesize != sctx->leafsize); | ||
1762 | len = sctx->nodesize - BTRFS_CSUM_SIZE; | 1759 | len = sctx->nodesize - BTRFS_CSUM_SIZE; |
1763 | mapped_size = PAGE_SIZE - BTRFS_CSUM_SIZE; | 1760 | mapped_size = PAGE_SIZE - BTRFS_CSUM_SIZE; |
1764 | p = ((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE; | 1761 | p = ((u8 *)mapped_buffer) + BTRFS_CSUM_SIZE; |
@@ -2196,7 +2193,6 @@ static int scrub_extent(struct scrub_ctx *sctx, u64 logical, u64 len, | |||
2196 | sctx->stat.data_bytes_scrubbed += len; | 2193 | sctx->stat.data_bytes_scrubbed += len; |
2197 | spin_unlock(&sctx->stat_lock); | 2194 | spin_unlock(&sctx->stat_lock); |
2198 | } else if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { | 2195 | } else if (flags & BTRFS_EXTENT_FLAG_TREE_BLOCK) { |
2199 | WARN_ON(sctx->nodesize != sctx->leafsize); | ||
2200 | blocksize = sctx->nodesize; | 2196 | blocksize = sctx->nodesize; |
2201 | spin_lock(&sctx->stat_lock); | 2197 | spin_lock(&sctx->stat_lock); |
2202 | sctx->stat.tree_extents_scrubbed++; | 2198 | sctx->stat.tree_extents_scrubbed++; |
@@ -2487,7 +2483,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, | |||
2487 | btrfs_item_key_to_cpu(l, &key, slot); | 2483 | btrfs_item_key_to_cpu(l, &key, slot); |
2488 | 2484 | ||
2489 | if (key.type == BTRFS_METADATA_ITEM_KEY) | 2485 | if (key.type == BTRFS_METADATA_ITEM_KEY) |
2490 | bytes = root->leafsize; | 2486 | bytes = root->nodesize; |
2491 | else | 2487 | else |
2492 | bytes = key.offset; | 2488 | bytes = key.offset; |
2493 | 2489 | ||
@@ -2910,17 +2906,6 @@ int btrfs_scrub_dev(struct btrfs_fs_info *fs_info, u64 devid, u64 start, | |||
2910 | if (btrfs_fs_closing(fs_info)) | 2906 | if (btrfs_fs_closing(fs_info)) |
2911 | return -EINVAL; | 2907 | return -EINVAL; |
2912 | 2908 | ||
2913 | /* | ||
2914 | * check some assumptions | ||
2915 | */ | ||
2916 | if (fs_info->chunk_root->nodesize != fs_info->chunk_root->leafsize) { | ||
2917 | btrfs_err(fs_info, | ||
2918 | "scrub: size assumption nodesize == leafsize (%d == %d) fails", | ||
2919 | fs_info->chunk_root->nodesize, | ||
2920 | fs_info->chunk_root->leafsize); | ||
2921 | return -EINVAL; | ||
2922 | } | ||
2923 | |||
2924 | if (fs_info->chunk_root->nodesize > BTRFS_STRIPE_LEN) { | 2909 | if (fs_info->chunk_root->nodesize > BTRFS_STRIPE_LEN) { |
2925 | /* | 2910 | /* |
2926 | * in this case scrub is unable to calculate the checksum | 2911 | * in this case scrub is unable to calculate the checksum |