]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: use bio_reuse in the zone GC code
authorChristoph Hellwig <hch@lst.de>
Wed, 14 Jan 2026 13:06:42 +0000 (14:06 +0100)
committerCarlos Maiolino <cem@kernel.org>
Wed, 21 Jan 2026 11:57:16 +0000 (12:57 +0100)
Replace our somewhat fragile code to reuse the bio, which caused a
regression in the past with the block layer bio_reuse helper.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_zone_gc.c

index 446d7cd1545c3e560f91a2ee245f51f87c019b0f..4d8507fd05e608ae9d1bb7b5e0d5bd59570bace3 100644 (file)
@@ -811,8 +811,6 @@ xfs_zone_gc_write_chunk(
 {
        struct xfs_zone_gc_data *data = chunk->data;
        struct xfs_mount        *mp = chunk->ip->i_mount;
-       phys_addr_t             bvec_paddr =
-               bvec_phys(bio_first_bvec_all(&chunk->bio));
        struct xfs_gc_bio       *split_chunk;
 
        if (chunk->bio.bi_status)
@@ -825,10 +823,7 @@ xfs_zone_gc_write_chunk(
        WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
        list_move_tail(&chunk->entry, &data->writing);
 
-       bio_reset(&chunk->bio, mp->m_rtdev_targp->bt_bdev, REQ_OP_WRITE);
-       bio_add_folio_nofail(&chunk->bio, chunk->scratch->folio, chunk->len,
-                       offset_in_folio(chunk->scratch->folio, bvec_paddr));
-
+       bio_reuse(&chunk->bio, REQ_OP_WRITE);
        while ((split_chunk = xfs_zone_gc_split_write(data, chunk)))
                xfs_zone_gc_submit_write(data, split_chunk);
        xfs_zone_gc_submit_write(data, chunk);