@@ -1116,6 +1116,7 @@ xfs_rtfree_blocks(
{
struct xfs_mount *mp = tp->t_mountp;
xfs_extlen_t mod;
+ int error;
ASSERT(rtlen <= XFS_MAX_BMBT_EXTLEN);
@@ -1131,8 +1132,16 @@ xfs_rtfree_blocks(
return -EIO;
}
- return xfs_rtfree_extent(tp, rtg, xfs_rtb_to_rtx(mp, rtbno),
+ error = xfs_rtfree_extent(tp, rtg, xfs_rtb_to_rtx(mp, rtbno),
xfs_extlen_to_rtxlen(mp, rtlen));
+ if (error)
+ return error;
+
+ if (xfs_has_rtgroups(mp))
+ xfs_extent_busy_insert(tp, rtg_group(rtg),
+ xfs_rtb_to_rgbno(mp, rtbno), rtlen, 0);
+
+ return 0;
}
/* Find all the free records within a given range. */
@@ -155,6 +155,19 @@ xfs_rtbno_is_group_start(
return (rtbno & mp->m_groups[XG_TYPE_RTG].blkmask) == 0;
}
+/* Convert an rtgroups rt extent number into an rgbno. */
+static inline xfs_rgblock_t
+xfs_rtx_to_rgbno(
+ struct xfs_rtgroup *rtg,
+ xfs_rtxnum_t rtx)
+{
+ struct xfs_mount *mp = rtg_mount(rtg);
+
+ if (likely(mp->m_rtxblklog >= 0))
+ return rtx << mp->m_rtxblklog;
+ return rtx * mp->m_sb.sb_rextsize;
+}
+
static inline xfs_daddr_t
xfs_rtb_to_daddr(
struct xfs_mount *mp,