aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2019-02-01 12:14:22 -0500
committerDarrick J. Wong <darrick.wong@oracle.com>2019-02-11 19:07:00 -0500
commit9f9bc034b84958523689347ee2bdd9c660008e5e (patch)
tree7651d81ce001e0ff119f1287c2eef9d8e8e13945 /fs/xfs/libxfs
parentd519da41e2b789f2cbd705cd8cec0bb92be4838d (diff)
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: Brian Foster <bfoster@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Diffstat (limited to 'fs/xfs/libxfs')
-rw-r--r--fs/xfs/libxfs/xfs_iext_tree.c13
-rw-r--r--fs/xfs/libxfs/xfs_inode_fork.h2
2 files changed, 7 insertions, 8 deletions
diff --git a/fs/xfs/libxfs/xfs_iext_tree.c b/fs/xfs/libxfs/xfs_iext_tree.c
index 771dd072015d..bc690f2409fa 100644
--- a/fs/xfs/libxfs/xfs_iext_tree.c
+++ b/fs/xfs/libxfs/xfs_iext_tree.c
@@ -614,16 +614,15 @@ xfs_iext_realloc_root(
614} 614}
615 615
616/* 616/*
617 * Increment the sequence counter if we are on a COW fork. This allows 617 * Increment the sequence counter on extent tree changes. If we are on a COW
618 * the writeback code to skip looking for a COW extent if the COW fork 618 * fork, this allows the writeback code to skip looking for a COW extent if the
619 * hasn't changed. We use WRITE_ONCE here to ensure the update to the 619 * COW fork hasn't changed. We use WRITE_ONCE here to ensure the update to the
620 * sequence counter is seen before the modifications to the extent 620 * sequence counter is seen before the modifications to the extent tree itself
621 * tree itself take effect. 621 * take effect.
622 */ 622 */
623static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp, int state) 623static inline void xfs_iext_inc_seq(struct xfs_ifork *ifp, int state)
624{ 624{
625 if (state & BMAP_COWFORK) 625 WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
626 WRITE_ONCE(ifp->if_seq, READ_ONCE(ifp->if_seq) + 1);
627} 626}
628 627
629void 628void
diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h
index 60361d2d74a1..00c62ce170d0 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.h
+++ b/fs/xfs/libxfs/xfs_inode_fork.h
@@ -14,7 +14,7 @@ struct xfs_dinode;
14 */ 14 */
15struct xfs_ifork { 15struct xfs_ifork {
16 int if_bytes; /* bytes in if_u1 */ 16 int if_bytes; /* bytes in if_u1 */
17 unsigned int if_seq; /* cow fork mod counter */ 17 unsigned int if_seq; /* fork mod counter */
18 struct xfs_btree_block *if_broot; /* file's incore btree root */ 18 struct xfs_btree_block *if_broot; /* file's incore btree root */
19 short if_broot_bytes; /* bytes allocated for root */ 19 short if_broot_bytes; /* bytes allocated for root */
20 unsigned char if_flags; /* per-fork flags */ 20 unsigned char if_flags; /* per-fork flags */