From 737eaa8d6060f22dc0a7eff934f83c34617eb7d0 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 19 Dec 2024 19:49:38 -0800 Subject: [PATCH] FIXUP: xfs: support zone gaps Signed-off-by: Christoph Hellwig --- db/convert.c | 6 +++++- include/xfs_mount.h | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/db/convert.c b/db/convert.c index 47d3e86fd..3eec4f224 100644 --- a/db/convert.c +++ b/db/convert.c @@ -44,10 +44,14 @@ xfs_daddr_to_rgno( struct xfs_mount *mp, xfs_daddr_t daddr) { + struct xfs_groups *g = &mp->m_groups[XG_TYPE_RTG]; + if (!xfs_has_rtgroups(mp)) return 0; - return XFS_BB_TO_FSBT(mp, daddr) / mp->m_groups[XG_TYPE_RTG].blocks; + if (g->has_daddr_gaps) + return XFS_BB_TO_FSBT(mp, daddr) / (1 << g->blklog); + return XFS_BB_TO_FSBT(mp, daddr) / g->blocks; } typedef enum { diff --git a/include/xfs_mount.h b/include/xfs_mount.h index bf9ebc25f..5a714333c 100644 --- a/include/xfs_mount.h +++ b/include/xfs_mount.h @@ -47,6 +47,15 @@ struct xfs_groups { */ uint8_t blklog; + /* + * Zoned devices can have gaps beyoned the usable capacity of a zone + * and the end in the LBA/daddr address space. In other words, the + * hardware equivalent to the RT groups already takes care of the power + * of 2 alignment for us. In this case the sparse FSB/RTB address space + * maps 1:1 to the device address space. + */ + bool has_daddr_gaps; + /* * Mask to extract the group-relative block number from a FSB. * For a pre-rtgroups filesystem we pretend to have one very large -- 2.50.1