diff options
author | David Sterba <dsterba@suse.com> | 2019-08-09 17:48:21 +0200 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 14:59:16 +0200 |
commit | c82f823c9b006c31059341af41da9f8b2e3e64d9 (patch) | |
tree | b6b9204325f78f83df3a1a871ee4a7abc6e29b07 /fs/btrfs/tree-log.c | |
parent | 48bc39501a549ec978c8aad28eb89ca3a2a7ca03 (diff) | |
download | linux-c82f823c9b006c31059341af41da9f8b2e3e64d9.tar.gz linux-c82f823c9b006c31059341af41da9f8b2e3e64d9.tar.bz2 linux-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/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 7a0e3f8dec5c..77b6797fcac3 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c @@ -506,7 +506,7 @@ insert: ino_size != 0) { struct btrfs_map_token token; - btrfs_init_map_token(&token); + btrfs_init_map_token(&token, dst_eb); btrfs_set_token_inode_size(dst_eb, dst_item, ino_size, &token); } @@ -3842,7 +3842,7 @@ static void fill_inode_item(struct btrfs_trans_handle *trans, { struct btrfs_map_token token; - btrfs_init_map_token(&token); + btrfs_init_map_token(&token, leaf); if (log_inode_only) { /* set the generation to zero so the recover code @@ -4302,8 +4302,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans, if (ret) return ret; - btrfs_init_map_token(&token); - ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start, em->start + em->len, NULL, 0, 1, sizeof(*fi), &extent_inserted); @@ -4321,6 +4319,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans, return ret; } leaf = path->nodes[0]; + btrfs_init_map_token(&token, leaf); fi = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_file_extent_item); |