btrfs: zoned: zone finish data relocation BG with last IO
authorNaohiro Aota <Naohiro.Aota@wdc.com>
Mon, 8 May 2023 22:14:20 +0000 (22:14 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:53:43 +0000 (11:53 +0200)
commit4def3a0a8522199b11e4564c11ddfd9d7896ec4f
tree86f5aa2201112441927f0cbcd032b98485d39165
parent1e8de3223bd23ef1ac09347fc9c1e2ad8b6c26c5
btrfs: zoned: zone finish data relocation BG with last IO

commit f84353c7c20536ea7e01eca79430eccdf3cc7348 upstream.

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+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/inode.c