Commit ce6d3eb6 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: User assert to document transaction requirement

Using an ASSERT in btrfs_pin_extent allows to more stringently observe
whether the function is called under a transaction or not.
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
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 67439dad
...@@ -2590,14 +2590,13 @@ static int pin_down_extent(struct btrfs_block_group_cache *cache, ...@@ -2590,14 +2590,13 @@ static int pin_down_extent(struct btrfs_block_group_cache *cache,
return 0; return 0;
} }
/*
* this function must be called within transaction
*/
int btrfs_pin_extent(struct btrfs_fs_info *fs_info, int btrfs_pin_extent(struct btrfs_fs_info *fs_info,
u64 bytenr, u64 num_bytes, int reserved) u64 bytenr, u64 num_bytes, int reserved)
{ {
struct btrfs_block_group_cache *cache; struct btrfs_block_group_cache *cache;
ASSERT(fs_info->running_transaction);
cache = btrfs_lookup_block_group(fs_info, bytenr); cache = btrfs_lookup_block_group(fs_info, bytenr);
BUG_ON(!cache); /* Logic error */ BUG_ON(!cache); /* Logic error */
......
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