]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: zoned: properly finish block group on metadata write
authorNaohiro Aota <naohiro.aota@wdc.com>
Wed, 4 May 2022 00:48:53 +0000 (17:48 -0700)
committerDavid Sterba <dsterba@suse.com>
Mon, 16 May 2022 15:17:32 +0000 (17:17 +0200)
commit90fb88cfd5bccb3b9af96a2ac676867ecefd6ea2
tree75be911f6a75bfb976634d369897a0d8edc7dcd9
parent67b3e79a1e1a1c3c997de53cafdc4ff804d7630f
btrfs: zoned: properly finish block group on metadata write

Commit 87590247c4c5 ("btrfs: zoned: finish fully written block group")
introduced zone finishing code both for data and metadata end_io path.
However, the metadata side is not working as it should. First, it
compares logical address (eb->start + eb->len) with offset within a
block group (cache->zone_capacity) in submit_eb_page(). That essentially
disabled zone finishing on metadata end_io path.

Furthermore, fixing the issue above revealed we cannot call
btrfs_zone_finish_endio() in end_extent_buffer_writeback(). We cannot
call btrfs_lookup_block_group() which require spin lock inside end_io
context.

Introduce btrfs_schedule_zone_finish_bg() to wait for the extent buffer
writeback and do the zone finish IO in a workqueue.

Also, drop EXTENT_BUFFER_ZONE_FINISH as it is no longer used.

Fixes: 87590247c4c5 ("btrfs: zoned: finish fully written block group")
CC: stable@vger.kernel.org # 5.16+
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>
fs/btrfs/block-group.h
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/zoned.c
fs/btrfs/zoned.h