xfs
[Top] [All Lists]

[PATCH 15/15] xfs: Make xfs_trans_mod_sb() aware of negative deltas

To: xfs@xxxxxxxxxxx
Subject: [PATCH 15/15] xfs: Make xfs_trans_mod_sb() aware of negative deltas
From: Jeff Liu <jeff.liu@xxxxxxxxxx>
Date: Fri, 16 Nov 2012 14:47:07 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2
For FS shrink, the FS_DBLOCKS will be reduced, and maybe the AG count will be
decreased as well if there have empty AGs beyond the new FS size.
This patch is trying to make xfs_trans_mod_sb() aware of those possible negative
delta values for shrinkfs only.

Signed-off-by: Jie Liu <jeff.liu@xxxxxxxxxx>
---
 fs/xfs/xfs_trans.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c
index d7346da..6ae2627 100644
--- a/fs/xfs/xfs_trans.c
+++ b/fs/xfs/xfs_trans.c
@@ -864,7 +864,7 @@ xfs_trans_mod_sb(
                 * transaction.  Make sure it does not exceed the
                 * number reserved.
                 */
-               if (delta < 0) {
+               if (delta < 0 && tp->t_type != XFS_TRANS_SHRINKFS) {
                        tp->t_blk_res_used += (uint)-delta;
                        ASSERT(tp->t_blk_res_used <= tp->t_blk_res);
                }
@@ -905,11 +905,17 @@ xfs_trans_mod_sb(
                tp->t_res_frextents_delta += delta;
                break;
        case XFS_TRANS_SB_DBLOCKS:
-               ASSERT(delta > 0);
+               if (tp->t_type != XFS_TRANS_SHRINKFS)
+                       ASSERT(delta > 0);
+               else
+                       ASSERT(delta < 0);
                tp->t_dblocks_delta += delta;
                break;
        case XFS_TRANS_SB_AGCOUNT:
-               ASSERT(delta > 0);
+               if (tp->t_type != XFS_TRANS_SHRINKFS)
+                       ASSERT(delta > 0);
+               else
+                       ASSERT(delta < 0);
                tp->t_agcount_delta += delta;
                break;
        case XFS_TRANS_SB_IMAXPCT:
-- 
1.7.9.5

<Prev in Thread] Current Thread [Next in Thread>
  • [PATCH 15/15] xfs: Make xfs_trans_mod_sb() aware of negative deltas, Jeff Liu <=