Skip to content

Commit a31356b

Browse files
committed
btrfs: don't use set/get token in leaf_space_used
The token is supposed to cache the last page used by the set/get helpers. In leaf_space_used the first and last items are accessed, it's not likely they'd be on the same page so there's some overhead caused updating the token address but not using it. Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 60d48e2 commit a31356b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

fs/btrfs/ctree.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3507,19 +3507,17 @@ static int leaf_space_used(struct extent_buffer *l, int start, int nr)
35073507
{
35083508
struct btrfs_item *start_item;
35093509
struct btrfs_item *end_item;
3510-
struct btrfs_map_token token;
35113510
int data_len;
35123511
int nritems = btrfs_header_nritems(l);
35133512
int end = min(nritems, start + nr) - 1;
35143513

35153514
if (!nr)
35163515
return 0;
3517-
btrfs_init_map_token(&token, l);
35183516
start_item = btrfs_item_nr(start);
35193517
end_item = btrfs_item_nr(end);
3520-
data_len = btrfs_token_item_offset(&token, start_item) +
3521-
btrfs_token_item_size(&token, start_item);
3522-
data_len = data_len - btrfs_token_item_offset(&token, end_item);
3518+
data_len = btrfs_item_offset(l, start_item) +
3519+
btrfs_item_size(l, start_item);
3520+
data_len = data_len - btrfs_item_offset(l, end_item);
35233521
data_len += sizeof(struct btrfs_item) * nr;
35243522
WARN_ON(data_len < 0);
35253523
return data_len;

0 commit comments

Comments
 (0)