Commit 9f9bc034 authored by Brian Foster's avatar Brian Foster Committed by Darrick J. Wong

xfs: update fork seq counter on data fork changes

The sequence counter in the xfs_ifork structure is only updated on
COW forks. This is because the counter is currently only used to
optimize out repetitive COW fork checks at writeback time.

Tweak the extent code to update the seq counter regardless of the
fork type in preparation for using this counter on data forks as
well.
Signed-off-by: default avatarBrian Foster <bfoster@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarAllison Henderson <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent d519da41
...@@ -614,16 +614,15 @@ xfs_iext_realloc_root( ...@@ -614,16 +614,15 @@ xfs_iext_realloc_root(
} }
/* /*
* Increment the sequence counter if we are on a COW fork. This allows * Increment the sequence counter on extent tree changes. If we are on a COW
* the writeback code to skip looking for a COW extent if the COW fork * fork, this allows the writeback code to skip looking for a COW extent if the
* hasn't changed. We use WRITE_ONCE here to ensure the update to the * COW fork hasn't changed. We use WRITE_ONCE here to ensure the update to the
* sequence counter is seen before the modifications to the extent * sequence counter is seen before the modifications to the extent tree itself
* tree itself take effect. * take effect.
*/ */
static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp, int state) static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp, int state)
{ {
if (state & BMAP_COWFORK) WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
} }
void void
......
...@@ -14,7 +14,7 @@ struct xfs_dinode; ...@@ -14,7 +14,7 @@ struct xfs_dinode;
*/ */
struct xfs_ifork { struct xfs_ifork {
int if_bytes; /* bytes in if_u1 */ int if_bytes; /* bytes in if_u1 */
unsigned int if_seq; /* cow fork mod counter */ unsigned int if_seq; /* fork mod counter */
struct xfs_btree_block *if_broot; /* file's incore btree root */ struct xfs_btree_block *if_broot; /* file's incore btree root */
short if_broot_bytes; /* bytes allocated for root */ short if_broot_bytes; /* bytes allocated for root */
unsigned char if_flags; /* per-fork flags */ unsigned char if_flags; /* per-fork flags */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment