From patchwork Tue Jul 17 23:24:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10531057 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 1D19D60545 for ; Tue, 17 Jul 2018 23:24:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0D517293E0 for ; Tue, 17 Jul 2018 23:24:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00FD8293F3; Tue, 17 Jul 2018 23:24:13 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 9EFED293FE for ; Tue, 17 Jul 2018 23:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729759AbeGQX7E (ORCPT ); Tue, 17 Jul 2018 19:59:04 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:38542 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730460AbeGQX7E (ORCPT ); Tue, 17 Jul 2018 19:59:04 -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=KzO7rOLcwwcopdYUuINgs+THXytd+FROlzSn9RZOOgM=; b=dUeJpsJXpk8hgUtcCfa2YUn+e y1IscpPgGMAmjrCXBjZXRLo1AyjRBZrVkzJ3yj0O3uhFg/DhYL7znrJTu4q9WvMDe2yjYcirwj0h2 vIyBOY343qzcWcMlP4n5mpeGyL0M3V2PbKN6j//H0mKbOz6lW2ynHlPkAhnTr9/aI4K8f1JxDa2ya KcTIiEQkO3OTG20+lJdFqQjxRRxRKEQtlsMdmiMqlgmw+3dAVGNgNdH5AIsHiAD9m9AqEvMEtEBQd YuMvvqN7SSgNkQHpsYLM4YLaqe+R2lg04lyEmDacjIGfVXF2VynqpNh4F4p1sFj14yVo5Qt1Pd3Q2 YX4RxPvvg==; Received: from sjc00ib2.hgst.com ([199.255.44.5] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1ffZKC-0001Dt-Ew for linux-xfs@vger.kernel.org; Tue, 17 Jul 2018 23:24:08 +0000 From: Christoph Hellwig To: linux-xfs@vger.kernel.org Subject: [PATCH 5/6] xfs: maintain a sequence count for inode fork manipulations Date: Tue, 17 Jul 2018 16:24:04 -0700 Message-Id: <20180717232405.18511-6-hch@lst.de> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180717232405.18511-1-hch@lst.de> References: <20180717232405.18511-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 Add a simple 32-bit unsigned integer as the sequence count for modifications to the extent list in the inode fork. This will be used to optimize away extent list lookups in the writeback code. Signed-off-by: Christoph Hellwig Reviewed-by: Carlos Maiolino --- fs/xfs/libxfs/xfs_iext_tree.c | 6 ++++++ fs/xfs/libxfs/xfs_inode_fork.h | 1 + 2 files changed, 7 insertions(+) diff --git a/fs/xfs/libxfs/xfs_iext_tree.c b/fs/xfs/libxfs/xfs_iext_tree.c index b80c63faace2..8a7aea041ee1 100644 --- a/fs/xfs/libxfs/xfs_iext_tree.c +++ b/fs/xfs/libxfs/xfs_iext_tree.c @@ -624,6 +624,8 @@ xfs_iext_insert( struct xfs_iext_leaf *new = NULL; int nr_entries, i; + ifp->if_seq++; + if (ifp->if_height == 0) xfs_iext_alloc_root(ifp, cur); else if (ifp->if_height == 1) @@ -864,6 +866,8 @@ xfs_iext_remove( ASSERT(ifp->if_u1.if_root != NULL); ASSERT(xfs_iext_valid(ifp, cur)); + ifp->if_seq++; + nr_entries = xfs_iext_leaf_nr_entries(ifp, leaf, cur->pos) - 1; for (i = cur->pos; i < nr_entries; i++) leaf->recs[i] = leaf->recs[i + 1]; @@ -970,6 +974,8 @@ xfs_iext_update_extent( { struct xfs_ifork *ifp = xfs_iext_state_to_fork(ip, state); + ifp->if_seq++; + if (cur->pos == 0) { struct xfs_bmbt_irec old; diff --git a/fs/xfs/libxfs/xfs_inode_fork.h b/fs/xfs/libxfs/xfs_inode_fork.h index 1492143371f3..f20b2468ca35 100644 --- a/fs/xfs/libxfs/xfs_inode_fork.h +++ b/fs/xfs/libxfs/xfs_inode_fork.h @@ -14,6 +14,7 @@ struct xfs_dinode; */ struct xfs_ifork { int if_bytes; /* bytes in if_u1 */ + unsigned int if_seq; struct xfs_btree_block *if_broot; /* file's incore btree root */ short if_broot_bytes; /* bytes allocated for root */ unsigned char if_flags; /* per-fork flags */