From patchwork Tue Oct 31 14:22:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10034647 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 B477D60291 for ; Tue, 31 Oct 2017 14:22:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6DC728B22 for ; Tue, 31 Oct 2017 14:22:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9BC8E28B74; Tue, 31 Oct 2017 14:22:49 +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 46B1B28B22 for ; Tue, 31 Oct 2017 14:22:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753501AbdJaOWs (ORCPT ); Tue, 31 Oct 2017 10:22:48 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:36534 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753309AbdJaOWq (ORCPT ); Tue, 31 Oct 2017 10:22:46 -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=85Ym9O/+IKn6yK5fQOdsD0YjtYynG6xpuZykoTMUqEo=; b=l47+46o8Xh+gF3SB6tPeGTtPu h/VicUMfNs+hu9xHXZ8rZ6ilTj5vBj1qSQHYPUm1eSzRmEe3gg0oxalTSmbkmTtwz9gfLg0XKcu+0 n+l7lPc2+V8R0Z682PNT7lsvzSKgM6zse3kBTNfk3T9b9eKFJCZEx1ux5UK/+SU9LAwccq9ebqzA8 UJObZ3zd21bpXHMB7UmIxYN60YgHVe7bu3ivk3RrpR9UIAdKqUpsn4D51dddbcAWiZOig7Cnmr6j/ D840Nq+1S+IvPr2AcCSTMTT/uthcvsWCYQo+5bg2AY0VMbtoHmoTkzobQJzC6WqsuBQgc1obQbwPf RDFjd/MaA==; Received: from bzq-164-168-31-210.red.bezeqint.net ([31.168.164.210] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.87 #1 (Red Hat Linux)) id 1e9XRG-0007aq-3N for linux-xfs@vger.kernel.org; Tue, 31 Oct 2017 14:22:46 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 04/18] xfs: treat idx as a cursor in xfs_bmap_add_extent_hole_delay Date: Tue, 31 Oct 2017 16:22:16 +0200 Message-Id: <20171031142230.11755-5-hch@lst.de> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171031142230.11755-1-hch@lst.de> References: <20171031142230.11755-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 Stop poking before and after the index and just increment or decrement it while doing our operations on it to prepare for a new extent list implementation. Signed-off-by: Christoph Hellwig Reviewed-by: Brian Foster Reviewed-by: Darrick J. Wong --- fs/xfs/libxfs/xfs_bmap.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 83f5a503dce1..6358b30b70f9 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -2583,7 +2583,6 @@ xfs_bmap_add_extent_hole_delay( * on the left and on the right. * Merge all three into a single extent record. */ - --*idx; temp = left.br_blockcount + new->br_blockcount + right.br_blockcount; @@ -2594,9 +2593,10 @@ xfs_bmap_add_extent_hole_delay( oldlen); left.br_startblock = nullstartblock(newlen); left.br_blockcount = temp; - xfs_iext_update_extent(ip, state, *idx, &left); - xfs_iext_remove(ip, *idx + 1, 1, state); + xfs_iext_remove(ip, *idx, 1, state); + --*idx; + xfs_iext_update_extent(ip, state, *idx, &left); break; case BMAP_LEFT_CONTIG: @@ -2605,7 +2605,6 @@ xfs_bmap_add_extent_hole_delay( * on the left. * Merge the new allocation with the left neighbor. */ - --*idx; temp = left.br_blockcount + new->br_blockcount; oldlen = startblockval(left.br_startblock) + @@ -2614,6 +2613,8 @@ xfs_bmap_add_extent_hole_delay( oldlen); left.br_blockcount = temp; left.br_startblock = nullstartblock(newlen); + + --*idx; xfs_iext_update_extent(ip, state, *idx, &left); break;