Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: tag transactions that contain intent done items

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>

authored by

Dave Chinner and committed by
Dave Chinner
bb7b1c9c f5b81200

+21 -11
+17 -7
fs/xfs/libxfs/xfs_shared.h
··· 54 54 /* 55 55 * Values for t_flags. 56 56 */ 57 - #define XFS_TRANS_DIRTY 0x01 /* something needs to be logged */ 58 - #define XFS_TRANS_SB_DIRTY 0x02 /* superblock is modified */ 59 - #define XFS_TRANS_PERM_LOG_RES 0x04 /* xact took a permanent log res */ 60 - #define XFS_TRANS_SYNC 0x08 /* make commit synchronous */ 61 - #define XFS_TRANS_RESERVE 0x20 /* OK to use reserved data blocks */ 62 - #define XFS_TRANS_NO_WRITECOUNT 0x40 /* do not elevate SB writecount */ 63 - #define XFS_TRANS_RES_FDBLKS 0x80 /* reserve newly freed blocks */ 57 + /* Transaction needs to be logged */ 58 + #define XFS_TRANS_DIRTY (1u << 0) 59 + /* Superblock is dirty and needs to be logged */ 60 + #define XFS_TRANS_SB_DIRTY (1u << 1) 61 + /* Transaction took a permanent log reservation */ 62 + #define XFS_TRANS_PERM_LOG_RES (1u << 2) 63 + /* Synchronous transaction commit needed */ 64 + #define XFS_TRANS_SYNC (1u << 3) 65 + /* Transaction can use reserve block pool */ 66 + #define XFS_TRANS_RESERVE (1u << 4) 67 + /* Transaction should avoid VFS level superblock write accounting */ 68 + #define XFS_TRANS_NO_WRITECOUNT (1u << 5) 69 + /* Transaction has freed blocks returned to it's reservation */ 70 + #define XFS_TRANS_RES_FDBLKS (1u << 6) 71 + /* Transaction contains an intent done log item */ 72 + #define XFS_TRANS_HAS_INTENT_DONE (1u << 7) 73 + 64 74 /* 65 75 * LOWMODE is used by the allocator to activate the lowspace algorithm - when 66 76 * free space is running low the extent allocator may choose to allocate an
+1 -1
fs/xfs/xfs_bmap_item.c
··· 257 257 * 1.) releases the BUI and frees the BUD 258 258 * 2.) shuts down the filesystem 259 259 */ 260 - tp->t_flags |= XFS_TRANS_DIRTY; 260 + tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE; 261 261 set_bit(XFS_LI_DIRTY, &budp->bud_item.li_flags); 262 262 263 263 return error;
+1 -1
fs/xfs/xfs_extfree_item.c
··· 381 381 * 1.) releases the EFI and frees the EFD 382 382 * 2.) shuts down the filesystem 383 383 */ 384 - tp->t_flags |= XFS_TRANS_DIRTY; 384 + tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE; 385 385 set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags); 386 386 387 387 next_extent = efdp->efd_next_extent;
+1 -1
fs/xfs/xfs_refcount_item.c
··· 262 262 * 1.) releases the CUI and frees the CUD 263 263 * 2.) shuts down the filesystem 264 264 */ 265 - tp->t_flags |= XFS_TRANS_DIRTY; 265 + tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE; 266 266 set_bit(XFS_LI_DIRTY, &cudp->cud_item.li_flags); 267 267 268 268 return error;
+1 -1
fs/xfs/xfs_rmap_item.c
··· 330 330 * 1.) releases the RUI and frees the RUD 331 331 * 2.) shuts down the filesystem 332 332 */ 333 - tp->t_flags |= XFS_TRANS_DIRTY; 333 + tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE; 334 334 set_bit(XFS_LI_DIRTY, &rudp->rud_item.li_flags); 335 335 336 336 return error;