btrfs: User assert to document transaction requirement
PATCH 1/1 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.
Signed-off-by Nikolay Borisov <[email protected]>
--- fs/btrfs/extent-tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/extent-tree.c +2 -3
@@ -2589,15 +2589,14 @@ static int pin_down_extent(struct btrfs_block_group_cache *cache, bytenr + num_bytes - 1, GFP_NOFS | __GFP_NOFAIL); } -/* -* this function must be called within transaction -*/ int btrfs_pin_extent (struct btrfs_fs_info *fs_info,u64 bytenr,u64 num_bytes,int reserved) {struct btrfs_block_group_cache *cache;int ret; +ASSERT (fs_info->running_transaction); + cache =btrfs_lookup_block_group (fs_info, bytenr);BUG_ON (!cache);/* Logic error */
Signature · 1 line
2.17.1
Looks good,
Reviewed-by Johannes Thumshirn <[email protected]>
Signature · 8 lines
Johannes Thumshirn SUSE Labs Filesystems [email protected] +49 911 74053 689 SUSE Software Solutions Germany GmbH Maxfeldstr. 5 90409 Nürnberg Germany (HRB 247165, AG München) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
Quoted 4 lines · Nikolay Borisov
Using an ASSERT in
btrfs_pin_extentallows to more stringently observe whether the function is called under a transaction or not.Signed-off-by Nikolay Borisov <[email protected]>
Added to misc-next, thanks.