Commit 6690d071 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Make pin_down_extent take transaction handle

All callers have a reference to a transaction handle so pass it to
pin_down_extent. This is the final step before switching pinned extent
tracking to a per-transaction basis.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 9fce5704
...@@ -2585,7 +2585,8 @@ static u64 first_logical_byte(struct btrfs_fs_info *fs_info, u64 search_start) ...@@ -2585,7 +2585,8 @@ static u64 first_logical_byte(struct btrfs_fs_info *fs_info, u64 search_start)
return bytenr; return bytenr;
} }
static int pin_down_extent(struct btrfs_block_group *cache, static int pin_down_extent(struct btrfs_trans_handle *trans,
struct btrfs_block_group *cache,
u64 bytenr, u64 num_bytes, int reserved) u64 bytenr, u64 num_bytes, int reserved)
{ {
struct btrfs_fs_info *fs_info = cache->fs_info; struct btrfs_fs_info *fs_info = cache->fs_info;
...@@ -2617,7 +2618,7 @@ int btrfs_pin_extent(struct btrfs_trans_handle *trans, ...@@ -2617,7 +2618,7 @@ int btrfs_pin_extent(struct btrfs_trans_handle *trans,
cache = btrfs_lookup_block_group(trans->fs_info, bytenr); cache = btrfs_lookup_block_group(trans->fs_info, bytenr);
BUG_ON(!cache); /* Logic error */ BUG_ON(!cache); /* Logic error */
pin_down_extent(cache, bytenr, num_bytes, reserved); pin_down_extent(trans, cache, bytenr, num_bytes, reserved);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return 0; return 0;
...@@ -2644,7 +2645,7 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans, ...@@ -2644,7 +2645,7 @@ int btrfs_pin_extent_for_log_replay(struct btrfs_trans_handle *trans,
*/ */
btrfs_cache_block_group(cache, 1); btrfs_cache_block_group(cache, 1);
pin_down_extent(cache, bytenr, num_bytes, 0); pin_down_extent(trans, cache, bytenr, num_bytes, 0);
/* remove us from the free space cache (if we're there at all) */ /* remove us from the free space cache (if we're there at all) */
ret = btrfs_remove_free_space(cache, bytenr, num_bytes); ret = btrfs_remove_free_space(cache, bytenr, num_bytes);
...@@ -3296,7 +3297,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans, ...@@ -3296,7 +3297,7 @@ void btrfs_free_tree_block(struct btrfs_trans_handle *trans,
cache = btrfs_lookup_block_group(fs_info, buf->start); cache = btrfs_lookup_block_group(fs_info, buf->start);
if (btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) { if (btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
pin_down_extent(cache, buf->start, buf->len, 1); pin_down_extent(trans, cache, buf->start, buf->len, 1);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
goto out; goto out;
} }
...@@ -4197,7 +4198,7 @@ int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start, ...@@ -4197,7 +4198,7 @@ int btrfs_pin_reserved_extent(struct btrfs_trans_handle *trans, u64 start,
return -ENOSPC; return -ENOSPC;
} }
ret = pin_down_extent(cache, start, len, 1); ret = pin_down_extent(trans, cache, start, len, 1);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
return ret; return ret;
} }
......
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