diff options
author | David Sterba <dsterba@suse.com> | 2019-10-23 18:48:22 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-11-18 17:51:45 +0100 |
commit | b3470b5dbe1300dea94191ae4b7d070be9a5cdc9 (patch) | |
tree | 6afcb7969d6cb3c7f041da9eac5c3772d8470412 /fs/btrfs/scrub.c | |
parent | 0222dfdd4af1be2e70db956db61f9b43386ab76b (diff) | |
download | lwn-b3470b5dbe1300dea94191ae4b7d070be9a5cdc9.tar.gz lwn-b3470b5dbe1300dea94191ae4b7d070be9a5cdc9.zip |
btrfs: add dedicated members for start and length of a block group
The on-disk format of block group item makes use of the key that stores
the offset and length. This is further used in the code, although this
makes thing harder to understand. The key is also packed so the
offset/length is not properly aligned as u64.
Add start (key.objectid) and length (key.offset) members to block group
and remove the embedded key. When the item is searched or written, a
local variable for key is used.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r-- | fs/btrfs/scrub.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 00313a182036..4a5a4e4ef707 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -404,8 +404,8 @@ static u64 get_full_stripe_logical(struct btrfs_block_group_cache *cache, * round_down() can only handle power of 2, while RAID56 full * stripe length can be 64KiB * n, so we need to manually round down. */ - ret = div64_u64(bytenr - cache->key.objectid, cache->full_stripe_len) * - cache->full_stripe_len + cache->key.objectid; + ret = div64_u64(bytenr - cache->start, cache->full_stripe_len) * + cache->full_stripe_len + cache->start; return ret; } @@ -3583,8 +3583,8 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, btrfs_wait_block_group_reservations(cache); btrfs_wait_nocow_writers(cache); ret = btrfs_wait_ordered_roots(fs_info, U64_MAX, - cache->key.objectid, - cache->key.offset); + cache->start, + cache->length); if (ret > 0) { struct btrfs_trans_handle *trans; |