All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer
@ 2022-05-04 23:12 Naohiro Aota
  2022-05-09 19:10 ` David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: Naohiro Aota @ 2022-05-04 23:12 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Naohiro Aota

The block_group->alloc_offset is an offset from the start of the block
group. OTOH, the ->meta_write_pointer is an address in the logical
space. So, we should compare the alloc_offset shifted with the
block_group->start.

Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking")
CC: stable@vger.kernel.org # 5.16+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/zoned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c
index db1848a24d44..253cba8c73ca 100644
--- a/fs/btrfs/zoned.c
+++ b/fs/btrfs/zoned.c
@@ -1900,7 +1900,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
 	/* Check if we have unwritten allocated space */
 	if ((block_group->flags &
 	     (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) &&
-	    block_group->alloc_offset > block_group->meta_write_pointer) {
+	    block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) {
 		spin_unlock(&block_group->lock);
 		return -EAGAIN;
 	}
-- 
2.35.1


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

* Re: [PATCH] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer
  2022-05-04 23:12 [PATCH] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer Naohiro Aota
@ 2022-05-09 19:10 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2022-05-09 19:10 UTC (permalink / raw)
  To: Naohiro Aota; +Cc: linux-btrfs

On Wed, May 04, 2022 at 04:12:48PM -0700, Naohiro Aota wrote:
> The block_group->alloc_offset is an offset from the start of the block
> group. OTOH, the ->meta_write_pointer is an address in the logical
> space. So, we should compare the alloc_offset shifted with the
> block_group->start.
> 
> Fixes: afba2bc036b0 ("btrfs: zoned: implement active zone tracking")
> CC: stable@vger.kernel.org # 5.16+
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Added to misc-next, thanks.

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

end of thread, other threads:[~2022-05-09 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-04 23:12 [PATCH] btrfs: zoned: fix comparison of alloc_offset vs meta_write_pointer Naohiro Aota
2022-05-09 19:10 ` 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.