From patchwork Sat Feb 13 05:47:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12086609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFBE9C433DB for ; Sat, 13 Feb 2021 05:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8332064E74 for ; Sat, 13 Feb 2021 05:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229718AbhBMFsI (ORCPT ); Sat, 13 Feb 2021 00:48:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:57548 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbhBMFsH (ORCPT ); Sat, 13 Feb 2021 00:48:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 656C864E9C; Sat, 13 Feb 2021 05:47:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613195229; bh=xu4I7Zho5aatS468G2ieDU6Sn9deTfMztZnfSIbgVX0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=lSe83WgQg1/1YreFaBpED0tGInFYPTrfSiDhTlmo2cokz6nwCzfjrDx5Yiqb7w20d VhOf2f6JZ31TdYG9rjPnhZYdswcsJ9OIhnKIUJxSV/dXTJZ9DQF2jFh5xyr/iMD39+ Rn/rRwiOeFNs2pCKuqQ0bMp3W7O4GMsns/C1HTqNxBng21pjJVGwEandyKVtsE7ANm r9JFD0wW/sTrp+ekyCTyFc7+QBb3j/0UNB9ggcMLXTIXARMY/PoVvrudda9TtG2fKY mWSny9Dw2I6pYsHdKyYQyq8ayH490l2Je3nGT05el6VD90VheVj8UH8ehzwBkHtulE n3+lXIYdTZQTQ== Subject: [PATCH 1/5] man: mark all deprecated V4 format options From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Fri, 12 Feb 2021 21:47:09 -0800 Message-ID: <161319522904.423010.55854460196587153.stgit@magnolia> In-Reply-To: <161319522350.423010.5768275226481994478.stgit@magnolia> References: <161319522350.423010.5768275226481994478.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Update the manual pages for the most popular tools to note which options are only useful with the V4 XFS format, and that the V4 format is deprecated and will be removed no later than September 2030. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- man/man8/mkfs.xfs.8 | 16 ++++++++++++++++ man/man8/xfs_admin.8 | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8 index fac82d74..df25abaa 100644 --- a/man/man8/mkfs.xfs.8 +++ b/man/man8/mkfs.xfs.8 @@ -223,6 +223,11 @@ of calculating and checking the CRCs is not noticeable in normal operation. By default, .B mkfs.xfs will enable metadata CRCs. +.IP +Formatting a filesystem without CRCs selects the V4 format, which is deprecated +and will be removed from upstream in September 2030. +Distributors may choose to withdraw support for the V4 format earlier than +this date. .TP .BI finobt= value This option enables the use of a separate free inode btree index in each @@ -592,6 +597,8 @@ This option can be used to turn off inode alignment when the filesystem needs to be mountable by a version of IRIX that does not have the inode alignment feature (any release of IRIX before 6.2, and IRIX 6.2 without XFS patches). +.IP +This option only applies to the deprecated V4 format. .TP .BI attr= value This is used to specify the version of extended attribute inline @@ -602,6 +609,8 @@ between attribute and extent data. The previous version 1, which has fixed regions for attribute and extent data, is kept for backwards compatibility with kernels older than version 2.6.16. +.IP +This option only applies to the deprecated V4 format. .TP .BI projid32bit[= value ] This is used to enable 32bit quota project identifiers. The @@ -609,6 +618,8 @@ This is used to enable 32bit quota project identifiers. The is either 0 or 1, with 1 signifying that 32bit projid are to be enabled. If the value is omitted, 1 is assumed. (This default changed in release version 3.2.0.) +.IP +This option only applies to the deprecated V4 format. .TP .BI sparse[= value ] Enable sparse inode chunk allocation. The @@ -690,6 +701,7 @@ stripe-aligned log writes (see the sunit and su options, below). The previous version 1, which is limited to 32k log buffers and does not support stripe-aligned writes, is kept for backwards compatibility with very old 2.4 kernels. +This option only applies to the deprecated V4 format. .TP .BI sunit= value This specifies the alignment to be used for log writes. The @@ -744,6 +756,8 @@ is 1 (on) so you must specify .B lazy-count=0 if you want to disable this feature for older kernels which don't support it. +.IP +This option only applies to the deprecated V4 format. .RE .PP .PD 0 @@ -803,6 +817,8 @@ will be stored in the directory structure. The default value is 1. When CRCs are enabled (the default), the ftype functionality is always enabled, and cannot be turned off. .IP +This option only applies to the deprecated V4 format. +.IP .RE .TP .BI \-p " protofile" diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index cccbb224..5ef99316 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -54,6 +54,8 @@ for a detailed description of the XFS log. Enables unwritten extent support on a filesystem that does not already have this enabled (for legacy filesystems, it can't be disabled anymore at mkfs time). +.IP +This option only applies to the deprecated V4 format. .TP .B \-f Specifies that the filesystem image to be processed is stored in a @@ -67,12 +69,16 @@ option). .B \-j Enables version 2 log format (journal format supporting larger log buffers). +.IP +This option only applies to the deprecated V4 format. .TP .B \-l Print the current filesystem label. .TP .B \-p Enable 32bit project identifier support (PROJID32BIT feature). +.IP +This option only applies to the deprecated V4 format. .TP .B \-u Print the current filesystem UUID (Universally Unique IDentifier). @@ -83,6 +89,8 @@ Enable (1) or disable (0) lazy-counters in the filesystem. Lazy-counters may not be disabled on Version 5 superblock filesystems (i.e. those with metadata CRCs enabled). .IP +In other words, this option only applies to the deprecated V4 format. +.IP This operation may take quite a bit of time on large filesystems as the entire filesystem needs to be scanned when this option is changed. .IP @@ -92,6 +100,8 @@ information is kept in other parts of the filesystem to be able to maintain the counter values without needing to keep them in the superblock. This gives significant improvements in performance on some configurations and metadata intensive workloads. +.IP +This option only applies to the deprecated V4 format. .TP .BI \-L " label" Set the filesystem label to From patchwork Sat Feb 13 05:47:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12086607 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A354C433E0 for ; Sat, 13 Feb 2021 05:48:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5315564D9D for ; Sat, 13 Feb 2021 05:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhBMFsH (ORCPT ); Sat, 13 Feb 2021 00:48:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:57550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229718AbhBMFsG (ORCPT ); Sat, 13 Feb 2021 00:48:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E31E164E68; Sat, 13 Feb 2021 05:47:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613195235; bh=UA8/ii9uQrgYeWSnepEVu0MxU4ibDoot2yHuZ3RMjpg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FwUId7uYtgAgdWgrIZZ6K5JYMkxwQc0Zp34jAOa2MvY1uAqOwqrVy4X1xNo2Mac7j HYX0qKQIfpZ0CcG+mthuB/EZxmdgjKQAuzHkJtrb/5BWPdwTFmTT23mmRIiLFfGskG YDM9WjCPViqVwNfSS/4/XcVKJr7ISambIFr9F9+R/3n3EJJfbuxZ+xZW1ENryJLJIR SBRdhtx7YqF56p6y/mV/9gkkEB3+3LRLpdixWOyFo7LzY9JOXRtqs/PdLw5qKJYHrd X547PDnMim2RdM3zRisEBOf/53IogaLuSNayWFXCaTMgKhCCLUKsWXR7xqJG2uCMJZ 8FaGYw79uaTLw== Subject: [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Fri, 12 Feb 2021 21:47:14 -0800 Message-ID: <161319523460.423010.11387475504369174814.stgit@magnolia> In-Reply-To: <161319522350.423010.5768275226481994478.stgit@magnolia> References: <161319522350.423010.5768275226481994478.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Add some helper functions so that we can allow users to upgrade V5 filesystems in a sane manner. This just lands the boilerplate; the actual feature validation and whatnot will land in the next patches. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig --- repair/phase2.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/repair/phase2.c b/repair/phase2.c index 952ac4a5..f654edcc 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -131,6 +131,40 @@ zero_log( libxfs_max_lsn = log->l_last_sync_lsn; } +/* Perform the user's requested upgrades on filesystem. */ +static void +upgrade_filesystem( + struct xfs_mount *mp) +{ + struct xfs_buf *bp; + bool dirty = false; + int error; + + if (no_modify || !dirty) + return; + + bp = libxfs_getsb(mp); + if (!bp || bp->b_error) { + do_error( + _("couldn't get superblock for feature upgrade, err=%d\n"), + bp ? bp->b_error : ENOMEM); + } else { + libxfs_sb_to_disk(bp->b_addr, &mp->m_sb); + + /* + * Write the primary super to disk immediately so that + * needsrepair will be set if repair doesn't complete. + */ + error = -libxfs_bwrite(bp); + if (error) + do_error( + _("filesystem feature upgrade failed, err=%d\n"), + error); + } + if (bp) + libxfs_buf_relse(bp); +} + /* * ok, at this point, the fs is mounted but the root inode may be * trashed and the ag headers haven't been checked. So we have @@ -235,4 +269,10 @@ phase2( do_warn(_("would correct\n")); } } + + /* + * Upgrade the filesystem now that we've done a preliminary check of + * the superblocks, the AGs, the log, and the metadata inodes. + */ + upgrade_filesystem(mp); } From patchwork Sat Feb 13 05:47:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12086611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC5F5C433DB for ; Sat, 13 Feb 2021 05:48:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A80E764D9D for ; Sat, 13 Feb 2021 05:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230426AbhBMFsP (ORCPT ); Sat, 13 Feb 2021 00:48:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:57578 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230117AbhBMFsM (ORCPT ); Sat, 13 Feb 2021 00:48:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6BACD64EA0; Sat, 13 Feb 2021 05:47:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613195240; bh=ob7Pm07fS8v/Xgevnx8Fzacgh+AxqJ9PGNz6d6P9v9c=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=QYfBVlyqLaYBwe/Kbjk3Qjlb5Keq4IFAyTYxtisk8BUHnfE85fW8b42WqK8Y/yufY PGc0DTHJmyC/a1bNVSluJ1bRM3tqMIgxVKp+J/JJHlv1ZJmkn2EfAb/yFibujPhSPi MVwQdZhEr4xBe0dMCVHYCx/tx5UOo2M0ea6LQUeKCuf8sG8+R3VnE/jMHsT2w7B/gi bejfr843X/TZxE4YFJIzqoqGAD5p1eq01jjTJxiSWHVa91w7Zphyq2v2X/W97FCiXE JWsLJY6Hz7XFe4SpRxATh19LsjZbLJPO7yPw4nEQjX2Iy0tgi17gJNjXRsubxhSaAg 1HmxfkJbRi3ww== Subject: [PATCH 3/5] xfs_admin: support adding features to V5 filesystems From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Fri, 12 Feb 2021 21:47:20 -0800 Message-ID: <161319524012.423010.5077217318092830718.stgit@magnolia> In-Reply-To: <161319522350.423010.5768275226481994478.stgit@magnolia> References: <161319522350.423010.5768275226481994478.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Teach the xfs_admin script how to add features to V5 filesystems. Technically speaking we could add lazycount to the list, but that option is only useful for the V4 format which is deprecated. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig --- db/xfs_admin.sh | 6 ++++-- man/man8/xfs_admin.8 | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh index 430872ef..7a467dbe 100755 --- a/db/xfs_admin.sh +++ b/db/xfs_admin.sh @@ -8,9 +8,10 @@ status=0 DB_OPTS="" REPAIR_OPTS="" REPAIR_DEV_OPTS="" -USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-r rtdev] [-U uuid] device [logdev]" +DB_LOG_OPTS="" +USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-O v5_feature] [-r rtdev] [-U uuid] device [logdev]" -while getopts "c:efjlL:pr:uU:V" c +while getopts "c:efjlL:O:pr:uU:V" c do case $c in c) REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG;; @@ -19,6 +20,7 @@ do j) DB_OPTS=$DB_OPTS" -c 'version log2'";; l) DB_OPTS=$DB_OPTS" -r -c label";; L) DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'";; + O) REPAIR_OPTS=$REPAIR_OPTS" -c $OPTARG=1";; p) DB_OPTS=$DB_OPTS" -c 'version projid32bit'";; r) REPAIR_DEV_OPTS=" -r '$OPTARG'";; u) DB_OPTS=$DB_OPTS" -r -c uuid";; diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 5ef99316..ae661648 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -6,6 +6,8 @@ xfs_admin \- change parameters of an XFS filesystem [ .B \-eflpu ] [ +.BI \-O " featurelist" +] [ .BR "\-c 0" | 1 ] [ .B \-L @@ -116,6 +118,26 @@ The filesystem label can be cleared using the special "\c " value for .IR label . .TP +.BI \-O " feature1" = "status" , "feature2" = "status..." +Add or remove features on an existing V5 filesystem. +The features should be specified as a comma-separated list. +.I status +should be either 0 to disable the feature or 1 to enable the feature. +Note, however, that most features cannot be disabled. +.IP +.B NOTE: +Administrators must ensure the filesystem is clean by running +.B xfs_repair -n +to inspect the filesystem before performing the upgrade. +If corruption is found, recovery procedures (e.g. reformat followed by +restoration from backup; or running +.B xfs_repair +without the +.BR -n ) +must be followed to clean the filesystem. +.IP +There are no feature options currently. +.TP .BI \-U " uuid" Set the UUID of the filesystem to .IR uuid . From patchwork Sat Feb 13 05:47:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12086613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A0F8C433E6 for ; Sat, 13 Feb 2021 05:48:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DA6F64D9D for ; Sat, 13 Feb 2021 05:48:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbhBMFsQ (ORCPT ); Sat, 13 Feb 2021 00:48:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:57580 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhBMFsN (ORCPT ); Sat, 13 Feb 2021 00:48:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EBEDE64EA1; Sat, 13 Feb 2021 05:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613195246; bh=HJ1MlqxemPRYvd9E+sxVU47WiV3IihEK4Aq20xSHNm8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=LTXjmXwQiRbXrcgTvkEYFl8JCkKPR1NuQ0//RRpF+ezN/ubLgUtTTdzdDC+ve2ure 7QzIsRypNIdSswI5kCWAmLS3Jc/YQFFdXd61qYvw2ivg3RL/cwi4E8rF/IYgT0dDVp 9pnPoJmrFQ++QKL7IR6BTGVCNwiTblx3qSJy7vnz7dUZNFOJVwLMVY6nBo+0uLlgR2 PUmgd9uqfZtTvtG0m25Hf1jBcoh8eFI8nPZ1lRiql2hFxQYfNjDEynhmLjHGIsHBQ+ IWa7KLkgZEDor1ZRZO1Xf+ZCbL+w9lx4hhDftfhKR49vjqHaw1m6Qp7nbdoSKGz8oN elfBJn7+ZekSA== Subject: [PATCH 4/5] xfs_repair: enable inobtcount upgrade via repair From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Fri, 12 Feb 2021 21:47:25 -0800 Message-ID: <161319524563.423010.7140989505952004894.stgit@magnolia> In-Reply-To: <161319522350.423010.5768275226481994478.stgit@magnolia> References: <161319522350.423010.5768275226481994478.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Use xfs_repair to add the inode btree counter feature to a filesystem. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- man/man8/xfs_admin.8 | 11 ++++++++++- repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 30 ++++++++++++++++++++++++++++++ repair/xfs_repair.c | 11 +++++++++++ 5 files changed, 53 insertions(+), 1 deletion(-) diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index ae661648..4ba718d8 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -136,7 +136,16 @@ without the .BR -n ) must be followed to clean the filesystem. .IP -There are no feature options currently. +Supported features are as follows: +.RS 0.7i +.TP 0.4i +.B inobtcount +Keep a count the number of blocks in each inode btree in the AGI. +This reduces mount time by speeding up metadata space reservation calculations. +The filesystem cannot be downgraded after this feature is enabled. +Once enabled, the filesystem will not be writable by older kernels. +This feature was added to Linux 5.10. +.RE .TP .BI \-U " uuid" Set the UUID of the filesystem to diff --git a/repair/globals.c b/repair/globals.c index 537d068b..47d90bd3 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -48,6 +48,7 @@ char *rt_name; /* Name of realtime device */ int rt_spec; /* Realtime dev specified as option */ int convert_lazy_count; /* Convert lazy-count mode on/off */ int lazy_count; /* What to set if to if converting */ +bool add_inobtcount; /* add inode btree counts to AGI */ /* misc status variables */ diff --git a/repair/globals.h b/repair/globals.h index a9287320..5b6fe4d4 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -89,6 +89,7 @@ extern char *rt_name; /* Name of realtime device */ extern int rt_spec; /* Realtime dev specified as option */ extern int convert_lazy_count; /* Convert lazy-count mode on/off */ extern int lazy_count; /* What to set if to if converting */ +extern bool add_inobtcount; /* add inode btree counts to AGI */ /* misc status variables */ diff --git a/repair/phase2.c b/repair/phase2.c index f654edcc..96074a1d 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -131,6 +131,33 @@ zero_log( libxfs_max_lsn = log->l_last_sync_lsn; } +static bool +set_inobtcount( + struct xfs_mount *mp) +{ + if (!xfs_sb_version_hascrc(&mp->m_sb)) { + printf( + _("Inode btree count feature only supported on V5 filesystems.\n")); + exit(0); + } + + if (!xfs_sb_version_hasfinobt(&mp->m_sb)) { + printf( + _("Inode btree count feature requires free inode btree.\n")); + exit(0); + } + + if (xfs_sb_version_hasinobtcounts(&mp->m_sb)) { + printf(_("Filesystem already has inode btree counts.\n")); + exit(0); + } + + printf(_("Adding inode btree counts to filesystem.\n")); + mp->m_sb.sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT; + mp->m_sb.sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR; + return true; +} + /* Perform the user's requested upgrades on filesystem. */ static void upgrade_filesystem( @@ -140,6 +167,9 @@ upgrade_filesystem( bool dirty = false; int error; + if (add_inobtcount) + dirty |= set_inobtcount(mp); + if (no_modify || !dirty) return; diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 6b60b8f4..2d9dca6b 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -65,11 +65,13 @@ static char *o_opts[] = { */ enum c_opt_nums { CONVERT_LAZY_COUNT = 0, + CONVERT_INOBTCOUNT, C_MAX_OPTS, }; static char *c_opts[] = { [CONVERT_LAZY_COUNT] = "lazycount", + [CONVERT_INOBTCOUNT] = "inobtcount", [C_MAX_OPTS] = NULL, }; @@ -302,6 +304,15 @@ process_args(int argc, char **argv) lazy_count = (int)strtol(val, NULL, 0); convert_lazy_count = 1; break; + case CONVERT_INOBTCOUNT: + if (!val) + do_abort( + _("-c inobtcount requires a parameter\n")); + if (strtol(val, NULL, 0) != 1) + do_abort( + _("-c inobtcount only supports upgrades\n")); + add_inobtcount = true; + break; default: unknown('c', val); break; From patchwork Sat Feb 13 05:47:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Darrick J. Wong" X-Patchwork-Id: 12086615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2D39C433DB for ; Sat, 13 Feb 2021 05:48:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B43F264D9D for ; Sat, 13 Feb 2021 05:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230460AbhBMFsT (ORCPT ); Sat, 13 Feb 2021 00:48:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:57584 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230397AbhBMFsS (ORCPT ); Sat, 13 Feb 2021 00:48:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C50364E9D; Sat, 13 Feb 2021 05:47:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1613195251; bh=BxvOtBu3s4NGGg0KSeTA17OYiBE+m793npTh3O45m10=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=FIRnHE/SqN26N0KxRLL0ietFo0U8j+WtnxNvQWYwRRyJ3XMKvzepgd5O9L+oDCGDS 7x0GV8PprY+dDsf4gyI3KJXTwkfrk8W2k1GZLyKdRX3MjntrJqd/GAgNQZTwXU6XLs R5uXoawPZ2YJk/gniKdYRWtXfFUvH7ZIyjwBg+g6XR5iojvs4Jg/jX5TYqCj3pDPU4 UIJxtozoVbHMEwXsmLwC3gJHAXCXNDefgV+7+lFcuSG6J0W0gd3moavYvzfhNqJNgr 9btKQqctzPGhNHtICLPE6+l+9PKn3MRse+efqqfze0jscp0jawCgOnv/dQPxW4KfXJ kA0XF2TNK14og== Subject: [PATCH 5/5] xfs_repair: enable bigtime upgrade via repair From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Christoph Hellwig , Brian Foster , linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Fri, 12 Feb 2021 21:47:31 -0800 Message-ID: <161319525117.423010.6467565288868099323.stgit@magnolia> In-Reply-To: <161319522350.423010.5768275226481994478.stgit@magnolia> References: <161319522350.423010.5768275226481994478.stgit@magnolia> User-Agent: StGit/0.19 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org From: Darrick J. Wong Upgrade existing V5 filesystems to support large timestamps up to 2486. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Brian Foster --- man/man8/xfs_admin.8 | 6 ++++++ repair/globals.c | 1 + repair/globals.h | 1 + repair/phase2.c | 23 +++++++++++++++++++++++ repair/xfs_repair.c | 11 +++++++++++ 5 files changed, 42 insertions(+) diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8 index 4ba718d8..25437ff1 100644 --- a/man/man8/xfs_admin.8 +++ b/man/man8/xfs_admin.8 @@ -145,6 +145,12 @@ This reduces mount time by speeding up metadata space reservation calculations. The filesystem cannot be downgraded after this feature is enabled. Once enabled, the filesystem will not be writable by older kernels. This feature was added to Linux 5.10. +.TP 0.4i +.B bigtime +Upgrade a filesystem to support larger timestamps up to the year 2486. +The filesystem cannot be downgraded after this feature is enabled. +Once enabled, the filesystem will not be mountable by older kernels. +This feature was added to Linux 5.10. .RE .TP .BI \-U " uuid" diff --git a/repair/globals.c b/repair/globals.c index 47d90bd3..506a4e72 100644 --- a/repair/globals.c +++ b/repair/globals.c @@ -49,6 +49,7 @@ int rt_spec; /* Realtime dev specified as option */ int convert_lazy_count; /* Convert lazy-count mode on/off */ int lazy_count; /* What to set if to if converting */ bool add_inobtcount; /* add inode btree counts to AGI */ +bool add_bigtime; /* add support for timestamps up to 2486 */ /* misc status variables */ diff --git a/repair/globals.h b/repair/globals.h index 5b6fe4d4..929b82be 100644 --- a/repair/globals.h +++ b/repair/globals.h @@ -90,6 +90,7 @@ extern int rt_spec; /* Realtime dev specified as option */ extern int convert_lazy_count; /* Convert lazy-count mode on/off */ extern int lazy_count; /* What to set if to if converting */ extern bool add_inobtcount; /* add inode btree counts to AGI */ +extern bool add_bigtime; /* add support for timestamps up to 2486 */ /* misc status variables */ diff --git a/repair/phase2.c b/repair/phase2.c index 96074a1d..cb9adf1d 100644 --- a/repair/phase2.c +++ b/repair/phase2.c @@ -158,6 +158,27 @@ set_inobtcount( return true; } +static bool +set_bigtime( + struct xfs_mount *mp) +{ + if (!xfs_sb_version_hascrc(&mp->m_sb)) { + printf( + _("Large timestamp feature only supported on V5 filesystems.\n")); + exit(0); + } + + if (xfs_sb_version_hasbigtime(&mp->m_sb)) { + printf(_("Filesystem already supports large timestamps.\n")); + exit(0); + } + + printf(_("Adding large timestamp support to filesystem.\n")); + mp->m_sb.sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR | + XFS_SB_FEAT_INCOMPAT_BIGTIME); + return true; +} + /* Perform the user's requested upgrades on filesystem. */ static void upgrade_filesystem( @@ -169,6 +190,8 @@ upgrade_filesystem( if (add_inobtcount) dirty |= set_inobtcount(mp); + if (add_bigtime) + dirty |= set_bigtime(mp); if (no_modify || !dirty) return; diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c index 2d9dca6b..e6c29dca 100644 --- a/repair/xfs_repair.c +++ b/repair/xfs_repair.c @@ -66,12 +66,14 @@ static char *o_opts[] = { enum c_opt_nums { CONVERT_LAZY_COUNT = 0, CONVERT_INOBTCOUNT, + CONVERT_BIGTIME, C_MAX_OPTS, }; static char *c_opts[] = { [CONVERT_LAZY_COUNT] = "lazycount", [CONVERT_INOBTCOUNT] = "inobtcount", + [CONVERT_BIGTIME] = "bigtime", [C_MAX_OPTS] = NULL, }; @@ -313,6 +315,15 @@ process_args(int argc, char **argv) _("-c inobtcount only supports upgrades\n")); add_inobtcount = true; break; + case CONVERT_BIGTIME: + if (!val) + do_abort( + _("-c bigtime requires a parameter\n")); + if (strtol(val, NULL, 0) != 1) + do_abort( + _("-c bigtime only supports upgrades\n")); + add_bigtime = true; + break; default: unknown('c', val); break;