summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_trans.c
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2015-02-23 21:22:54 +1100
committerDave Chinner <david@fromorbit.com>2015-02-23 21:22:54 +1100
commitbab98bbe6e1e38bf2fa5018a195608553095f51b (patch)
tree7d22e47227132f29ad6f9d7e116d1e4eabfca04f /fs/xfs/xfs_trans.c
parent5681ca40064fdb3efe477a604d690ab0425708b3 (diff)
xfs: introduce xfs_mod_frextents
Add a new helper to modify the incore counter of free realtime extents. This matches the helpers used for inode and data block counters, and removes a significant users of the xfs_mod_incore_sb() interface. Based on a patch originally from Christoph Hellwig. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs/xfs_trans.c')
-rw-r--r--fs/xfs/xfs_trans.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index e99f5e552c64..4e4bc5aed6b6 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -235,8 +235,7 @@ xfs_trans_reserve(
* fail if the count would go below zero.
*/
if (rtextents > 0) {
- error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FREXTENTS,
- -((int64_t)rtextents), rsvd);
+ error = xfs_mod_frextents(tp->t_mountp, -((int64_t)rtextents));
if (error) {
error = -ENOSPC;
goto undo_log;
@@ -562,10 +561,10 @@ xfs_trans_unreserve_and_mod_sb(
}
/* apply remaining deltas */
- if (rtxdelta != 0) {
- msbp->msb_field = XFS_SBS_FREXTENTS;
- msbp->msb_delta = rtxdelta;
- msbp++;
+ if (rtxdelta) {
+ error = xfs_mod_frextents(mp, rtxdelta);
+ if (error)
+ goto out_undo_ifree;
}
if (tp->t_flags & XFS_TRANS_SB_DIRTY) {
@@ -618,12 +617,15 @@ xfs_trans_unreserve_and_mod_sb(
error = xfs_mod_incore_sb_batch(tp->t_mountp, msb,
(uint)(msbp - msb), rsvd);
if (error)
- goto out_undo_ifreecount;
+ goto out_undo_frextents;
}
return;
-out_undo_ifreecount:
+out_undo_frextents:
+ if (rtxdelta)
+ xfs_mod_frextents(mp, -rtxdelta);
+out_undo_ifree:
if (ifreedelta)
xfs_mod_ifree(mp, -ifreedelta);
out_undo_icount: