Commit 4dae666a authored by David Sterba's avatar David Sterba

btrfs: use the token::eb for all set/get helpers

The token stores a copy of the extent buffer pointer but does not make
any use of it besides sanity checks. We can use it and drop the eb
parameter from several functions, this patch only switches the use
inside the set/get helpers.
Reviewed-by: default avatarJohannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent f2998ebd
...@@ -62,12 +62,12 @@ u##bits btrfs_get_token_##bits(const struct extent_buffer *eb, \ ...@@ -62,12 +62,12 @@ u##bits btrfs_get_token_##bits(const struct extent_buffer *eb, \
res = get_unaligned_le##bits(p + off); \ res = get_unaligned_le##bits(p + off); \
return res; \ return res; \
} \ } \
err = map_private_extent_buffer(eb, offset, size, \ err = map_private_extent_buffer(token->eb, offset, size, \
&kaddr, &map_start, &map_len); \ &kaddr, &map_start, &map_len); \
if (err) { \ if (err) { \
__le##bits leres; \ __le##bits leres; \
\ \
read_extent_buffer(eb, &leres, offset, size); \ read_extent_buffer(token->eb, &leres, offset, size); \
return le##bits##_to_cpu(leres); \ return le##bits##_to_cpu(leres); \
} \ } \
p = kaddr + part_offset - map_start; \ p = kaddr + part_offset - map_start; \
...@@ -125,13 +125,13 @@ void btrfs_set_token_##bits(struct extent_buffer *eb, \ ...@@ -125,13 +125,13 @@ void btrfs_set_token_##bits(struct extent_buffer *eb, \
put_unaligned_le##bits(val, p + off); \ put_unaligned_le##bits(val, p + off); \
return; \ return; \
} \ } \
err = map_private_extent_buffer(eb, offset, size, \ err = map_private_extent_buffer(token->eb, offset, size, \
&kaddr, &map_start, &map_len); \ &kaddr, &map_start, &map_len); \
if (err) { \ if (err) { \
__le##bits val2; \ __le##bits val2; \
\ \
val2 = cpu_to_le##bits(val); \ val2 = cpu_to_le##bits(val); \
write_extent_buffer(eb, &val2, offset, size); \ write_extent_buffer(token->eb, &val2, offset, size); \
return; \ return; \
} \ } \
p = kaddr + part_offset - map_start; \ p = kaddr + part_offset - map_start; \
......
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