From patchwork Fri Jul 7 03:31:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 9829521 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 2871D60317 for ; Fri, 7 Jul 2017 03:31:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D462285D9 for ; Fri, 7 Jul 2017 03:31:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0E0B4285E3; Fri, 7 Jul 2017 03:31:47 +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.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY 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 7A280285D9 for ; Fri, 7 Jul 2017 03:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753375AbdGGDbp (ORCPT ); Thu, 6 Jul 2017 23:31:45 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:49708 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753341AbdGGDbp (ORCPT ); Thu, 6 Jul 2017 23:31:45 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v673Ve32009381 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Jul 2017 03:31:41 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v673VdWL016733 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Jul 2017 03:31:40 GMT Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v673Vd8o012159; Fri, 7 Jul 2017 03:31:39 GMT Received: from localhost (/24.21.211.40) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Jul 2017 20:31:39 -0700 Date: Thu, 6 Jul 2017 20:31:38 -0700 From: "Darrick J. Wong" To: Eric Sandeen Cc: xfs , Brian Foster Subject: [PATCH] mkfs: set agblklog when we're verifying minimum log size Message-ID: <20170707033138.GC4103@magnolia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0022.oracle.com [141.146.126.234] 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 In e5cc9d560a ("mkfs: set agsize prior to calculating minimum log size"), we set the ag size in the superblock structure so that we can calculate the maximum btree height correctly. The btree heights are used to calculate transaction reservation sizes; these sizes are used to compute the minimum log length; and the minimum log length is checked by the kernel. Unfortunately, I didn't realize that some of the btree sizing functions also depend on the agblklog (log2 of the ag size), so we've been underestimating the minimum log length allowable, which results in mkfs formatting filesystems that the kernel refuses to mount. This can be trivially reproduced by formatting a small (~800M) volume with rmap and reflink turned on. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster --- mkfs/maxtrres.c | 1 + 1 file changed, 1 insertion(+) -- 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/mkfs/maxtrres.c b/mkfs/maxtrres.c index fba7818..69ec67a 100644 --- a/mkfs/maxtrres.c +++ b/mkfs/maxtrres.c @@ -54,6 +54,7 @@ max_trans_res( sbp->sb_blocklog = blocklog; sbp->sb_blocksize = 1 << blocklog; sbp->sb_agblocks = agsize; + sbp->sb_agblklog = (uint8_t)libxfs_log2_roundup((unsigned int)agsize); sbp->sb_inodelog = inodelog; sbp->sb_inopblog = blocklog - inodelog; sbp->sb_inodesize = 1 << inodelog;