xfs: calculate xfs_qm_write_sb_changes() space log reservation at mount time
authorJeff Liu <jeff.liu@oracle.com>
Mon, 28 Jan 2013 13:26:34 +0000 (21:26 +0800)
committerBen Myers <bpm@sgi.com>
Fri, 1 Feb 2013 20:42:32 +0000 (14:42 -0600)
For the transaction that write the incore superblock changes of quota flags
to disk, it would reserve the same log space to clear/reset quota flags
transaction, hence we can use XFS_TRANS_SBCHANGE_LOG_RES() for it as well.

Signed-off-by: Jie Liu <jeff.liu@oracle.com>
CC: Dave Chinner <david@fromorbit.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_qm.c

index 60eff4763156f9a83a5b5ab49eaca1c1a2df63a8..e5b5cf973781b5bba4188144dd9b3bf4a69f022c 100644 (file)
@@ -1584,10 +1584,9 @@ xfs_qm_write_sb_changes(
        int             error;
 
        tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE);
-       if ((error = xfs_trans_reserve(tp, 0,
-                                     mp->m_sb.sb_sectsize + 128, 0,
-                                     0,
-                                     XFS_DEFAULT_LOG_COUNT))) {
+       error = xfs_trans_reserve(tp, 0, XFS_QM_SBCHANGE_LOG_RES(mp),
+                                 0, 0, XFS_DEFAULT_LOG_COUNT);
+       if (error) {
                xfs_trans_cancel(tp, 0);
                return error;
        }