]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
xfs: tag transactions that contain intent done items
authorDave Chinner <dchinner@redhat.com>
Wed, 4 May 2022 01:46:21 +0000 (11:46 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 4 May 2022 01:46:21 +0000 (11:46 +1000)
Intent whiteouts will require extra work to be done during
transaction commit if the transaction contains an intent done item.

To determine if a transaction contains an intent done item, we want
to avoid having to walk all the items in the transaction to check if
they are intent done items. Hence when we add an intent done item to
a transaction, tag the transaction to indicate that it contains such
an item.

We don't tag the transaction when the defer ops is relogging an
intent to move it forward in the log. Whiteouts will never apply to
these cases, so we don't need to bother looking for them.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_shared.h
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c

index 25c4cab58851c18bb9fa7d71bbed63434b7ac091..c4381388c0c1a10f25c6f8bc722dba91ac459cd3 100644 (file)
@@ -54,13 +54,23 @@ void        xfs_log_get_max_trans_res(struct xfs_mount *mp,
 /*
  * Values for t_flags.
  */
-#define        XFS_TRANS_DIRTY         0x01    /* something needs to be logged */
-#define        XFS_TRANS_SB_DIRTY      0x02    /* superblock is modified */
-#define        XFS_TRANS_PERM_LOG_RES  0x04    /* xact took a permanent log res */
-#define        XFS_TRANS_SYNC          0x08    /* make commit synchronous */
-#define XFS_TRANS_RESERVE      0x20    /* OK to use reserved data blocks */
-#define XFS_TRANS_NO_WRITECOUNT 0x40   /* do not elevate SB writecount */
-#define XFS_TRANS_RES_FDBLKS   0x80    /* reserve newly freed blocks */
+/* Transaction needs to be logged */
+#define XFS_TRANS_DIRTY                        (1u << 0)
+/* Superblock is dirty and needs to be logged */
+#define XFS_TRANS_SB_DIRTY             (1u << 1)
+/* Transaction took a permanent log reservation */
+#define XFS_TRANS_PERM_LOG_RES         (1u << 2)
+/* Synchronous transaction commit needed */
+#define XFS_TRANS_SYNC                 (1u << 3)
+/* Transaction can use reserve block pool */
+#define XFS_TRANS_RESERVE              (1u << 4)
+/* Transaction should avoid VFS level superblock write accounting */
+#define XFS_TRANS_NO_WRITECOUNT                (1u << 5)
+/* Transaction has freed blocks returned to it's reservation */
+#define XFS_TRANS_RES_FDBLKS           (1u << 6)
+/* Transaction contains an intent done log item */
+#define XFS_TRANS_HAS_INTENT_DONE      (1u << 7)
+
 /*
  * LOWMODE is used by the allocator to activate the lowspace algorithm - when
  * free space is running low the extent allocator may choose to allocate an
index 0e0aae83308c9060658b2e1f64f313ff5695f7b8..3d1fa8edf28fa311a84ea324476ecacfe47d70bc 100644 (file)
@@ -257,7 +257,7 @@ xfs_trans_log_finish_bmap_update(
         * 1.) releases the BUI and frees the BUD
         * 2.) shuts down the filesystem
         */
-       tp->t_flags |= XFS_TRANS_DIRTY;
+       tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
        set_bit(XFS_LI_DIRTY, &budp->bud_item.li_flags);
 
        return error;
index 21a159f9d8c55b923bf984e7158be3df3457b628..96735f23d12dcdffd2f7162b4e97d5330f53ba23 100644 (file)
@@ -381,7 +381,7 @@ xfs_trans_free_extent(
         * 1.) releases the EFI and frees the EFD
         * 2.) shuts down the filesystem
         */
-       tp->t_flags |= XFS_TRANS_DIRTY;
+       tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
        set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
 
        next_extent = efdp->efd_next_extent;
index 71225d094e033268f45b65120fa5487afafdf5e9..b37a9d2ce652a802cdeaa98856f4c4ba4e599b5a 100644 (file)
@@ -262,7 +262,7 @@ xfs_trans_log_finish_refcount_update(
         * 1.) releases the CUI and frees the CUD
         * 2.) shuts down the filesystem
         */
-       tp->t_flags |= XFS_TRANS_DIRTY;
+       tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
        set_bit(XFS_LI_DIRTY, &cudp->cud_item.li_flags);
 
        return error;
index 6ecbc37e4b8d6bbc67e9b4ed1ccb2b1ff715f0f4..5221fd1e6f6f94ac5fbca450570f88fe30384326 100644 (file)
@@ -330,7 +330,7 @@ xfs_trans_log_finish_rmap_update(
         * 1.) releases the RUI and frees the RUD
         * 2.) shuts down the filesystem
         */
-       tp->t_flags |= XFS_TRANS_DIRTY;
+       tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
        set_bit(XFS_LI_DIRTY, &rudp->rud_item.li_flags);
 
        return error;