From patchwork Wed Nov 23 06:59:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9486481 X-Mozilla-Keys: nonjunk Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on sandeen.net X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.0 X-Spam-HP: BAYES_00=-1.9,HEADER_FROM_DIFFERENT_DOMAINS=0.001, RP_MATCHES_RCVD=-0.1,UNPARSEABLE_RELAY=0.001 X-Original-To: sandeen@sandeen.net Delivered-To: sandeen@sandeen.net Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by sandeen.net (Postfix) with ESMTP id 9772911707 for ; Wed, 23 Nov 2016 00:58:56 -0600 (CST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932969AbcKWG7g (ORCPT ); Wed, 23 Nov 2016 01:59:36 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:21617 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932600AbcKWG7f (ORCPT ); Wed, 23 Nov 2016 01:59:35 -0500 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uAN6xXAb026314 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Nov 2016 06:59:34 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id uAN6xXIo000444 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 23 Nov 2016 06:59:33 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id uAN6xX4l009805; Wed, 23 Nov 2016 06:59:33 GMT Received: from localhost (/24.21.211.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 22 Nov 2016 22:59:33 -0800 Subject: [PATCH 2/2] docs: update refcount btree to reflect new cow staging extent policy From: "Darrick J. Wong" To: david@fromorbit.com, darrick.wong@oracle.com Cc: linux-xfs@vger.kernel.org Date: Tue, 22 Nov 2016 22:59:32 -0800 Message-ID: <147988437242.12225.5403821258157075504.stgit@birch.djwong.org> In-Reply-To: <147988436636.12225.3639807183440429674.stgit@birch.djwong.org> References: <147988436636.12225.3639807183440429674.stgit@birch.djwong.org> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org We now record the extents being used to stage a copy on write operation in the refcount btree with the high bit of rc_startblock set and a reference count of 1. Setting the high bit helps us reduce CoW GC time at mount by moving all the records to the right side of the tree. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- .../XFS_Filesystem_Structure/refcountbt.asciidoc | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) -- 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 diff --git a/design/XFS_Filesystem_Structure/refcountbt.asciidoc b/design/XFS_Filesystem_Structure/refcountbt.asciidoc index dbbb98e..508a9dd 100644 --- a/design/XFS_Filesystem_Structure/refcountbt.asciidoc +++ b/design/XFS_Filesystem_Structure/refcountbt.asciidoc @@ -25,7 +25,10 @@ struct xfs_refcount_rec { ---- *rc_startblock*:: -AG block number of this record. +AG block number of this record. The high bit is set for all records +referring to an extent that is being used to stage a copy on write +operation. This reduces recovery time during mount operations. The +reference count of these staging events must only be 1. *rc_blockcount*:: The length of this extent. @@ -81,12 +84,18 @@ lsn = 0x200004ec2 uuid = f1f89746-e00b-49c9-96b3-ecef0f2f14ae owner = 0 crc = 0xc3962813 (correct) -recs[1-80] = [startblock,blockcount,refcount] - 1:[65780,1,2] 2:[65781,1,3] 3:[65785,2,2] 4:[66640,1,2] - 5:[69602,4,2] 6:[72256,16,2] 7:[72871,4,2] 8:[72879,20,2] - 9:[73395,4,2] 10:[75063,4,2] 11:[79093,4,2] 12:[86344,16,2] +recs[1-80] = [startblock,blockcount,refcount,cowflag] + 1:[65780,1,2,0] 2:[65781,1,3,0] 3:[65785,2,2,0] 4:[66640,1,2,0] + 5:[69602,4,2,0] 6:[72256,16,2,0] 7:[72871,4,2,0] 8:[72879,20,2,0] + 9:[73395,4,2,0] 10:[75063,4,2,0] 11:[79093,4,2,0] 12:[86344,16,2,0] + ... + 80:[35235,10,1,1] ---- +Notice record 80. The copy on write flag is set and the reference count is +1, which indicates that the extent 35,235 - 35,244 are being used to stage a +copy on write activity. The "cowflag" field is the high bit of rc_startblock. + Record 6 in the reference count B+tree for AG 0 indicates that the AG extent starting at block 72,256 and running for 16 blocks has a reference count of 2. This means that there are two files sharing the block: