linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Babu R <chandanrlinux@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: Chandan Babu R <chandanrlinux@gmail.com>, djwong@kernel.org
Subject: [PATCH V2 12/12] xfsprogs: Add extcnt64bit mkfs option
Date: Mon, 26 Jul 2021 17:17:24 +0530	[thread overview]
Message-ID: <20210726114724.24956-13-chandanrlinux@gmail.com> (raw)
In-Reply-To: <20210726114724.24956-1-chandanrlinux@gmail.com>

Enabling extcnt64bit option on mkfs.xfs command line extends the maximum
values of inode data and attr fork extent counters to 2^48 - 1 and 2^32 - 1
respectively.  This also sets the XFS_SB_FEAT_INCOMPAT_EXTCOUNT_64BIT incompat
flag on the superblock preventing older kernels from mounting such a
filesystem.

Signed-off-by: Chandan Babu R <chandanrlinux@gmail.com>
---
 man/man8/mkfs.xfs.8 |  7 +++++++
 mkfs/xfs_mkfs.c     | 23 +++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/man/man8/mkfs.xfs.8 b/man/man8/mkfs.xfs.8
index 0e06e5bea..e20f6f475 100644
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -650,6 +650,13 @@ space over time such that no free extents are large enough to
 accommodate a chunk of 64 inodes. Without this feature enabled, inode
 allocations can fail with out of space errors under severe fragmented
 free space conditions.
+.TP
+.BI extcnt64bit[= value]
+Extend maximum values of inode data and attr fork extent counters from 2^31 -
+1 and 2^15 - 1 to 2^48 - 1 and 2^32 - 1 respectively. If the value is
+omitted, 1 is assumed. This feature is disabled by default. This feature is
+only available for filesystems formatted with -m crc=1.
+.TP
 .RE
 .PP
 .PD 0
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 33b27b1f5..ac2b43188 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -78,6 +78,7 @@ enum {
 	I_ATTR,
 	I_PROJID32BIT,
 	I_SPINODES,
+	I_EXTCNT_64BIT,
 	I_MAX_OPTS,
 };
 
@@ -433,6 +434,7 @@ static struct opt_params iopts = {
 		[I_ATTR] = "attr",
 		[I_PROJID32BIT] = "projid32bit",
 		[I_SPINODES] = "sparse",
+		[I_EXTCNT_64BIT] = "extcnt64bit",
 	},
 	.subopt_params = {
 		{ .index = I_ALIGN,
@@ -481,6 +483,12 @@ static struct opt_params iopts = {
 		  .maxval = 1,
 		  .defaultval = 1,
 		},
+		{ .index = I_EXTCNT_64BIT,
+		  .conflicts = { { NULL, LAST_CONFLICT } },
+		  .minval = 0,
+		  .maxval = 1,
+		  .defaultval = 1,
+		}
 	},
 };
 
@@ -813,6 +821,7 @@ struct sb_feat_args {
 	bool	metadir;		/* XFS_SB_FEAT_INCOMPAT_METADIR */
 	bool	nodalign;
 	bool	nortalign;
+	bool	extcnt64bit;
 };
 
 struct cli_params {
@@ -1594,6 +1603,9 @@ inode_opts_parser(
 	case I_SPINODES:
 		cli->sb_feat.spinodes = getnum(value, opts, subopt);
 		break;
+	case I_EXTCNT_64BIT:
+		cli->sb_feat.extcnt64bit = getnum(value, opts, subopt);
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -2172,6 +2184,14 @@ _("metadata directory not supported without CRC support\n"));
 			usage();
 		}
 		cli->sb_feat.metadir = false;
+
+		if (cli->sb_feat.extcnt64bit &&
+			cli_opt_set(&iopts, I_EXTCNT_64BIT)) {
+			fprintf(stderr,
+_("64 bit extent count not supported without CRC support\n"));
+			usage();
+		}
+		cli->sb_feat.extcnt64bit = false;
 	}
 
 	if (!cli->sb_feat.finobt) {
@@ -3166,6 +3186,8 @@ sb_set_features(
 		sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_SPINODES;
 	}
 
+	if (fp->extcnt64bit)
+		sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_EXTCOUNT_64BIT;
 }
 
 /*
@@ -3876,6 +3898,7 @@ main(
 			.nodalign = false,
 			.nortalign = false,
 			.bigtime = false,
+			.extcnt64bit = false,
 		},
 	};
 
-- 
2.30.2


      parent reply	other threads:[~2021-07-26 11:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 11:47 [PATCH V2 00/12] xfsprogs: Extend per-inode extent counters Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 01/12] xfsprogs: Move extent count limits to xfs_format.h Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 02/12] xfsprogs: Rename MAXEXTNUM, MAXAEXTNUM to XFS_IFORK_EXTCNT_MAXS32, XFS_IFORK_EXTCNT_MAXS16 Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 03/12] xfsprogs: Introduce xfs_iext_max() helper Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 04/12] xfsprogs: Use xfs_extnum_t instead of basic data types Chandan Babu R
2021-07-27 23:11   ` Darrick J. Wong
2021-07-26 11:47 ` [PATCH V2 05/12] xfsprogs: Introduce xfs_dfork_nextents() helper Chandan Babu R
2021-07-27 23:14   ` Darrick J. Wong
2021-07-28  7:34     ` Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 06/12] xfsprogs: xfs_dfork_nextents: Return extent count via an out argument Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 07/12] xfsprogs: Rename inode's extent counter fields based on their width Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 08/12] xfsprogs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively Chandan Babu R
2021-07-27 23:15   ` Darrick J. Wong
2021-07-26 11:47 ` [PATCH V2 09/12] xfsprogs: Rename XFS_IOC_BULKSTAT to XFS_IOC_BULKSTAT_V5 Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 10/12] xfsprogs: Enable bulkstat ioctl to support 64-bit extent counters Chandan Babu R
2021-07-26 11:47 ` [PATCH V2 11/12] xfsprogs: Extend per-inode extent counter widths Chandan Babu R
2021-07-28 19:11   ` Darrick J. Wong
2021-07-29  7:26     ` Chandan Babu R
2021-07-26 11:47 ` Chandan Babu R [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210726114724.24956-13-chandanrlinux@gmail.com \
    --to=chandanrlinux@gmail.com \
    --cc=djwong@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).