diff mbox series

btrfs: zoned: zone finish data relocation BG with last IO

Message ID 1ccb7d4e3f582369edc1fb067bdd39d867049a0b.1683582405.git.naohiro.aota@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: zoned: zone finish data relocation BG with last IO | expand

Commit Message

Naohiro Aota May 8, 2023, 10:14 p.m. UTC
For data block groups, we zone finish a zone (or, just deactivate it) when
seeing the last IO in btrfs_finish_ordered_io(). That is only called for
IOs using ZONE_APPEND, but we use a regular WRITE command for data
relocation IOs. Detect it and call btrfs_zone_finish_endio() properly.

Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group")
CC: stable@vger.kernel.org # 6.1+
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
 fs/btrfs/inode.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Johannes Thumshirn May 9, 2023, 3:58 p.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
David Sterba May 9, 2023, 10:12 p.m. UTC | #2
On Mon, May 08, 2023 at 10:14:20PM +0000, Naohiro Aota wrote:
> For data block groups, we zone finish a zone (or, just deactivate it) when
> seeing the last IO in btrfs_finish_ordered_io(). That is only called for
> IOs using ZONE_APPEND, but we use a regular WRITE command for data
> relocation IOs. Detect it and call btrfs_zone_finish_endio() properly.
> 
> Fixes: be1a1d7a5d24 ("btrfs: zoned: finish fully written block group")
> CC: stable@vger.kernel.org # 6.1+
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>

Added to misc-next, thanks.
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4f9ef5ca3856..4e65b2376cf3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -3299,6 +3299,9 @@  int btrfs_finish_ordered_io(struct btrfs_ordered_extent *ordered_extent)
 		btrfs_rewrite_logical_zoned(ordered_extent);
 		btrfs_zone_finish_endio(fs_info, ordered_extent->disk_bytenr,
 					ordered_extent->disk_num_bytes);
+	} else if (btrfs_is_data_reloc_root(inode->root)) {
+		btrfs_zone_finish_endio(fs_info, ordered_extent->disk_bytenr,
+					ordered_extent->disk_num_bytes);
 	}
 
 	if (test_bit(BTRFS_ORDERED_TRUNCATED, &ordered_extent->flags)) {