@@ -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 {
@@ -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