From patchwork Tue Mar 13 14:35:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10279197 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 89BD8603B5 for ; Tue, 13 Mar 2018 14:36:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B16228A4E for ; Tue, 13 Mar 2018 14:36:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F5D729037; Tue, 13 Mar 2018 14:36:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBDA329029 for ; Tue, 13 Mar 2018 14:36:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752420AbeCMOg3 (ORCPT ); Tue, 13 Mar 2018 10:36:29 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:32774 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932553AbeCMOg0 (ORCPT ); Tue, 13 Mar 2018 10:36:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=d0eF0vlJTYyTKPCzF9mfAr9vfieF6Kgym52Dt2+CA3E=; b=Dvx6iYAtDXFRcQgp6v8y8PmiI wQbF372WlJ058mBCs0Y144nwzyVg+kcN4pexwNkridikerkahMGYhwY1YJSYaGZVr7gsEcLMqb4qP cOwEuPaHwilN0i0oLqQm/5oyqVLV1Gy5wqd+0BmCPFhDeqxDE+1dgo0X8h05b1cGiQ0TNXsrHXIHk U01BxW22eYvm71R3Nb8GgOUarysiTvRleKNAqEqE37j4LktWYSc3QECz5YAZ9hv4uW4Gxi8kREYq0 JUKGXs3rhiLw1wiWX6HHEvo4RXqiXFeO9fd1DPeMDZkIwCwfq3x+AK84j81MHKC38gI2UbIKqUOhH ICSCDsCoA==; Received: from 77.117.139.172.wireless.dyn.drei.com ([77.117.139.172] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1evl2O-0004cM-Km for linux-xfs@vger.kernel.org; Tue, 13 Mar 2018 14:36:25 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 6/8] xfs: minor cleanup for xfs_reflink_end_cow Date: Tue, 13 Mar 2018 15:35:59 +0100 Message-Id: <20180313143601.30028-7-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180313143601.30028-1-hch@lst.de> References: <20180313143601.30028-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use xfs_iext_prev_extent to skip to the previous extent instead of opencoding it. Signed-off-by: Christoph Hellwig Reviewed-by: Darrick J. Wong --- fs/xfs/xfs_reflink.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 90aac8889dd9..cdbd342a5249 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -762,10 +762,8 @@ xfs_reflink_end_cow( xfs_trim_extent(&del, offset_fsb, end_fsb - offset_fsb); /* Extent delete may have bumped ext forward */ - if (!del.br_blockcount) { - xfs_iext_prev(ifp, &icur); - goto next_extent; - } + if (!del.br_blockcount) + goto prev_extent; ASSERT(!isnullstartblock(got.br_startblock)); @@ -774,10 +772,8 @@ xfs_reflink_end_cow( * speculatively preallocated CoW extents that have been * allocated but have not yet been involved in a write. */ - if (got.br_state == XFS_EXT_UNWRITTEN) { - xfs_iext_prev(ifp, &icur); - goto next_extent; - } + if (got.br_state == XFS_EXT_UNWRITTEN) + goto prev_extent; /* Unmap the old blocks in the data fork. */ xfs_defer_init(&dfops, &firstfsb); @@ -816,9 +812,12 @@ xfs_reflink_end_cow( error = xfs_defer_finish(&tp, &dfops); if (error) goto out_defer; -next_extent: if (!xfs_iext_get_extent(ifp, &icur, &got)) break; + continue; +prev_extent: + if (!xfs_iext_prev_extent(ifp, &icur, &got)) + break; } error = xfs_trans_commit(tp);