All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Foster <bfoster@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 05/14] xfs: use new extent lookup helpers in __xfs_bunmapi
Date: Thu, 17 Nov 2016 13:12:10 -0500	[thread overview]
Message-ID: <20161117181210.GG49658@bfoster.bfoster> (raw)
In-Reply-To: <1479143565-30615-6-git-send-email-hch@lst.de>

On Mon, Nov 14, 2016 at 06:12:36PM +0100, Christoph Hellwig wrote:
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/libxfs/xfs_bmap.c | 39 ++++++++++++---------------------------
>  1 file changed, 12 insertions(+), 27 deletions(-)
> 
> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
> index 9a8621d..18de89c 100644
> --- a/fs/xfs/libxfs/xfs_bmap.c
> +++ b/fs/xfs/libxfs/xfs_bmap.c
> @@ -5433,8 +5433,6 @@ __xfs_bunmapi(
>  {
>  	xfs_btree_cur_t		*cur;		/* bmap btree cursor */
>  	xfs_bmbt_irec_t		del;		/* extent being deleted */
> -	int			eof;		/* is deleting at eof */
> -	xfs_bmbt_rec_host_t	*ep;		/* extent record pointer */
>  	int			error;		/* error return value */
>  	xfs_extnum_t		extno;		/* extent number in list */
>  	xfs_bmbt_irec_t		got;		/* current extent record */
> @@ -5444,7 +5442,6 @@ __xfs_bunmapi(
>  	int			logflags;	/* transaction logging flags */
>  	xfs_extlen_t		mod;		/* rt extent offset */
>  	xfs_mount_t		*mp;		/* mount structure */
> -	xfs_bmbt_irec_t		prev;		/* previous extent record */
>  	xfs_fileoff_t		start;		/* first file offset deleted */
>  	int			tmp_logflags;	/* partial logging flags */
>  	int			wasdel;		/* was a delayed alloc extent */
> @@ -5483,18 +5480,17 @@ __xfs_bunmapi(
>  	isrt = (whichfork == XFS_DATA_FORK) && XFS_IS_REALTIME_INODE(ip);
>  	start = bno;
>  	bno = start + len - 1;
> -	ep = xfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, &got,
> -		&prev);
>  
>  	/*
>  	 * Check to see if the given block number is past the end of the
>  	 * file, back up to the last block if so...
>  	 */
> -	if (eof) {
> -		ep = xfs_iext_get_ext(ifp, --lastx);
> -		xfs_bmbt_get_all(ep, &got);
> +	if (!xfs_iext_lookup_extent(ip, ifp, bno, &lastx, &got)) {
> +		ASSERT(lastx > 0);
> +		xfs_iext_get_extent(ifp, --lastx, &got);
>  		bno = got.br_startoff + got.br_blockcount - 1;
>  	}
> +
>  	logflags = 0;
>  	if (ifp->if_flags & XFS_IFBROOT) {
>  		ASSERT(XFS_IFORK_FORMAT(ip, whichfork) == XFS_DINODE_FMT_BTREE);
> @@ -5525,8 +5521,7 @@ __xfs_bunmapi(
>  		if (got.br_startoff > bno) {
>  			if (--lastx < 0)
>  				break;
> -			ep = xfs_iext_get_ext(ifp, lastx);
> -			xfs_bmbt_get_all(ep, &got);
> +			xfs_iext_get_extent(ifp, lastx, &got);
>  		}
>  		/*
>  		 * Is the last block of this extent before the range
> @@ -5540,7 +5535,6 @@ __xfs_bunmapi(
>  		 * Then deal with the (possibly delayed) allocated space
>  		 * we found.
>  		 */
> -		ASSERT(ep != NULL);
>  		del = got;
>  		wasdel = isnullstartblock(del.br_startblock);
>  		if (got.br_startoff < start) {
> @@ -5621,15 +5615,11 @@ __xfs_bunmapi(
>  				 */
>  				ASSERT(bno >= del.br_blockcount);
>  				bno -= del.br_blockcount;
> -				if (got.br_startoff > bno) {
> -					if (--lastx >= 0) {
> -						ep = xfs_iext_get_ext(ifp,
> -								      lastx);
> -						xfs_bmbt_get_all(ep, &got);
> -					}
> -				}
> +				if (got.br_startoff > bno && --lastx >= 0)
> +					xfs_iext_get_extent(ifp, lastx, &got);

Slightly tricky, but Ok.

>  				continue;
>  			} else if (del.br_state == XFS_EXT_UNWRITTEN) {
> +				xfs_bmbt_irec_t		prev;

struct xfs_bmbt_irec

Otherwise looks good:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  				/*
>  				 * This one is already unwritten.
>  				 * It must have a written left neighbor.
> @@ -5637,8 +5627,7 @@ __xfs_bunmapi(
>  				 * try again.
>  				 */
>  				ASSERT(lastx > 0);
> -				xfs_bmbt_get_all(xfs_iext_get_ext(ifp,
> -						lastx - 1), &prev);
> +				xfs_iext_get_extent(ifp, lastx - 1, &prev);
>  				ASSERT(prev.br_state == XFS_EXT_NORM);
>  				ASSERT(!isnullstartblock(prev.br_startblock));
>  				ASSERT(del.br_startblock ==
> @@ -5736,13 +5725,9 @@ __xfs_bunmapi(
>  		 */
>  		if (bno != (xfs_fileoff_t)-1 && bno >= start) {
>  			if (lastx >= 0) {
> -				ep = xfs_iext_get_ext(ifp, lastx);
> -				if (xfs_bmbt_get_startoff(ep) > bno) {
> -					if (--lastx >= 0)
> -						ep = xfs_iext_get_ext(ifp,
> -								      lastx);
> -				}
> -				xfs_bmbt_get_all(ep, &got);
> +				xfs_iext_get_extent(ifp, lastx, &got);
> +				if (got.br_startoff > bno && --lastx >= 0)
> +					xfs_iext_get_extent(ifp, lastx, &got);
>  			}
>  			extno++;
>  		}
> -- 
> 2.1.4
> 
> --
> 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:[~2016-11-17 18:12 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 17:12 new helpers to clean up extent tree lookups Christoph Hellwig
2016-11-14 17:12 ` [PATCH 01/14] xfs: new inode extent list lookup helpers Christoph Hellwig
2016-11-17 18:11   ` Brian Foster
2016-11-14 17:12 ` [PATCH 02/14] xfs: cleanup xfs_bmap_last_before Christoph Hellwig
2016-11-17 18:11   ` Brian Foster
2016-11-18  8:16     ` Christoph Hellwig
2016-11-14 17:12 ` [PATCH 03/14] xfs: use new extent lookup helpers in xfs_bmapi_read Christoph Hellwig
2016-11-17 18:11   ` Brian Foster
2016-11-14 17:12 ` [PATCH 04/14] xfs: use new extent lookup helpers in xfs_bmapi_write Christoph Hellwig
2016-11-17 18:12   ` Brian Foster
2016-11-14 17:12 ` [PATCH 05/14] xfs: use new extent lookup helpers in __xfs_bunmapi Christoph Hellwig
2016-11-17 18:12   ` Brian Foster [this message]
2016-11-14 17:12 ` [PATCH 06/14] xfs: remove prev argument to xfs_bmapi_reserve_delalloc Christoph Hellwig
2016-11-17 18:27   ` Brian Foster
2016-11-18  8:19     ` Christoph Hellwig
2016-11-18 13:19       ` Brian Foster
2016-11-14 17:12 ` [PATCH 07/14] xfs: use new extent lookup helpers xfs_file_iomap_begin_delay Christoph Hellwig
2016-11-17 18:33   ` Brian Foster
2016-11-18  8:20     ` Christoph Hellwig
2016-11-18 13:20       ` Brian Foster
2016-11-14 17:12 ` [PATCH 08/14] xfs: use new extent lookup helpers in __xfs_reflink_reserve_cow Christoph Hellwig
2016-11-17 19:07   ` Brian Foster
2016-11-14 17:12 ` [PATCH 09/14] xfs: cleanup xfs_reflink_find_cow_mapping Christoph Hellwig
2016-11-17 19:07   ` Brian Foster
2016-11-14 17:12 ` [PATCH 10/14] xfs: use new extent lookup helpers in xfs_reflink_trim_irec_to_next_cow Christoph Hellwig
2016-11-17 19:07   ` Brian Foster
2016-11-14 17:12 ` [PATCH 11/14] xfs: use new extent lookup helpers in xfs_reflink_cancel_cow_blocks Christoph Hellwig
2016-11-17 19:07   ` Brian Foster
2016-11-14 17:12 ` [PATCH 12/14] xfs: use new extent lookup helpers in xfs_reflink_end_cow Christoph Hellwig
2016-11-17 19:07   ` Brian Foster
2016-11-14 17:12 ` [PATCH 13/14] xfs: remove xfs_bmap_search_extents Christoph Hellwig
2016-11-17 19:12   ` Brian Foster
2016-11-14 17:12 ` [PATCH 14/14] xfs: remove NULLEXTNUM Christoph Hellwig
2016-11-17 19:12   ` Brian Foster
2016-11-19  0:21 ` new helpers to clean up extent tree lookups Eric Sandeen
2016-11-21 17:17   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2016-11-21 16:38 new helpers to clean up extent tree lookups V2 Christoph Hellwig
2016-11-21 16:38 ` [PATCH 05/14] xfs: use new extent lookup helpers in __xfs_bunmapi 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=20161117181210.GG49658@bfoster.bfoster \
    --to=bfoster@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.