@@ -157,6 +157,7 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp,
#define XFS_TRANS_SB_RBLOCKS 0x00000800
#define XFS_TRANS_SB_REXTENTS 0x00001000
#define XFS_TRANS_SB_REXTSLOG 0x00002000
+#define XFS_TRANS_SB_AGBLOCKS 0x00004000
/*
* Here we centralize the specification of XFS meta-data buffer reference count
@@ -433,6 +433,9 @@ xfs_trans_mod_sb(
case XFS_TRANS_SB_DBLOCKS:
tp->t_dblocks_delta += delta;
break;
+ case XFS_TRANS_SB_AGBLOCKS:
+ tp->t_agblocks_delta += delta;
+ break;
case XFS_TRANS_SB_AGCOUNT:
ASSERT(delta > 0);
tp->t_agcount_delta += delta;
@@ -526,6 +529,16 @@ xfs_trans_apply_sb_deltas(
be64_add_cpu(&sbp->sb_dblocks, tp->t_dblocks_delta);
whole = 1;
}
+ if (tp->t_agblocks_delta) {
+ xfs_agblock_t agblocks;
+
+ agblocks = be32_to_cpu(sbp->sb_agblocks);
+ agblocks += tp->t_agblocks_delta;
+
+ sbp->sb_agblocks = cpu_to_be32(agblocks);
+ sbp->sb_agblklog = ilog2(roundup_pow_of_two(agblocks));
+ whole = 1;
+ }
if (tp->t_agcount_delta) {
be32_add_cpu(&sbp->sb_agcount, tp->t_agcount_delta);
whole = 1;
@@ -657,6 +670,8 @@ xfs_trans_unreserve_and_mod_sb(
* incore reservations.
*/
mp->m_sb.sb_dblocks += tp->t_dblocks_delta;
+ mp->m_sb.sb_agblocks += tp->t_agblocks_delta;
+ mp->m_sb.sb_agblklog = ilog2(roundup_pow_of_two(mp->m_sb.sb_agblocks));
mp->m_sb.sb_agcount += tp->t_agcount_delta;
mp->m_sb.sb_imax_pct += tp->t_imaxpct_delta;
mp->m_sb.sb_rextsize += tp->t_rextsize_delta;
@@ -141,6 +141,7 @@ typedef struct xfs_trans {
int64_t t_frextents_delta;/* superblock freextents chg*/
int64_t t_res_frextents_delta; /* on-disk only chg */
int64_t t_dblocks_delta;/* superblock dblocks change */
+ int64_t t_agblocks_delta;/* superblock agblocks change */
int64_t t_agcount_delta;/* superblock agcount change */
int64_t t_imaxpct_delta;/* superblock imaxpct change */
int64_t t_rextsize_delta;/* superblock rextsize chg */
Support transactional changes to superblock agblocks and related fields. Signed-off-by: Brian Foster <bfoster@redhat.com> --- fs/xfs/libxfs/xfs_shared.h | 1 + fs/xfs/xfs_trans.c | 15 +++++++++++++++ fs/xfs/xfs_trans.h | 1 + 3 files changed, 17 insertions(+)