Message ID | 20191008132616.18183-1-nborisov@suse.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: User assert to document transaction requirement | expand |
Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
On Tue, Oct 08, 2019 at 04:26:16PM +0300, Nikolay Borisov wrote: > 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 <nborisov@suse.com> Added to misc-next, thanks.
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5f4b0c4e22aa..59989ee64dbc 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -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 */
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 <nborisov@suse.com> --- fs/btrfs/extent-tree.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)