Commit e6c11f9a authored by David Sterba's avatar David Sterba

btrfs: reuse existing variable in scrub_stripe, reduce stack usage

The key variable occupies 17 bytes, the key_start is used once, we can
simply reuse existing 'key' for that purpose. As the key is not a simple
type, compiler doest not do it on itself.
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 49a3c4d9
...@@ -3070,7 +3070,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, ...@@ -3070,7 +3070,6 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
int slot; int slot;
u64 nstripes; u64 nstripes;
struct extent_buffer *l; struct extent_buffer *l;
struct btrfs_key key;
u64 physical; u64 physical;
u64 logical; u64 logical;
u64 logic_end; u64 logic_end;
...@@ -3079,7 +3078,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, ...@@ -3079,7 +3078,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
int mirror_num; int mirror_num;
struct reada_control *reada1; struct reada_control *reada1;
struct reada_control *reada2; struct reada_control *reada2;
struct btrfs_key key_start; struct btrfs_key key;
struct btrfs_key key_end; struct btrfs_key key_end;
u64 increment = map->stripe_len; u64 increment = map->stripe_len;
u64 offset; u64 offset;
...@@ -3158,21 +3157,21 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx, ...@@ -3158,21 +3157,21 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
scrub_blocked_if_needed(fs_info); scrub_blocked_if_needed(fs_info);
/* FIXME it might be better to start readahead at commit root */ /* FIXME it might be better to start readahead at commit root */
key_start.objectid = logical; key.objectid = logical;
key_start.type = BTRFS_EXTENT_ITEM_KEY; key.type = BTRFS_EXTENT_ITEM_KEY;
key_start.offset = (u64)0; key.offset = (u64)0;
key_end.objectid = logic_end; key_end.objectid = logic_end;
key_end.type = BTRFS_METADATA_ITEM_KEY; key_end.type = BTRFS_METADATA_ITEM_KEY;
key_end.offset = (u64)-1; key_end.offset = (u64)-1;
reada1 = btrfs_reada_add(root, &key_start, &key_end); reada1 = btrfs_reada_add(root, &key, &key_end);
key_start.objectid = BTRFS_EXTENT_CSUM_OBJECTID; key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
key_start.type = BTRFS_EXTENT_CSUM_KEY; key.type = BTRFS_EXTENT_CSUM_KEY;
key_start.offset = logical; key.offset = logical;
key_end.objectid = BTRFS_EXTENT_CSUM_OBJECTID; key_end.objectid = BTRFS_EXTENT_CSUM_OBJECTID;
key_end.type = BTRFS_EXTENT_CSUM_KEY; key_end.type = BTRFS_EXTENT_CSUM_KEY;
key_end.offset = logic_end; key_end.offset = logic_end;
reada2 = btrfs_reada_add(csum_root, &key_start, &key_end); reada2 = btrfs_reada_add(csum_root, &key, &key_end);
if (!IS_ERR(reada1)) if (!IS_ERR(reada1))
btrfs_reada_wait(reada1); btrfs_reada_wait(reada1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment