Skip to contentSkip to conversation

FAILED: patch "[PATCH] xfs: add newly added RTGs to the free pool in growfs" failed to apply to 6.18-stable tree

PATCH New [email protected] 2 participants 2 messages Jul 14 – Jul 18

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x ae3692c7f440c1ff577aae1a51202415ec4a794b
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071416-estranged-decree-ecfc@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'

Possible dependencies:

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From ae3692c7f440c1ff577aae1a51202415ec4a794b Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <[email protected]>
Date: Wed, 10 Jun 2026 07:07:20 +0200
Subject: [PATCH] xfs: add newly added RTGs to the free pool in growfs

When growing a zoned RT section, the newly added RTGs also need to be tagged as free in the radix tree and add to the nr_free_zones counters. Call xfs_add_free_zone to do that, otherwise using up the newly added space will wait for free zones forever.

Fixes 01b71e64bb87 ("xfs: support growfs on zoned file systems")
fs/xfs/xfs_rtalloc.c +8 -0
index 153f3c378f9f..debbcefdf07f 100644
@@ -933,6 +933,14 @@ xfs_growfs_rt_zoned(
 	mp->m_features |= XFS_FEAT_REALTIME;
 	xfs_rtrmapbt_compute_maxlevels(mp);
 	xfs_rtrefcountbt_compute_maxlevels(mp);
+
+	/*
+	 * Finally add the newly added zone to the freelist and add the space
+	 * to the available counter.  The order is important here: only add
+	 * the available space after the zones, as available space guarantees
+	 * that zones to back it are available.
+	 */
+	xfs_zone_mark_free(rtg);
 	xfs_zoned_add_available(mp, freed_rtx);
 out_free:
 	kfree(nmp);
maintainer
#1 lore raw

PATCH 1/8 xfs: use bio_reuse in the zone GC code

From: Christoph Hellwig <[email protected]>

[ Upstream commit 0506d32f7c52e41f6e8db7c337e0ce6374c6ffbb ]

Replace our somewhat fragile code to reuse the bio, which caused a regression in the past with the block layer bio_reuse helper.

[ sashal: open-coded the bio_reuse logic at the call site as 6.18 lacks
commit 7ca44303f9f6 ("block: add a bio_reuse helper") ]
Stable-dep-of: ae3692c7f440 ("xfs: add newly added RTGs to the free pool in growfs")

---
 fs/xfs/xfs_zone_gc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
fs/xfs/xfs_zone_gc.c +5 -5
index d18c43598d4b39..9ea9166c76d277 100644
@@ -813,9 +813,8 @@ 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;
+	unsigned short		vcnt, i;
 
 	if (chunk->bio.bi_status)
 		xfs_force_shutdown(mp, SHUTDOWN_META_IO_ERROR);
@@ -827,10 +826,11 @@ xfs_zone_gc_write_chunk(
 	WRITE_ONCE(chunk->state, XFS_GC_BIO_NEW);
 	list_move_tail(&chunk->entry, &data->writing);
 
+	vcnt = chunk->bio.bi_vcnt;
 	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));
-
+	for (i = 0; i < vcnt; i++)
+		chunk->bio.bi_iter.bi_size += chunk->bio.bi_io_vec[i].bv_len;
+	chunk->bio.bi_vcnt = vcnt;
 	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);
Signature · 1 line
2.53.0