]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: maintain a sequence count for inode fork manipulations
authorChristoph Hellwig <hch@lst.de>
Fri, 5 Oct 2018 02:36:11 +0000 (21:36 -0500)
committerEric Sandeen <sandeen@redhat.com>
Fri, 5 Oct 2018 02:36:11 +0000 (21:36 -0500)
Source kernel commit: 745b3f76d1c889d738a1c4537a3c491bc1ecac4d

Add a simple 32-bit unsigned integer as the sequence count for
modifications to the extent list in the inode fork.  This will be
used to optimize away extent list lookups in the writeback code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_iext_tree.c
libxfs/xfs_inode_fork.h

index cf137db13f6a1f84f5d21652b4bc94d484464271..be662077c92525621ab8c54509a4b4710eccae03 100644 (file)
@@ -624,6 +624,8 @@ xfs_iext_insert(
        struct xfs_iext_leaf    *new = NULL;
        int                     nr_entries, i;
 
+       ifp->if_seq++;
+
        if (ifp->if_height == 0)
                xfs_iext_alloc_root(ifp, cur);
        else if (ifp->if_height == 1)
@@ -864,6 +866,8 @@ xfs_iext_remove(
        ASSERT(ifp->if_u1.if_root != NULL);
        ASSERT(xfs_iext_valid(ifp, cur));
 
+       ifp->if_seq++;
+
        nr_entries = xfs_iext_leaf_nr_entries(ifp, leaf, cur->pos) - 1;
        for (i = cur->pos; i < nr_entries; i++)
                leaf->recs[i] = leaf->recs[i + 1];
@@ -970,6 +974,8 @@ xfs_iext_update_extent(
 {
        struct xfs_ifork        *ifp = xfs_iext_state_to_fork(ip, state);
 
+       ifp->if_seq++;
+
        if (cur->pos == 0) {
                struct xfs_bmbt_irec    old;
 
index 1492143371f323a5ab54ac063ba5d217ad3c0d46..60361d2d74a182808333aa65be8c05fb9f817bb5 100644 (file)
@@ -14,6 +14,7 @@ struct xfs_dinode;
  */
 struct xfs_ifork {
        int                     if_bytes;       /* bytes in if_u1 */
+       unsigned int            if_seq;         /* cow fork mod counter */
        struct xfs_btree_block  *if_broot;      /* file's incore btree root */
        short                   if_broot_bytes; /* bytes allocated for root */
        unsigned char           if_flags;       /* per-fork flags */