public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 1/8] xfs: add a xfs_iext_update_extent helper
Date: Tue, 29 Aug 2017 11:09:28 -0700	[thread overview]
Message-ID: <20170829180928.GV4757@magnolia> (raw)
In-Reply-To: <20170829174835.2218-2-hch@lst.de>

On Tue, Aug 29, 2017 at 07:48:28PM +0200, Christoph Hellwig wrote:
> This helper is used to update an extent record based on the extent index,
> and can be used to provide a level of abstractions between callers that
> want to modify in-core extent records and the details of the extent list
> implementation.
> 
> Also switch all users of the xfs_bmbt_set_all(xfs_iext_get_ext(...))
> pattern to this new helper.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>

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

> ---
>  fs/xfs/libxfs/xfs_bmap.c       | 12 ++++++------
>  fs/xfs/libxfs/xfs_inode_fork.c | 12 ++++++++++++
>  fs/xfs/libxfs/xfs_inode_fork.h |  2 ++
>  3 files changed, 20 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index c09c16b1ad3b..502f531e4634 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -4918,7 +4918,7 @@ xfs_bmap_del_extent_delay(
>  		da_new = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip,
>  				got->br_blockcount), da_old);
>  		got->br_startblock = nullstartblock((int)da_new);
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
>  		break;
>  	case BMAP_RIGHT_CONTIG:
> @@ -4930,7 +4930,7 @@ xfs_bmap_del_extent_delay(
>  		da_new = XFS_FILBLKS_MIN(xfs_bmap_worst_indlen(ip,
>  				got->br_blockcount), da_old);
>  		got->br_startblock = nullstartblock((int)da_new);
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
>  		break;
>  	case 0:
> @@ -4956,7 +4956,7 @@ xfs_bmap_del_extent_delay(
>  						       del->br_blockcount);
>  
>  		got->br_startblock = nullstartblock((int)got_indlen);
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, 0, _THIS_IP_);
>  
>  		new.br_startoff = del_endoff;
> @@ -5026,7 +5026,7 @@ xfs_bmap_del_extent_cow(
>  		got->br_startoff = del_endoff;
>  		got->br_blockcount -= del->br_blockcount;
>  		got->br_startblock = del->br_startblock + del->br_blockcount;
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
>  		break;
>  	case BMAP_RIGHT_CONTIG:
> @@ -5035,7 +5035,7 @@ xfs_bmap_del_extent_cow(
>  		 */
>  		trace_xfs_bmap_pre_update(ip, *idx, state, _THIS_IP_);
>  		got->br_blockcount -= del->br_blockcount;
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
>  		break;
>  	case 0:
> @@ -5044,7 +5044,7 @@ xfs_bmap_del_extent_cow(
>  		 */
>  		trace_xfs_bmap_pre_update(ip, *idx, state, _THIS_IP_);
>  		got->br_blockcount = del->br_startoff - got->br_startoff;
> -		xfs_bmbt_set_all(xfs_iext_get_ext(ifp, *idx), got);
> +		xfs_iext_update_extent(ifp, *idx, got);
>  		trace_xfs_bmap_post_update(ip, *idx, state, _THIS_IP_);
>  
>  		new.br_startoff = del_endoff;
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
> index 0e80f34fe97c..fb310d08dc82 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.c
> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
> @@ -2023,3 +2023,15 @@ xfs_iext_get_extent(
>  	xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), gotp);
>  	return true;
>  }
> +
> +void
> +xfs_iext_update_extent(
> +	struct xfs_ifork	*ifp,
> +	xfs_extnum_t		idx,
> +	struct xfs_bmbt_irec	*gotp)
> +{
> +	ASSERT(idx >= 0);
> +	ASSERT(idx < xfs_iext_count(ifp));
> +
> +	xfs_bmbt_set_all(xfs_iext_get_ext(ifp, idx), gotp);
> +}
> diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h
> index 7fb8365326d1..11af705219f6 100644
> --- a/fs/xfs/libxfs/xfs_inode_fork.h
> +++ b/fs/xfs/libxfs/xfs_inode_fork.h
> @@ -187,6 +187,8 @@ bool		xfs_iext_lookup_extent(struct xfs_inode *ip,
>  			xfs_extnum_t *idxp, struct xfs_bmbt_irec *gotp);
>  bool		xfs_iext_get_extent(struct xfs_ifork *ifp, xfs_extnum_t idx,
>  			struct xfs_bmbt_irec *gotp);
> +void		xfs_iext_update_extent(struct xfs_ifork *ifp, xfs_extnum_t idx,
> +			struct xfs_bmbt_irec *gotp);
>  
>  extern struct kmem_zone	*xfs_ifork_zone;
>  
> -- 
> 2.11.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

  reply	other threads:[~2017-08-29 18:09 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-29 17:48 a few extent lookup cleanups Christoph Hellwig
2017-08-29 17:48 ` [PATCH 1/8] xfs: add a xfs_iext_update_extent helper Christoph Hellwig
2017-08-29 18:09   ` Darrick J. Wong [this message]
2017-08-29 17:48 ` [PATCH 2/8] xfs: switch xfs_bmap_local_to_extents to use xfs_iext_insert Christoph Hellwig
2017-08-29 18:13   ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 3/8] xfs: use xfs_iext_get_extent in xfs_bmap_first_unused Christoph Hellwig
2017-08-29 18:41   ` Darrick J. Wong
2017-09-01 20:06     ` Christoph Hellwig
2017-09-01 20:08       ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 4/8] xfs: move some code around inside xfs_bmap_shift_extents Christoph Hellwig
2017-08-29 19:35   ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 5/8] xfs: use xfs_iext_*_extent helpers in xfs_bmap_shift_extents Christoph Hellwig
2017-08-30  0:05   ` Darrick J. Wong
2017-08-30 23:03     ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 6/8] xfs: use xfs_iext_*_extent helpers in xfs_bmap_split_extent_at Christoph Hellwig
2017-08-29 18:42   ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 7/8] xfs: rewrite xfs_bmap_count_leaves using xfs_iext_get_extent Christoph Hellwig
2017-08-29 18:43   ` Darrick J. Wong
2017-08-29 17:48 ` [PATCH 8/8] xfs: replace xfs_qm_get_rtblks with a direct call to xfs_bmap_count_leaves Christoph Hellwig
2017-08-29 18:44   ` Darrick J. Wong
2017-08-30 23:10 ` [PATCH 9/8] xfs: simplify the rmap code in xfs_bmse_merge Darrick J. Wong
2017-08-31 13:31   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170829180928.GV4757@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox