[RFCv2,9/9] xfs: add extra log count for transactions that defer agfl frees
diff mbox

Message ID 20180124184418.40403-10-bfoster@redhat.com
State New
Headers show

Commit Message

Brian Foster Jan. 24, 2018, 6:44 p.m. UTC
Now that AGFL frees are deferred from particular contexts, the
associated transactions may require an increased number of
transaction rolls during deferred operation processing. Update the
log counts to prevent these additional rolls from blocking on
reservation regrant.

XXX: This patch is currently a no-op as XFS_AGFL_LOG_COUNT is set to
zero. Initially it was 1, but testing has shown a couple issues:

- The increase in number of regrants due to deferred AGFL block frees
appears to be minimal on the workloads examined so far.
- Increasing the logcount of certain larger transactions (e.g.,
tr_rename and some of the other directory ops) can increase the max
transaction reservation and have side effects like increasing the
minimum required log size at mkfs time.

Based on the above and the reasoning that deferred AGFL block frees
are a subset of all AGFL fixup operations (only frees), which in
turn are a subset of allocations (typically those that involve btree
shape changes), I think that it's probably overkill to increase
the logcount of any existing transactions at the moment. That
doesn't preclude from doing so in the future, of course.

I'm including this patch for reference and discussion purposes for
the RFC. I'm open to running more/different tests and/or considering
subsets of transactions, though I would prefer any change be backed
by a test that demonstrates the cost of deferring AGFL frees and
benefit of increasing the logcount of the associated transaction(s)
and workload. I've simply not been able to do that with enough
clarity to justify a change so far.

Not-Signed-off-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/libxfs/xfs_trans_resv.h | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Patch
diff mbox

diff --git a/fs/xfs/libxfs/xfs_trans_resv.h b/fs/xfs/libxfs/xfs_trans_resv.h
index b7e5357d060a..05fdcef07216 100644
--- a/fs/xfs/libxfs/xfs_trans_resv.h
+++ b/fs/xfs/libxfs/xfs_trans_resv.h
@@ -82,20 +82,23 @@  struct xfs_trans_resv {
 	 XFS_DAENTER_BMAPS(mp, XFS_DATA_FORK) + 1)
 
 /*
- * Various log count values.
+ * Various log count values. The AGFL count is a sub-component that covers
+ * additional tx rolls due to AGFL fixups (for transactions that defer AGFL
+ * block frees).
  */
+#define	XFS_AGFL_LOG_COUNT		0 /* for agfl fixups */
 #define	XFS_DEFAULT_LOG_COUNT		1
 #define	XFS_DEFAULT_PERM_LOG_COUNT	2
 #define	XFS_ITRUNCATE_LOG_COUNT		2
 #define	XFS_ITRUNCATE_LOG_COUNT_REFLINK	8
-#define XFS_INACTIVE_LOG_COUNT		2
-#define	XFS_CREATE_LOG_COUNT		2
+#define	XFS_INACTIVE_LOG_COUNT		(2 + XFS_AGFL_LOG_COUNT)
+#define	XFS_CREATE_LOG_COUNT		(2 + XFS_AGFL_LOG_COUNT)
 #define	XFS_CREATE_TMPFILE_LOG_COUNT	2
-#define	XFS_MKDIR_LOG_COUNT		3
-#define	XFS_SYMLINK_LOG_COUNT		3
-#define	XFS_REMOVE_LOG_COUNT		2
-#define	XFS_LINK_LOG_COUNT		2
-#define	XFS_RENAME_LOG_COUNT		2
+#define	XFS_MKDIR_LOG_COUNT		(3 + XFS_AGFL_LOG_COUNT)
+#define	XFS_SYMLINK_LOG_COUNT		(3 + XFS_AGFL_LOG_COUNT)
+#define	XFS_REMOVE_LOG_COUNT		(2 + XFS_AGFL_LOG_COUNT)
+#define	XFS_LINK_LOG_COUNT		(2 + XFS_AGFL_LOG_COUNT)
+#define	XFS_RENAME_LOG_COUNT		(2 + XFS_AGFL_LOG_COUNT)
 #define	XFS_WRITE_LOG_COUNT		2
 #define	XFS_WRITE_LOG_COUNT_REFLINK	8
 #define	XFS_ADDAFORK_LOG_COUNT		2