xfs: use bio_await in xfs_zone_gc_reset_sync

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>
Link: https://patch.msgid.link/20260407140538.633364-6-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Christoph Hellwig 2026-04-07 16:05:28 +02:00 committed by Jens Axboe
parent 92c3737a24
commit 2d148a214b

View File

@ -902,9 +902,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);
@ -936,26 +937,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;
@ -992,7 +983,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);
}