linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: linux-xfs@vger.kernel.org
Subject: [PATCH 12/14] xfs: use new extent lookup helpers in xfs_reflink_end_cow
Date: Mon, 21 Nov 2016 17:38:54 +0100	[thread overview]
Message-ID: <1479746336-10986-13-git-send-email-hch@lst.de> (raw)
In-Reply-To: <1479746336-10986-1-git-send-email-hch@lst.de>

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Brian Foster <bfoster@redhat.com>
---
 fs/xfs/xfs_reflink.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index 4e07da3..56372be 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -614,13 +614,13 @@ xfs_reflink_end_cow(
 	xfs_off_t			count)
 {
 	struct xfs_ifork		*ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
-	struct xfs_bmbt_irec		got, prev, del;
+	struct xfs_bmbt_irec		got, del;
 	struct xfs_trans		*tp;
 	xfs_fileoff_t			offset_fsb;
 	xfs_fileoff_t			end_fsb;
 	xfs_fsblock_t			firstfsb;
 	struct xfs_defer_ops		dfops;
-	int				error, eof = 0;
+	int				error;
 	unsigned int			resblks;
 	xfs_filblks_t			rlen;
 	xfs_extnum_t			idx;
@@ -644,13 +644,11 @@ xfs_reflink_end_cow(
 	xfs_ilock(ip, XFS_ILOCK_EXCL);
 	xfs_trans_ijoin(tp, ip, 0);
 
-	xfs_bmap_search_extents(ip, end_fsb - 1, XFS_COW_FORK, &eof, &idx,
-			&got, &prev);
-
 	/* If there is a hole at end_fsb - 1 go to the previous extent */
-	if (eof || got.br_startoff > end_fsb) {
+	if (!xfs_iext_lookup_extent(ip, ifp, end_fsb - 1, &idx, &got) ||
+	    got.br_startoff > end_fsb) {
 		ASSERT(idx > 0);
-		xfs_bmbt_get_all(xfs_iext_get_ext(ifp, --idx), &got);
+		xfs_iext_get_extent(ifp, --idx, &got);
 	}
 
 	/* Walk backwards until we're out of the I/O range... */
@@ -698,11 +696,9 @@ xfs_reflink_end_cow(
 		error = xfs_defer_finish(&tp, &dfops, ip);
 		if (error)
 			goto out_defer;
-
 next_extent:
-		if (idx < 0)
+		if (!xfs_iext_get_extent(ifp, idx, &got))
 			break;
-		xfs_bmbt_get_all(xfs_iext_get_ext(ifp, idx), &got);
 	}
 
 	error = xfs_trans_commit(tp);
-- 
2.1.4


  parent reply	other threads:[~2016-11-21 16:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-21 16:38 new helpers to clean up extent tree lookups V2 Christoph Hellwig
2016-11-21 16:38 ` [PATCH 01/14] xfs: new inode extent list lookup helpers Christoph Hellwig
2016-11-21 16:38 ` [PATCH 02/14] xfs: cleanup xfs_bmap_last_before Christoph Hellwig
2016-11-21 17:19   ` Brian Foster
2016-11-21 16:38 ` [PATCH 03/14] xfs: use new extent lookup helpers in xfs_bmapi_read Christoph Hellwig
2016-11-21 16:38 ` [PATCH 04/14] xfs: use new extent lookup helpers in xfs_bmapi_write Christoph Hellwig
2016-11-21 17:19   ` Brian Foster
2016-11-21 16:38 ` [PATCH 05/14] xfs: use new extent lookup helpers in __xfs_bunmapi Christoph Hellwig
2016-11-21 16:38 ` [PATCH 06/14] xfs: remove prev argument to xfs_bmapi_reserve_delalloc Christoph Hellwig
2016-11-21 17:19   ` Brian Foster
2016-11-21 16:38 ` [PATCH 07/14] xfs: use new extent lookup helpers xfs_file_iomap_begin_delay Christoph Hellwig
2016-11-21 16:38 ` [PATCH 08/14] xfs: use new extent lookup helpers in __xfs_reflink_reserve_cow Christoph Hellwig
2016-11-21 16:38 ` [PATCH 09/14] xfs: cleanup xfs_reflink_find_cow_mapping Christoph Hellwig
2016-11-21 16:38 ` [PATCH 10/14] xfs: use new extent lookup helpers in xfs_reflink_trim_irec_to_next_cow Christoph Hellwig
2016-11-21 16:38 ` [PATCH 11/14] xfs: use new extent lookup helpers in xfs_reflink_cancel_cow_blocks Christoph Hellwig
2016-11-21 16:38 ` Christoph Hellwig [this message]
2016-11-21 16:38 ` [PATCH 13/14] xfs: remove xfs_bmap_search_extents Christoph Hellwig
2016-11-21 16:38 ` [PATCH 14/14] xfs: remove NULLEXTNUM Christoph Hellwig
2016-11-22 17:46 ` new helpers to clean up extent tree lookups V2 Darrick J. Wong
  -- strict thread matches above, loose matches on Subject: below --
2016-11-14 17:12 new helpers to clean up extent tree lookups Christoph Hellwig
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

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=1479746336-10986-13-git-send-email-hch@lst.de \
    --to=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;
as well as URLs for NNTP newsgroup(s).