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>,
	david@fromorbit.com, darrick.wong@oracle.com, bfoster@redhat.com
Subject: [PATCH 4/4] xfsprogs: Add wideextcnt mkfs option
Date: Mon, 31 Aug 2020 18:31:02 +0530	[thread overview]
Message-ID: <20200831130102.507-5-chandanrlinux@gmail.com> (raw)
In-Reply-To: <20200831130102.507-1-chandanrlinux@gmail.com>

Enabling wideextcnt option on mkfs.xfs command line causes the
filesystem inodes to have 47-bit data fork extent counters and 32-bit
attr fork extent counters. This also sets the
XFS_SB_FEAT_INCOMPAT_WIDEEXTCNT 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 9d762a43..80378722 100644
--- a/man/man8/mkfs.xfs.8
+++ b/man/man8/mkfs.xfs.8
@@ -522,6 +522,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 wideextcnt[= value]
+Extend inode data and attr fork extent counters from signed 32-bits and signed
+16-bits to unsigned 47-bits and unsigned 32-bits respectively. If the value is
+omitted, 1 is assumed. Wide extent count feature is disabled by default. This
+feature is only available for filesystems formatted with -m crc=1.
+.TP
 .RE
 .TP
 .BI \-l " log_section_options"
diff --git a/mkfs/xfs_mkfs.c b/mkfs/xfs_mkfs.c
index 2e6cd280..ff3e0705 100644
--- a/mkfs/xfs_mkfs.c
+++ b/mkfs/xfs_mkfs.c
@@ -71,6 +71,7 @@ enum {
 	I_ATTR,
 	I_PROJID32BIT,
 	I_SPINODES,
+	I_WIDEEXTCNT,
 	I_MAX_OPTS,
 };
 
@@ -383,6 +384,7 @@ static struct opt_params iopts = {
 		[I_ATTR] = "attr",
 		[I_PROJID32BIT] = "projid32bit",
 		[I_SPINODES] = "sparse",
+		[I_WIDEEXTCNT] = "wideextcnt",
 	},
 	.subopt_params = {
 		{ .index = I_ALIGN,
@@ -431,6 +433,12 @@ static struct opt_params iopts = {
 		  .maxval = 1,
 		  .defaultval = 1,
 		},
+		{ .index = I_WIDEEXTCNT,
+		  .conflicts = { { NULL, LAST_CONFLICT } },
+		  .minval = 0,
+		  .maxval = 1,
+		  .defaultval = 1,
+		}
 	},
 };
 
@@ -734,6 +742,7 @@ struct sb_feat_args {
 	bool	reflink;		/* XFS_SB_FEAT_RO_COMPAT_REFLINK */
 	bool	nodalign;
 	bool	nortalign;
+	bool	wideextcnt;
 };
 
 struct cli_params {
@@ -1469,6 +1478,9 @@ inode_opts_parser(
 	case I_SPINODES:
 		cli->sb_feat.spinodes = getnum(value, opts, subopt);
 		break;
+	case I_WIDEEXTCNT:
+		cli->sb_feat.wideextcnt = getnum(value, opts, subopt);
+		break;
 	default:
 		return -EINVAL;
 	}
@@ -1972,6 +1984,14 @@ _("reflink not supported without CRC support\n"));
 			usage();
 		}
 		cli->sb_feat.reflink = false;
+
+		if (cli->sb_feat.wideextcnt &&
+			cli_opt_set(&iopts, I_WIDEEXTCNT)) {
+			fprintf(stderr,
+_("wideextcnt inodes not supported without CRC support\n"));
+			usage();
+		}
+		cli->sb_feat.wideextcnt = false;
 	}
 
 	if ((cli->fsx.fsx_xflags & FS_XFLAG_COWEXTSIZE) &&
@@ -2953,6 +2973,8 @@ sb_set_features(
 		sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_SPINODES;
 	}
 
+	if (fp->wideextcnt)
+		sbp->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_WIDEEXTCNT;
 }
 
 /*
@@ -3608,6 +3630,7 @@ main(
 			.parent_pointers = false,
 			.nodalign = false,
 			.nortalign = false,
+			.wideextcnt = false,
 		},
 	};
 
-- 
2.28.0


      parent reply	other threads:[~2020-08-31 13:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-31 13:00 [PATCH 0/4] xfsprogs: Extend per-inode extent counters Chandan Babu R
2020-08-31 13:00 ` [PATCH 1/4] xfsprogs: Introduce xfs_iext_max() helper Chandan Babu R
2020-08-31 13:01 ` [PATCH 2/4] xfsprogs: Introduce xfs_dfork_nextents() helper Chandan Babu R
2020-08-31 20:54   ` Darrick J. Wong
2020-09-01 14:17     ` Chandan Babu R
2020-09-01 15:42       ` Darrick J. Wong
2020-08-31 13:01 ` [PATCH 3/4] xfsprogs: Extend data/attr fork extent counter width Chandan Babu R
2020-08-31 21:00   ` Darrick J. Wong
2020-09-01 14:17     ` Chandan Babu R
2020-08-31 13:01 ` 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=20200831130102.507-5-chandanrlinux@gmail.com \
    --to=chandanrlinux@gmail.com \
    --cc=bfoster@redhat.com \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --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).