]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
FIXUP: xfs: support zone gaps
authorChristoph Hellwig <hch@lst.de>
Fri, 20 Dec 2024 03:49:38 +0000 (19:49 -0800)
committerChristoph Hellwig <hch@lst.de>
Tue, 8 Apr 2025 07:17:18 +0000 (09:17 +0200)
Signed-off-by: Christoph Hellwig <hch@lst.de>
db/convert.c
include/xfs_mount.h

index 47d3e86fdc4ef22f2a1c67c1cedecdbbd25ef511..3eec4f224f518f9fc8f01abdc5de7a3cedbb2966 100644 (file)
@@ -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 {
index bf9ebc25fc795a9775dad65ad40c3c349ee7a8ef..5a714333c16e69bf8c872795752a934c2ca6b9f5 100644 (file)
@@ -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