]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: use bio_await in xfs_zone_gc_reset_sync
authorChristoph Hellwig <hch@lst.de>
Tue, 7 Apr 2026 14:05:28 +0000 (16:05 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 7 Apr 2026 14:22:24 +0000 (08:22 -0600)
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>
fs/xfs/xfs_zone_gc.c

index f279dcca53cc2a8309bd3dedc4fff8a0562d2f0c..441b99727bbcacf2fb55176305cb053aa17da610 100644 (file)
@@ -902,9 +902,10 @@ out:
 
 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);
 }