linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: User assert to document transaction requirement
@ 2019-10-08 13:26 Nikolay Borisov
  2019-10-08 13:31 ` Johannes Thumshirn
  2019-10-10 16:23 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Borisov @ 2019-10-08 13:26 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

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(-)

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 */
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: User assert to document transaction requirement
  2019-10-08 13:26 [PATCH] btrfs: User assert to document transaction requirement Nikolay Borisov
@ 2019-10-08 13:31 ` Johannes Thumshirn
  2019-10-10 16:23 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2019-10-08 13:31 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>

-- 
Johannes Thumshirn                            SUSE Labs Filesystems
jthumshirn@suse.de                                +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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] btrfs: User assert to document transaction requirement
  2019-10-08 13:26 [PATCH] btrfs: User assert to document transaction requirement Nikolay Borisov
  2019-10-08 13:31 ` Johannes Thumshirn
@ 2019-10-10 16:23 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-10-10 16:23 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-10 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 13:26 [PATCH] btrfs: User assert to document transaction requirement Nikolay Borisov
2019-10-08 13:31 ` Johannes Thumshirn
2019-10-10 16:23 ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).