aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ctree.h
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2019-08-09 17:48:21 +0200
committerDavid Sterba <dsterba@suse.com>2019-09-09 14:59:16 +0200
commitc82f823c9b006c31059341af41da9f8b2e3e64d9 (patch)
treeb6b9204325f78f83df3a1a871ee4a7abc6e29b07 /fs/btrfs/ctree.h
parentbtrfs: assume valid token for btrfs_set/get_token helpers (diff)
downloadlinux-dev-c82f823c9b006c31059341af41da9f8b2e3e64d9.tar.xz
linux-dev-c82f823c9b006c31059341af41da9f8b2e3e64d9.zip
btrfs: tie extent buffer and it's token together
Further simplifaction of the get/set helpers is possible when the token is uniquely tied to an extent buffer. A condition and an assignment can be avoided. The initializations are moved closer to the first use when the extent buffer is valid. There's one exception in __push_leaf_left where the token is reused. Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r--fs/btrfs/ctree.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index 8e18fb062215..033a0d5d1789 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1303,8 +1303,10 @@ struct btrfs_map_token {
#define BTRFS_BYTES_TO_BLKS(fs_info, bytes) \
((bytes) >> (fs_info)->sb->s_blocksize_bits)
-static inline void btrfs_init_map_token (struct btrfs_map_token *token)
+static inline void btrfs_init_map_token(struct btrfs_map_token *token,
+ struct extent_buffer *eb)
{
+ token->eb = eb;
token->kaddr = NULL;
}