Skip to content

Commit 2d148a2

Browse files
Christoph Hellwigaxboe
authored andcommitted
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>
1 parent 92c3737 commit 2d148a2

1 file changed

Lines changed: 5 additions & 14 deletions

File tree

fs/xfs/xfs_zone_gc.c

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,10 @@ xfs_zone_gc_finish_reset(
902902

903903
static void
904904
xfs_submit_zone_reset_bio(
905-
struct xfs_rtgroup *rtg,
906-
struct bio *bio)
905+
struct bio *bio,
906+
void *priv)
907907
{
908+
struct xfs_rtgroup *rtg = priv;
908909
struct xfs_mount *mp = rtg_mount(rtg);
909910

910911
trace_xfs_zone_reset(rtg);
@@ -936,26 +937,16 @@ xfs_submit_zone_reset_bio(
936937
submit_bio(bio);
937938
}
938939

939-
static void xfs_bio_wait_endio(struct bio *bio)
940-
{
941-
complete(bio->bi_private);
942-
}
943-
944940
int
945941
xfs_zone_gc_reset_sync(
946942
struct xfs_rtgroup *rtg)
947943
{
948-
DECLARE_COMPLETION_ONSTACK(done);
949944
struct bio bio;
950945
int error;
951946

952947
bio_init(&bio, rtg_mount(rtg)->m_rtdev_targp->bt_bdev, NULL, 0,
953948
REQ_OP_ZONE_RESET | REQ_SYNC);
954-
bio.bi_private = &done;
955-
bio.bi_end_io = xfs_bio_wait_endio;
956-
xfs_submit_zone_reset_bio(rtg, &bio);
957-
wait_for_completion_io(&done);
958-
949+
bio_await(&bio, rtg, xfs_submit_zone_reset_bio);
959950
error = blk_status_to_errno(bio.bi_status);
960951
bio_uninit(&bio);
961952
return error;
@@ -992,7 +983,7 @@ xfs_zone_gc_reset_zones(
992983
chunk->data = data;
993984
WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
994985
list_add_tail(&chunk->entry, &data->resetting);
995-
xfs_submit_zone_reset_bio(rtg, bio);
986+
xfs_submit_zone_reset_bio(bio, rtg);
996987
} while (next);
997988
}
998989

0 commit comments

Comments
 (0)