diff mbox

[5/6] xfs: maintain a sequence count for inode fork manipulations

Message ID 20180712134910.30298-6-hch@lst.de (mailing list archive)
State Superseded
Headers show

Commit Message

Christoph Hellwig July 12, 2018, 1:49 p.m. UTC
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>
---
 fs/xfs/libxfs/xfs_iext_tree.c  | 4 ++++
 fs/xfs/libxfs/xfs_inode_fork.h | 1 +
 2 files changed, 5 insertions(+)

Comments

Darrick J. Wong July 13, 2018, 10:50 p.m. UTC | #1
On Thu, Jul 12, 2018 at 03:49:09PM +0200, Christoph Hellwig wrote:
> 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>

Looks ok,
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>

--D

> ---
>  fs/xfs/libxfs/xfs_iext_tree.c  | 4 ++++
>  fs/xfs/libxfs/xfs_inode_fork.h | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/fs/xfs/libxfs/xfs_iext_tree.c b/fs/xfs/libxfs/xfs_iext_tree.c
> index b80c63faace2..cce7e8024f46 100644
> --- a/fs/xfs/libxfs/xfs_iext_tree.c
> +++ b/fs/xfs/libxfs/xfs_iext_tree.c
> @@ -650,6 +650,7 @@ xfs_iext_insert(
>  		cur->leaf->recs[i] = cur->leaf->recs[i - 1];
>  	xfs_iext_set(cur_rec(cur), irec);
>  	ifp->if_bytes += sizeof(struct xfs_iext_rec);
> +	ifp->if_seq++;
>  
>  	trace_xfs_iext_insert(ip, cur, state, _RET_IP_);
>  
> @@ -869,6 +870,7 @@ xfs_iext_remove(
>  		leaf->recs[i] = leaf->recs[i + 1];
>  	xfs_iext_rec_clear(&leaf->recs[nr_entries]);
>  	ifp->if_bytes -= sizeof(struct xfs_iext_rec);
> +	ifp->if_seq++;
>  
>  	if (cur->pos == 0 && nr_entries > 0) {
>  		xfs_iext_update_node(ifp, offset, xfs_iext_leaf_key(leaf, 0), 1,
> @@ -983,6 +985,8 @@ xfs_iext_update_extent(
>  	trace_xfs_bmap_pre_update(ip, cur, state, _RET_IP_);
>  	xfs_iext_set(cur_rec(cur), new);
>  	trace_xfs_bmap_post_update(ip, cur, state, _RET_IP_);
> +
> +	ifp->if_seq++;
>  }
>  
>  /*
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h
> index 1492143371f3..f20b2468ca35 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.h
> +++ b/fs/xfs/libxfs/xfs_inode_fork.h
> @@ -14,6 +14,7 @@ struct xfs_dinode;
>   */
>  struct xfs_ifork {
>  	int			if_bytes;	/* bytes in if_u1 */
> +	unsigned int		if_seq;
>  	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 */
> -- 
> 2.18.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/xfs/libxfs/xfs_iext_tree.c b/fs/xfs/libxfs/xfs_iext_tree.c
index b80c63faace2..cce7e8024f46 100644
--- a/fs/xfs/libxfs/xfs_iext_tree.c
+++ b/fs/xfs/libxfs/xfs_iext_tree.c
@@ -650,6 +650,7 @@  xfs_iext_insert(
 		cur->leaf->recs[i] = cur->leaf->recs[i - 1];
 	xfs_iext_set(cur_rec(cur), irec);
 	ifp->if_bytes += sizeof(struct xfs_iext_rec);
+	ifp->if_seq++;
 
 	trace_xfs_iext_insert(ip, cur, state, _RET_IP_);
 
@@ -869,6 +870,7 @@  xfs_iext_remove(
 		leaf->recs[i] = leaf->recs[i + 1];
 	xfs_iext_rec_clear(&leaf->recs[nr_entries]);
 	ifp->if_bytes -= sizeof(struct xfs_iext_rec);
+	ifp->if_seq++;
 
 	if (cur->pos == 0 && nr_entries > 0) {
 		xfs_iext_update_node(ifp, offset, xfs_iext_leaf_key(leaf, 0), 1,
@@ -983,6 +985,8 @@  xfs_iext_update_extent(
 	trace_xfs_bmap_pre_update(ip, cur, state, _RET_IP_);
 	xfs_iext_set(cur_rec(cur), new);
 	trace_xfs_bmap_post_update(ip, cur, state, _RET_IP_);
+
+	ifp->if_seq++;
 }
 
 /*
diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h
index 1492143371f3..f20b2468ca35 100644
--- a/fs/xfs/libxfs/xfs_inode_fork.h
+++ b/fs/xfs/libxfs/xfs_inode_fork.h
@@ -14,6 +14,7 @@  struct xfs_dinode;
  */
 struct xfs_ifork {
 	int			if_bytes;	/* bytes in if_u1 */
+	unsigned int		if_seq;
 	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 */