All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: zoned: Put block group after final usage
@ 2022-03-07 13:30 Nikolay Borisov
  2022-03-07 13:57 ` Johannes Thumshirn
  2022-03-07 13:59 ` David Sterba
  0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Borisov @ 2022-03-07 13:30 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

It's counter-intuitive (and wrong) to put the block group _before_ the
final usage in submit_eb_page. Fix it by re-ordering the call to
btrfs_put_block_group after its final reference. Also fix a minor typo
in 'implies'


Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group")
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 fs/btrfs/extent_io.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index 3f13ff0affdb..ebda09c207f1 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -4786,11 +4786,14 @@ static int submit_eb_page(struct page *page, struct writeback_control *wbc,
 		return ret;
 	}
 	if (cache) {
-		/* Impiles write in zoned mode */
-		btrfs_put_block_group(cache);
-		/* Mark the last eb in a block group */
+		/*
+		 * Implies write in zoned mode.
+		 *
+		 * Mark the last eb in a block group
+		 */
 		if (cache->seq_zone && eb->start + eb->len == cache->zone_capacity)
 			set_bit(EXTENT_BUFFER_ZONE_FINISH, &eb->bflags);
+		btrfs_put_block_group(cache);
 	}
 	ret = write_one_eb(eb, wbc, epd);
 	free_extent_buffer(eb);
--
2.25.1


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

* Re: [PATCH] btrfs: zoned: Put block group after final usage
  2022-03-07 13:30 [PATCH] btrfs: zoned: Put block group after final usage Nikolay Borisov
@ 2022-03-07 13:57 ` Johannes Thumshirn
  2022-03-07 13:59 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Thumshirn @ 2022-03-07 13:57 UTC (permalink / raw)
  To: Nikolay Borisov, linux-btrfs

Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>

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

* Re: [PATCH] btrfs: zoned: Put block group after final usage
  2022-03-07 13:30 [PATCH] btrfs: zoned: Put block group after final usage Nikolay Borisov
  2022-03-07 13:57 ` Johannes Thumshirn
@ 2022-03-07 13:59 ` David Sterba
  1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2022-03-07 13:59 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: linux-btrfs

On Mon, Mar 07, 2022 at 03:30:02PM +0200, Nikolay Borisov wrote:
> It's counter-intuitive (and wrong) to put the block group _before_ the
> final usage in submit_eb_page. Fix it by re-ordering the call to
> btrfs_put_block_group after its final reference. Also fix a minor typo
> in 'implies'
> 
> 
> Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group")
> 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:[~2022-03-07 14:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-07 13:30 [PATCH] btrfs: zoned: Put block group after final usage Nikolay Borisov
2022-03-07 13:57 ` Johannes Thumshirn
2022-03-07 13:59 ` David Sterba

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.