Skip to content

Commit bb7b1c9

Browse files
dgchinnerdchinner
authored andcommitted
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>
1 parent f5b8120 commit bb7b1c9

5 files changed

Lines changed: 21 additions & 11 deletions

File tree

fs/xfs/libxfs/xfs_shared.h

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,23 @@ void xfs_log_get_max_trans_res(struct xfs_mount *mp,
5454
/*
5555
* Values for t_flags.
5656
*/
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+
6474
/*
6575
* LOWMODE is used by the allocator to activate the lowspace algorithm - when
6676
* free space is running low the extent allocator may choose to allocate an

fs/xfs/xfs_bmap_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ xfs_trans_log_finish_bmap_update(
257257
* 1.) releases the BUI and frees the BUD
258258
* 2.) shuts down the filesystem
259259
*/
260-
tp->t_flags |= XFS_TRANS_DIRTY;
260+
tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
261261
set_bit(XFS_LI_DIRTY, &budp->bud_item.li_flags);
262262

263263
return error;

fs/xfs/xfs_extfree_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ xfs_trans_free_extent(
381381
* 1.) releases the EFI and frees the EFD
382382
* 2.) shuts down the filesystem
383383
*/
384-
tp->t_flags |= XFS_TRANS_DIRTY;
384+
tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
385385
set_bit(XFS_LI_DIRTY, &efdp->efd_item.li_flags);
386386

387387
next_extent = efdp->efd_next_extent;

fs/xfs/xfs_refcount_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ xfs_trans_log_finish_refcount_update(
262262
* 1.) releases the CUI and frees the CUD
263263
* 2.) shuts down the filesystem
264264
*/
265-
tp->t_flags |= XFS_TRANS_DIRTY;
265+
tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
266266
set_bit(XFS_LI_DIRTY, &cudp->cud_item.li_flags);
267267

268268
return error;

fs/xfs/xfs_rmap_item.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ xfs_trans_log_finish_rmap_update(
330330
* 1.) releases the RUI and frees the RUD
331331
* 2.) shuts down the filesystem
332332
*/
333-
tp->t_flags |= XFS_TRANS_DIRTY;
333+
tp->t_flags |= XFS_TRANS_DIRTY | XFS_TRANS_HAS_INTENT_DONE;
334334
set_bit(XFS_LI_DIRTY, &rudp->rud_item.li_flags);
335335

336336
return error;

0 commit comments

Comments
 (0)