Skip to contentSkip to conversation

btrfs: User assert to document transaction requirement

PATCH In review Nikolay Borisov 3 participants 3 messages Oct 8, 2019 – Oct 10, 2019 Btrfs file system

lore
Share & tools
lore
#0 lore raw

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.

---
 fs/btrfs/extent-tree.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
fs/btrfs/extent-tree.c +2 -3
index 5f4b0c4e22aa..59989ee64dbc 100644
@@ -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