]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Increase XFS_DEFER_OPS_NR_INODES to 5
authorAllison Henderson <allison.henderson@oracle.com>
Mon, 29 Jul 2024 23:22:40 +0000 (16:22 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:01:00 +0000 (17:01 -0700)
Source kernel commit: 7560c937b4b5a3c671053be86ff00156a6fdd399

Renames that generate parent pointer updates can join up to 5
inodes locked in sorted order.  So we need to increase the
number of defer ops inodes and relock them in the same way.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Catherine Hoang <catherine.hoang@oracle.com>
[djwong: have one sorting function]
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/libxfs_priv.h
libxfs/xfs_defer.c
libxfs/xfs_defer.h

index 9ddba767b008151d919ffe5c9b113869af7b7d2a..aa0a3adb4614adebf5830dbcbe040c4e4c022626 100644 (file)
@@ -440,6 +440,8 @@ xfs_buf_readahead(
 })
 #define xfs_lock_two_inodes(ip0,mode0,ip1,mode1)       ((void) 0)
 #define xfs_assert_ilocked(ip, flags)                  ((void) 0)
+#define xfs_lock_inodes(i_tab, nr, mode)               ((void) 0)
+#define xfs_sort_inodes(i_tab, nr)                     ((void) 0)
 
 /* space allocation */
 #define XFS_EXTENT_BUSY_DISCARDED      0x01    /* undergoing a discard op. */
index 3a91bb3a582632f030746440a9d02e7275a5b067..7cf392e2ff698bd1363ab9bfa1adab653dc93ed8 100644 (file)
@@ -1086,7 +1086,11 @@ xfs_defer_ops_continue(
        ASSERT(!(tp->t_flags & XFS_TRANS_DIRTY));
 
        /* Lock the captured resources to the new transaction. */
-       if (dfc->dfc_held.dr_inos == 2)
+       if (dfc->dfc_held.dr_inos > 2) {
+               xfs_sort_inodes(dfc->dfc_held.dr_ip, dfc->dfc_held.dr_inos);
+               xfs_lock_inodes(dfc->dfc_held.dr_ip, dfc->dfc_held.dr_inos,
+                               XFS_ILOCK_EXCL);
+       } else if (dfc->dfc_held.dr_inos == 2)
                xfs_lock_two_inodes(dfc->dfc_held.dr_ip[0], XFS_ILOCK_EXCL,
                                    dfc->dfc_held.dr_ip[1], XFS_ILOCK_EXCL);
        else if (dfc->dfc_held.dr_inos == 1)
index 81cca60d70a3bc13de44864824e952c334e423df..8b338031e487c4b98d127340109e25db34994950 100644 (file)
@@ -77,7 +77,13 @@ extern const struct xfs_defer_op_type xfs_exchmaps_defer_type;
 /*
  * Deferred operation item relogging limits.
  */
-#define XFS_DEFER_OPS_NR_INODES        2       /* join up to two inodes */
+
+/*
+ * Rename w/ parent pointers can require up to 5 inodes with deferred ops to
+ * be joined to the transaction: src_dp, target_dp, src_ip, target_ip, and wip.
+ * These inodes are locked in sorted order by their inode numbers
+ */
+#define XFS_DEFER_OPS_NR_INODES        5
 #define XFS_DEFER_OPS_NR_BUFS  2       /* join up to two buffers */
 
 /* Resources that must be held across a transaction roll. */