public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Jeff Liu <jeff.liu@oracle.com>
To: xfs@oss.sgi.com
Subject: [PATCH 15/15] xfs: Make xfs_trans_mod_sb() aware of negative deltas
Date: Fri, 16 Nov 2012 14:47:07 +0800	[thread overview]
Message-ID: <50A5E16B.50209@oracle.com> (raw)

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@oracle.com>
---
 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

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

                 reply	other threads:[~2012-11-16  6:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50A5E16B.50209@oracle.com \
    --to=jeff.liu@oracle.com \
    --cc=xfs@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox