From patchwork Tue Feb 23 03:01:30 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: 12099817 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.0 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 1D1E5C433E0 for ; Tue, 23 Feb 2021 03:02:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D158B64E4B for ; Tue, 23 Feb 2021 03:02:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231203AbhBWDBz (ORCPT ); Mon, 22 Feb 2021 22:01:55 -0500 Received: from mail.kernel.org ([198.145.29.99]:47520 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231286AbhBWDBs (ORCPT ); Mon, 22 Feb 2021 22:01:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57ADE64E6C; Tue, 23 Feb 2021 03:01:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614049291; bh=xu4I7Zho5aatS468G2ieDU6Sn9deTfMztZnfSIbgVX0=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=lrsWHtZGXAikTsL0/IoqqJkrVJqlGVQ8Ip9ReyVZzRzSG7tKqwmTodl2M8qAY5rlP dVBEuTsCYPczq6QB++Hf2ak7fLjRNUitYU1d+s2Hx5O1iHhmBZVrQVYJfsFjbex9Tz vGe4XkGgl6523TkNuO9oOClOGLibQY0CVVJg40CJYZpAdHhzXz/hQ5CjyjLRkMsAES wI5s5bmYr7CsYMSQdx3bPdPpSfXhfHyYs4wHiqUm7BYyYHlbciOQU/ASO2p3vyrrRv L+dptI/121mTc1pveVM6YSrjzz44u87V3zCoy+g7RTdkWpAARG786MuP31iAePptYn xSte6PYjeJEGw== 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: Mon, 22 Feb 2021 19:01:30 -0800 Message-ID: <161404929091.425731.465351236842105610.stgit@magnolia> In-Reply-To: <161404928523.425731.7157248967184496592.stgit@magnolia> References: <161404928523.425731.7157248967184496592.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 --- 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 Tue Feb 23 03:01:36 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: 12099825 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.0 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 CAD8DC433E9 for ; Tue, 23 Feb 2021 03:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9ADB864DF3 for ; Tue, 23 Feb 2021 03:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231284AbhBWDCW (ORCPT ); Mon, 22 Feb 2021 22:02:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:47854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbhBWDCR (ORCPT ); Mon, 22 Feb 2021 22:02:17 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0DA1864DF3; Tue, 23 Feb 2021 03:01:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614049297; bh=yeiuzjpAXFgdL80GF15iQpaXcjaySaU80aUI0GCOf3k=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=WTPgeaqEtIjq2P2lohSNjNka2Paxy0STys1XYVI6rZU7ZDUeimqyLRRbbGE6p1ZmT eOwVxPYrdfmjdoKnsCY6wekjW86ofJvwFnSFKZtCESMOu+LDyMsf0jXqXRSnmPzLTG yQymemVhIOCLg93Fmf4VTmKU9KxJ8dmvDM82uWIpKuowY+JaFYKdgVX7s23eLT0qP+ ihyhwhm1x7x6yeCcT8pbrk0oMSwROzhoahigc3y6TN5TWS/YtNQSSKFr2z8U5A2Ibb lkU/n4KDuDIDj053K6lYaCCMyB5ByR11ZYuwYzKRmPcfWMPwbx8uLTrfrkxzav+95p Xe7xGis2cJkuA== Subject: [PATCH 2/5] xfs_repair: allow upgrades to v5 filesystems From: "Darrick J. Wong" To: sandeen@sandeen.net, djwong@kernel.org Cc: Brian Foster , linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Mon, 22 Feb 2021 19:01:36 -0800 Message-ID: <161404929660.425731.17886982949516193444.stgit@magnolia> In-Reply-To: <161404928523.425731.7157248967184496592.stgit@magnolia> References: <161404928523.425731.7157248967184496592.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 --- 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 Tue Feb 23 03:01:42 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: 12099821 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.0 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,URIBL_BLOCKED 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 3FEEBC433DB for ; Tue, 23 Feb 2021 03:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E898364E02 for ; Tue, 23 Feb 2021 03:02:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231286AbhBWDCS (ORCPT ); Mon, 22 Feb 2021 22:02:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:47618 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230400AbhBWDB6 (ORCPT ); Mon, 22 Feb 2021 22:01:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BD20F64E02; Tue, 23 Feb 2021 03:01:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614049302; bh=ob7Pm07fS8v/Xgevnx8Fzacgh+AxqJ9PGNz6d6P9v9c=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cA9twMdwuAyWUinX4sH1e86ARSucC8p/SkkjCQQS+i7MulmlMq/DBgltcCgUb9yKq vZGYF0ybtgL/oWj/cFvf+wAGOhjVMTlRCoFV+jzwT6q3Zp0aldp6Q40gzNalg/chKq Gijoevqov4ANjsjawMI6ct0j0I/tsyvj6HEXTbHDNPIStxIBHA9UGPIb3iwARATjDS +n/eHiwQfckg2CE3ec2BPGGciQL4DNQi997CbM16lGY68WqutOeUczCa/PwZIy56VH FZ+da/3udZzBLGu87j+WvHnuU7IaAY3WKrcXqp2Rf+kqPN4BTai4lRav9ayIAg3Ear YS4JzMYGwPjQQ== 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: Mon, 22 Feb 2021 19:01:42 -0800 Message-ID: <161404930230.425731.17349113846789217272.stgit@magnolia> In-Reply-To: <161404928523.425731.7157248967184496592.stgit@magnolia> References: <161404928523.425731.7157248967184496592.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 Tue Feb 23 03:01:48 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: 12099827 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.0 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 9137BC433E0 for ; Tue, 23 Feb 2021 03:02:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F8F764E5B for ; Tue, 23 Feb 2021 03:02:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231219AbhBWDCV (ORCPT ); Mon, 22 Feb 2021 22:02:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:47518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230411AbhBWDCE (ORCPT ); Mon, 22 Feb 2021 22:02:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77B4F64E57; Tue, 23 Feb 2021 03:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614049308; bh=+lV2hryLDyVw4bc0VOaihukklk7oaOv65zkAQzK+TpA=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=Sf8xJDc/b8pLp4tD24qpqyHnXgIL0not8QOrHbA8n/2lzzbPULiQSgzj0K9b1YZLU CTCFY+cz2ZXg3qTK5fRI81y56f1B/t4NOdt5nntGbWnoSUoorOqLeVUP5LxzSjhusM H5lLeBt61hNq42zLsKZsUFUb1R87OmMYHvjO29uhrwihnwqKnYppspy4Z75Z+GESIj PmB2BsKQl5v2G2qSSEP8f6a1nRv0bAoAPEJ5hBC5fxxsHLraMJbKGLQF8Q8HODg+tF 2xPgfIlQEeBHT24n0B7ellEA7LCp5eXzwMkBfD9SbgLdeUi2y37rHCTwZvIFavagcV jcMK9MB+Uugzg== 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 , Brian Foster , linux-xfs@vger.kernel.org, hch@lst.de, bfoster@redhat.com Date: Mon, 22 Feb 2021 19:01:48 -0800 Message-ID: <161404930804.425731.4363462062346246125.stgit@magnolia> In-Reply-To: <161404928523.425731.7157248967184496592.stgit@magnolia> References: <161404928523.425731.7157248967184496592.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 64d7607f..8a9caf15 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 Tue Feb 23 03:01:53 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: 12099831 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.0 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,URIBL_BLOCKED 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 B46E4C433E6 for ; Tue, 23 Feb 2021 03:02:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6A15464E41 for ; Tue, 23 Feb 2021 03:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbhBWDCg (ORCPT ); Mon, 22 Feb 2021 22:02:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:47962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbhBWDCf (ORCPT ); Mon, 22 Feb 2021 22:02:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2EEF764E4A; Tue, 23 Feb 2021 03:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614049314; bh=Sv2n5vKRFuNBgkj6Z8+9sm7lRorux2QTS7n5WPPwSCg=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=CWJG1XPaUyOHVMf68vybNAT1jROU1M3sbOF9u5GsuKbTumb0WGqsw3r5283bIVD2G 8BZrdPGGBuRWOoVoVGd7Iu39JKXwt0NvpqTST7VWeeeTR741BxNiR1Y57iVuEh5uiu DO2uxRbBtQVj4eTSUA7+z0+JvVKsfXwIEtwNVUWoYyFnRJX+B5bD9IMRyO+32UHUgE 7CgEkHuN2tZY3XjMp5sxRne8wKLhjghgq4XZ4pdo8ABL39W/X8EOQB8qGBuvNW+6iV iBHOOnOoM0KLAGuDNp1cWOktYHbf2BSB1EMdNB9uUF5M3QmLlTZbtrXtOjhK2/Sh84 gVNv/ginsjm6Q== 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: Mon, 22 Feb 2021 19:01:53 -0800 Message-ID: <161404931377.425731.15193003623629504162.stgit@magnolia> In-Reply-To: <161404928523.425731.7157248967184496592.stgit@magnolia> References: <161404928523.425731.7157248967184496592.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 8a9caf15..38406eea 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;