linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 3/5] libxfs: add realtime extent reservation and usage tracking to transactions
Date: Wed, 25 Nov 2020 12:38:14 -0800	[thread overview]
Message-ID: <160633669427.634603.6917592828334064504.stgit@magnolia> (raw)
In-Reply-To: <160633667604.634603.7657982642827987317.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

The libxfs resync added to the deferred ops code the ability to capture
the unfinished deferred ops and transaction reservation for later replay
during log recovery.  This nominally requires transactions to have the
ability to track rt extent reservations and usage, so port that missing
piece from the kernel now to avoid leaving logic bombs in case anyone
ever /does/ start messing with realtime.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libxfs/trans.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)


diff --git a/libxfs/trans.c b/libxfs/trans.c
index 83247582d61e..bc4af26c09f6 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -230,6 +230,7 @@ xfs_trans_reserve(
 			error = -ENOSPC;
 			goto undo_blocks;
 		}
+		tp->t_rtx_res += rtextents;
 	}
 
 	return 0;
@@ -765,6 +766,19 @@ _("Transaction block reservation exceeded! %u > %u\n"),
 		tp->t_ifree_delta += delta;
 		break;
 	case XFS_TRANS_SB_FREXTENTS:
+		/*
+		 * Track the number of rt extents allocated in the transaction.
+		 * Make sure it does not exceed the number reserved.
+		 */
+		if (delta < 0) {
+			tp->t_rtx_res_used += (uint)-delta;
+			if (tp->t_rtx_res_used > tp->t_rtx_res) {
+				fprintf(stderr,
+_("Transaction rt block reservation exceeded! %u > %u\n"),
+					tp->t_rtx_res_used, tp->t_rtx_res);
+				ASSERT(0);
+			}
+		}
 		tp->t_frextents_delta += delta;
 		break;
 	default:


  parent reply	other threads:[~2020-11-25 20:39 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-25 20:37 [PATCH v3 0/5] xfsprogs: fixes for 5.10-rc1 Darrick J. Wong
2020-11-25 20:38 ` [PATCH 1/5] libxfs-apply: don't add duplicate headers Darrick J. Wong
2020-11-25 21:12   ` Eric Sandeen
2020-11-30 17:13     ` Darrick J. Wong
2020-11-30 17:16       ` Eric Sandeen
2020-12-04 17:16   ` Eric Sandeen
2020-11-25 20:38 ` [PATCH 2/5] libxfs: fix weird comment Darrick J. Wong
2020-11-25 20:53   ` Eric Sandeen
2020-12-01 10:17   ` Christoph Hellwig
2020-11-25 20:38 ` Darrick J. Wong [this message]
2020-12-01 10:18   ` [PATCH 3/5] libxfs: add realtime extent reservation and usage tracking to transactions Christoph Hellwig
2020-11-25 20:38 ` [PATCH 4/5] debian: fix version in changelog Darrick J. Wong
2020-11-25 20:55   ` Eric Sandeen
2020-11-25 20:38 ` [PATCH 5/5] debian: add build dependency on libinih-dev Darrick J. Wong
2020-11-25 21:07   ` Eric Sandeen
2020-11-25 22:09   ` Dave Chinner

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=160633669427.634603.6917592828334064504.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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;
as well as URLs for NNTP newsgroup(s).