[PATCH 5/5] xfs: use bio_await in xfs_zone_gc_reset_sync

Christoph Hellwig
2026-04-07T14:06:06Z

Replace the open-coded bio wait logic with the new bio_await helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
---
fs/xfs/xfs_zone_gc.c | 19 +++++--------------
1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/fs/xfs/xfs_zone_gc.c b/fs/xfs/xfs_zone_gc.c
index eebe6f4fee1f..b2626a482563 100644
--- a/fs/xfs/xfs_zone_gc.c
+++ b/fs/xfs/xfs_zone_gc.c
@@ -900,9 +900,10 @@ xfs_zone_gc_finish_reset(

static void
xfs_submit_zone_reset_bio(
- struct xfs_rtgroup *rtg,
- struct bio *bio)
+ struct bio *bio,
+ void *priv)
{
+ struct xfs_rtgroup *rtg = priv;
struct xfs_mount *mp = rtg_mount(rtg);

trace_xfs_zone_reset(rtg);
@@ -934,26 +935,16 @@ xfs_submit_zone_reset_bio(
submit_bio(bio);
}

-static void xfs_bio_wait_endio(struct bio *bio)
-{
- complete(bio->bi_private);
-}
-
int
xfs_zone_gc_reset_sync(
struct xfs_rtgroup *rtg)
{
- DECLARE_COMPLETION_ONSTACK(done);
struct bio bio;
int error;

bio_init(&bio, rtg_mount(rtg)->m_rtdev_targp->bt_bdev, NULL, 0,
REQ_OP_ZONE_RESET | REQ_SYNC);
- bio.bi_private = &done;
- bio.bi_end_io = xfs_bio_wait_endio;
- xfs_submit_zone_reset_bio(rtg, &bio);
- wait_for_completion_io(&done);
-
+ bio_await(&bio, rtg, xfs_submit_zone_reset_bio);
error = blk_status_to_errno(bio.bi_status);
bio_uninit(&bio);
return error;
@@ -990,7 +981,7 @@ xfs_zone_gc_reset_zones(
chunk->data = data;
WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
list_add_tail(&chunk->entry, &data->resetting);
- xfs_submit_zone_reset_bio(rtg, bio);
+ xfs_submit_zone_reset_bio(bio, rtg);
} while (next);
}

--
2.47.3