@@ -64,9 +64,11 @@ typedef struct xfs_trans {
unsigned int t_log_res; /* amt of log space resvd */
unsigned int t_log_count; /* count for perm log res */
unsigned int t_blk_res; /* # of blocks resvd */
+ unsigned int t_rtx_res;
xfs_fsblock_t t_firstblock; /* first block allocated */
struct xfs_mount *t_mountp; /* ptr to fs mount struct */
unsigned int t_blk_res_used; /* # of resvd blocks used */
+ unsigned int t_rtx_res_used;
unsigned int t_flags; /* misc flags */
long t_icount_delta; /* superblock icount change */
long t_ifree_delta; /* superblock ifree change */
@@ -230,6 +230,7 @@ xfs_trans_reserve(
error = -ENOSPC;
goto undo_blocks;
}
+ tp->t_rtx_res += rtextents;
}
return 0;
@@ -765,6 +766,19 @@ _("Transaction block reservation exceeded! %u > %u\n"),
tp->t_ifree_delta += delta;
break;
case XFS_TRANS_SB_FREXTENTS:
+ /*
+ * Track the number of rt extents allocated in the transaction.
+ * Make sure it does not exceed the number reserved.
+ */
+ if (delta < 0) {
+ tp->t_rtx_res_used += (uint)-delta;
+ if (tp->t_rtx_res_used > tp->t_rtx_res) {
+ fprintf(stderr,
+_("Transaction rt block reservation exceeded! %u > %u\n"),
+ tp->t_rtx_res_used, tp->t_rtx_res);
+ ASSERT(0);
+ }
+ }
tp->t_frextents_delta += delta;
break;
default: