linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCHSET v5 0/2] xfs_admin: support upgrading v5 filesystems
@ 2021-02-09  4:11 Darrick J. Wong
  2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
  2021-02-09  4:11 ` [PATCH 2/2] xfs_repair: enable bigtime " Darrick J. Wong
  0 siblings, 2 replies; 7+ messages in thread
From: Darrick J. Wong @ 2021-02-09  4:11 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: linux-xfs, hch, bfoster

Hi all,

This submission extends xfs_db and xfs_admin to support adding the inode
btree counter and bigtime features to an existing v5 filesystem.

v2: Rebase to 5.10-rc0
v3: respond to reviewer comments
v4: document which kernel version these new features showed up in
v5: move all the upgrader code to xfs_repair per Eric suggestion, which
    eliminates a bunch of fragile db/admin/repair coordination.

If you're going to start using this mess, you probably ought to just
pull from my git trees, which are linked below.

This is an extraordinary way to destroy everything.  Enjoy!
Comments and questions are, as always, welcome.

--D

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=fs-upgrades
---
 man/man8/xfs_admin.8 |   17 +++++++++++++++-
 repair/globals.c     |    2 ++
 repair/globals.h     |    2 ++
 repair/phase1.c      |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++
 repair/xfs_repair.c  |   22 +++++++++++++++++++++
 5 files changed, 94 insertions(+), 1 deletion(-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair
  2021-02-09  4:11 [PATCHSET v5 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
@ 2021-02-09  4:11 ` Darrick J. Wong
  2021-02-09  9:18   ` Christoph Hellwig
  2021-02-09 17:35   ` Brian Foster
  2021-02-09  4:11 ` [PATCH 2/2] xfs_repair: enable bigtime " Darrick J. Wong
  1 sibling, 2 replies; 7+ messages in thread
From: Darrick J. Wong @ 2021-02-09  4:11 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: linux-xfs, hch, bfoster

From: Darrick J. Wong <djwong@kernel.org>

Use xfs_repair to add the inode btree counter feature to a filesystem.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 man/man8/xfs_admin.8 |   11 ++++++++++-
 repair/globals.c     |    1 +
 repair/globals.h     |    1 +
 repair/phase1.c      |   29 +++++++++++++++++++++++++++++
 repair/xfs_repair.c  |   11 +++++++++++
 5 files changed, 52 insertions(+), 1 deletion(-)


diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
index 3f3aeea8..da05171d 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -126,7 +126,16 @@ without the
 .BR -n )
 must be followed to clean the filesystem.
 .IP
-There are currently no feature options.
+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 b0e23864..89063b10 100644
--- a/repair/globals.c
+++ b/repair/globals.c
@@ -51,6 +51,7 @@ int	convert_lazy_count;	/* Convert lazy-count mode on/off */
 int	lazy_count;		/* What to set if to if converting */
 
 bool	add_needsrepair;	/* forcibly set needsrepair while repairing */
+bool	add_inobtcount;		/* add inode btree counts to AGI */
 
 /* misc status variables */
 
diff --git a/repair/globals.h b/repair/globals.h
index 9fa73b2c..a0051794 100644
--- a/repair/globals.h
+++ b/repair/globals.h
@@ -93,6 +93,7 @@ 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_needsrepair;
+extern bool	add_inobtcount;
 
 /* misc status variables */
 
diff --git a/repair/phase1.c b/repair/phase1.c
index 57f72cd0..96661c6b 100644
--- a/repair/phase1.c
+++ b/repair/phase1.c
@@ -50,6 +50,33 @@ set_needsrepair(
 	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
 }
 
+static void
+set_inobtcount(
+	struct xfs_sb	*sb)
+{
+	if (!xfs_sb_version_hascrc(sb)) {
+		printf(
+	_("Inode btree count feature only supported on V5 filesystems.\n"));
+		exit(0);
+	}
+
+	if (!xfs_sb_version_hasfinobt(sb)) {
+		printf(
+	_("Inode btree count feature requires free inode btree.\n"));
+		exit(0);
+	}
+
+	if (xfs_sb_version_hasinobtcounts(sb)) {
+		printf(_("Filesystem already has inode btree counts.\n"));
+		return;
+	}
+
+	printf(_("Adding inode btree counts to filesystem.\n"));
+	primary_sb_modified = 1;
+	sb->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
+	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+}
+
 /*
  * this has got to be big enough to hold 4 sectors
  */
@@ -148,6 +175,8 @@ _("Cannot disable lazy-counters on V5 fs\n"));
 
 	if (add_needsrepair)
 		set_needsrepair(sb);
+	if (add_inobtcount)
+		set_inobtcount(sb);
 
 	/* shared_vn should be zero */
 	if (sb->sb_shared_vn) {
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index ae7106a6..0ff2e2bc 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -68,12 +68,14 @@ static char *o_opts[] = {
 enum c_opt_nums {
 	CONVERT_LAZY_COUNT = 0,
 	CONVERT_NEEDSREPAIR,
+	CONVERT_INOBTCOUNT,
 	C_MAX_OPTS,
 };
 
 static char *c_opts[] = {
 	[CONVERT_LAZY_COUNT]	= "lazycount",
 	[CONVERT_NEEDSREPAIR]	= "needsrepair",
+	[CONVERT_INOBTCOUNT]	= "inobtcount",
 	[C_MAX_OPTS]		= NULL,
 };
 
@@ -316,6 +318,15 @@ process_args(int argc, char **argv)
 					if (strtol(val, NULL, 0) == 1)
 						add_needsrepair = true;
 					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;


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] xfs_repair: enable bigtime upgrade via repair
  2021-02-09  4:11 [PATCHSET v5 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
  2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
@ 2021-02-09  4:11 ` Darrick J. Wong
  2021-02-09  9:18   ` Christoph Hellwig
  2021-02-09 17:35   ` Brian Foster
  1 sibling, 2 replies; 7+ messages in thread
From: Darrick J. Wong @ 2021-02-09  4:11 UTC (permalink / raw)
  To: sandeen, djwong; +Cc: linux-xfs, hch, bfoster

From: Darrick J. Wong <djwong@kernel.org>

Upgrade existing V5 filesystems to support large timestamps up to 2486.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 man/man8/xfs_admin.8 |    6 ++++++
 repair/globals.c     |    1 +
 repair/globals.h     |    1 +
 repair/phase1.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 da05171d..13d71643 100644
--- a/man/man8/xfs_admin.8
+++ b/man/man8/xfs_admin.8
@@ -135,6 +135,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 89063b10..28f0b6a0 100644
--- a/repair/globals.c
+++ b/repair/globals.c
@@ -52,6 +52,7 @@ int	lazy_count;		/* What to set if to if converting */
 
 bool	add_needsrepair;	/* forcibly set needsrepair while repairing */
 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 a0051794..be784cf6 100644
--- a/repair/globals.h
+++ b/repair/globals.h
@@ -94,6 +94,7 @@ extern int	lazy_count;		/* What to set if to if converting */
 
 extern bool	add_needsrepair;
 extern bool	add_inobtcount;
+extern bool	add_bigtime;
 
 /* misc status variables */
 
diff --git a/repair/phase1.c b/repair/phase1.c
index 96661c6b..89056215 100644
--- a/repair/phase1.c
+++ b/repair/phase1.c
@@ -77,6 +77,27 @@ set_inobtcount(
 	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
 }
 
+static void
+set_bigtime(
+	struct xfs_sb	*sb)
+{
+	if (!xfs_sb_version_hascrc(sb)) {
+		printf(
+	_("Large timestamp feature only supported on V5 filesystems.\n"));
+		exit(0);
+	}
+
+	if (xfs_sb_version_hasbigtime(sb)) {
+		printf(_("Filesystem already supports large timestamps.\n"));
+		return;
+	}
+
+	printf(_("Adding large timestamp support to filesystem.\n"));
+	primary_sb_modified = 1;
+	sb->sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR |
+				     XFS_SB_FEAT_INCOMPAT_BIGTIME);
+}
+
 /*
  * this has got to be big enough to hold 4 sectors
  */
@@ -177,6 +198,8 @@ _("Cannot disable lazy-counters on V5 fs\n"));
 		set_needsrepair(sb);
 	if (add_inobtcount)
 		set_inobtcount(sb);
+	if (add_bigtime)
+		set_bigtime(sb);
 
 	/* shared_vn should be zero */
 	if (sb->sb_shared_vn) {
diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
index 0ff2e2bc..60f97e8c 100644
--- a/repair/xfs_repair.c
+++ b/repair/xfs_repair.c
@@ -69,6 +69,7 @@ enum c_opt_nums {
 	CONVERT_LAZY_COUNT = 0,
 	CONVERT_NEEDSREPAIR,
 	CONVERT_INOBTCOUNT,
+	CONVERT_BIGTIME,
 	C_MAX_OPTS,
 };
 
@@ -76,6 +77,7 @@ static char *c_opts[] = {
 	[CONVERT_LAZY_COUNT]	= "lazycount",
 	[CONVERT_NEEDSREPAIR]	= "needsrepair",
 	[CONVERT_INOBTCOUNT]	= "inobtcount",
+	[CONVERT_BIGTIME]	= "bigtime",
 	[C_MAX_OPTS]		= NULL,
 };
 
@@ -327,6 +329,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;


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair
  2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
@ 2021-02-09  9:18   ` Christoph Hellwig
  2021-02-09 17:35   ` Brian Foster
  1 sibling, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2021-02-09  9:18 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch, bfoster

On Mon, Feb 08, 2021 at 08:11:08PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Use xfs_repair to add the inode btree counter feature to a filesystem.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] xfs_repair: enable bigtime upgrade via repair
  2021-02-09  4:11 ` [PATCH 2/2] xfs_repair: enable bigtime " Darrick J. Wong
@ 2021-02-09  9:18   ` Christoph Hellwig
  2021-02-09 17:35   ` Brian Foster
  1 sibling, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2021-02-09  9:18 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch, bfoster

On Mon, Feb 08, 2021 at 08:11:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Upgrade existing V5 filesystems to support large timestamps up to 2486.

Looks good,

Reviewed-by: Christoph Hellwig <hch@lst.de>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair
  2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
  2021-02-09  9:18   ` Christoph Hellwig
@ 2021-02-09 17:35   ` Brian Foster
  1 sibling, 0 replies; 7+ messages in thread
From: Brian Foster @ 2021-02-09 17:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch

On Mon, Feb 08, 2021 at 08:11:08PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Use xfs_repair to add the inode btree counter feature to a filesystem.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Modulo the same question as on the needsrepair patch around exit
behavior, both of these look Ok to me:

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  man/man8/xfs_admin.8 |   11 ++++++++++-
>  repair/globals.c     |    1 +
>  repair/globals.h     |    1 +
>  repair/phase1.c      |   29 +++++++++++++++++++++++++++++
>  repair/xfs_repair.c  |   11 +++++++++++
>  5 files changed, 52 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/man/man8/xfs_admin.8 b/man/man8/xfs_admin.8
> index 3f3aeea8..da05171d 100644
> --- a/man/man8/xfs_admin.8
> +++ b/man/man8/xfs_admin.8
> @@ -126,7 +126,16 @@ without the
>  .BR -n )
>  must be followed to clean the filesystem.
>  .IP
> -There are currently no feature options.
> +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 b0e23864..89063b10 100644
> --- a/repair/globals.c
> +++ b/repair/globals.c
> @@ -51,6 +51,7 @@ int	convert_lazy_count;	/* Convert lazy-count mode on/off */
>  int	lazy_count;		/* What to set if to if converting */
>  
>  bool	add_needsrepair;	/* forcibly set needsrepair while repairing */
> +bool	add_inobtcount;		/* add inode btree counts to AGI */
>  
>  /* misc status variables */
>  
> diff --git a/repair/globals.h b/repair/globals.h
> index 9fa73b2c..a0051794 100644
> --- a/repair/globals.h
> +++ b/repair/globals.h
> @@ -93,6 +93,7 @@ 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_needsrepair;
> +extern bool	add_inobtcount;
>  
>  /* misc status variables */
>  
> diff --git a/repair/phase1.c b/repair/phase1.c
> index 57f72cd0..96661c6b 100644
> --- a/repair/phase1.c
> +++ b/repair/phase1.c
> @@ -50,6 +50,33 @@ set_needsrepair(
>  	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
>  }
>  
> +static void
> +set_inobtcount(
> +	struct xfs_sb	*sb)
> +{
> +	if (!xfs_sb_version_hascrc(sb)) {
> +		printf(
> +	_("Inode btree count feature only supported on V5 filesystems.\n"));
> +		exit(0);
> +	}
> +
> +	if (!xfs_sb_version_hasfinobt(sb)) {
> +		printf(
> +	_("Inode btree count feature requires free inode btree.\n"));
> +		exit(0);
> +	}
> +
> +	if (xfs_sb_version_hasinobtcounts(sb)) {
> +		printf(_("Filesystem already has inode btree counts.\n"));
> +		return;
> +	}
> +
> +	printf(_("Adding inode btree counts to filesystem.\n"));
> +	primary_sb_modified = 1;
> +	sb->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_INOBTCNT;
> +	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
> +}
> +
>  /*
>   * this has got to be big enough to hold 4 sectors
>   */
> @@ -148,6 +175,8 @@ _("Cannot disable lazy-counters on V5 fs\n"));
>  
>  	if (add_needsrepair)
>  		set_needsrepair(sb);
> +	if (add_inobtcount)
> +		set_inobtcount(sb);
>  
>  	/* shared_vn should be zero */
>  	if (sb->sb_shared_vn) {
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index ae7106a6..0ff2e2bc 100644
> --- a/repair/xfs_repair.c
> +++ b/repair/xfs_repair.c
> @@ -68,12 +68,14 @@ static char *o_opts[] = {
>  enum c_opt_nums {
>  	CONVERT_LAZY_COUNT = 0,
>  	CONVERT_NEEDSREPAIR,
> +	CONVERT_INOBTCOUNT,
>  	C_MAX_OPTS,
>  };
>  
>  static char *c_opts[] = {
>  	[CONVERT_LAZY_COUNT]	= "lazycount",
>  	[CONVERT_NEEDSREPAIR]	= "needsrepair",
> +	[CONVERT_INOBTCOUNT]	= "inobtcount",
>  	[C_MAX_OPTS]		= NULL,
>  };
>  
> @@ -316,6 +318,15 @@ process_args(int argc, char **argv)
>  					if (strtol(val, NULL, 0) == 1)
>  						add_needsrepair = true;
>  					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;
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 2/2] xfs_repair: enable bigtime upgrade via repair
  2021-02-09  4:11 ` [PATCH 2/2] xfs_repair: enable bigtime " Darrick J. Wong
  2021-02-09  9:18   ` Christoph Hellwig
@ 2021-02-09 17:35   ` Brian Foster
  1 sibling, 0 replies; 7+ messages in thread
From: Brian Foster @ 2021-02-09 17:35 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: sandeen, linux-xfs, hch

On Mon, Feb 08, 2021 at 08:11:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Upgrade existing V5 filesystems to support large timestamps up to 2486.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Reviewed-by: Brian Foster <bfoster@redhat.com>

>  man/man8/xfs_admin.8 |    6 ++++++
>  repair/globals.c     |    1 +
>  repair/globals.h     |    1 +
>  repair/phase1.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 da05171d..13d71643 100644
> --- a/man/man8/xfs_admin.8
> +++ b/man/man8/xfs_admin.8
> @@ -135,6 +135,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 89063b10..28f0b6a0 100644
> --- a/repair/globals.c
> +++ b/repair/globals.c
> @@ -52,6 +52,7 @@ int	lazy_count;		/* What to set if to if converting */
>  
>  bool	add_needsrepair;	/* forcibly set needsrepair while repairing */
>  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 a0051794..be784cf6 100644
> --- a/repair/globals.h
> +++ b/repair/globals.h
> @@ -94,6 +94,7 @@ extern int	lazy_count;		/* What to set if to if converting */
>  
>  extern bool	add_needsrepair;
>  extern bool	add_inobtcount;
> +extern bool	add_bigtime;
>  
>  /* misc status variables */
>  
> diff --git a/repair/phase1.c b/repair/phase1.c
> index 96661c6b..89056215 100644
> --- a/repair/phase1.c
> +++ b/repair/phase1.c
> @@ -77,6 +77,27 @@ set_inobtcount(
>  	sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
>  }
>  
> +static void
> +set_bigtime(
> +	struct xfs_sb	*sb)
> +{
> +	if (!xfs_sb_version_hascrc(sb)) {
> +		printf(
> +	_("Large timestamp feature only supported on V5 filesystems.\n"));
> +		exit(0);
> +	}
> +
> +	if (xfs_sb_version_hasbigtime(sb)) {
> +		printf(_("Filesystem already supports large timestamps.\n"));
> +		return;
> +	}
> +
> +	printf(_("Adding large timestamp support to filesystem.\n"));
> +	primary_sb_modified = 1;
> +	sb->sb_features_incompat |= (XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR |
> +				     XFS_SB_FEAT_INCOMPAT_BIGTIME);
> +}
> +
>  /*
>   * this has got to be big enough to hold 4 sectors
>   */
> @@ -177,6 +198,8 @@ _("Cannot disable lazy-counters on V5 fs\n"));
>  		set_needsrepair(sb);
>  	if (add_inobtcount)
>  		set_inobtcount(sb);
> +	if (add_bigtime)
> +		set_bigtime(sb);
>  
>  	/* shared_vn should be zero */
>  	if (sb->sb_shared_vn) {
> diff --git a/repair/xfs_repair.c b/repair/xfs_repair.c
> index 0ff2e2bc..60f97e8c 100644
> --- a/repair/xfs_repair.c
> +++ b/repair/xfs_repair.c
> @@ -69,6 +69,7 @@ enum c_opt_nums {
>  	CONVERT_LAZY_COUNT = 0,
>  	CONVERT_NEEDSREPAIR,
>  	CONVERT_INOBTCOUNT,
> +	CONVERT_BIGTIME,
>  	C_MAX_OPTS,
>  };
>  
> @@ -76,6 +77,7 @@ static char *c_opts[] = {
>  	[CONVERT_LAZY_COUNT]	= "lazycount",
>  	[CONVERT_NEEDSREPAIR]	= "needsrepair",
>  	[CONVERT_INOBTCOUNT]	= "inobtcount",
> +	[CONVERT_BIGTIME]	= "bigtime",
>  	[C_MAX_OPTS]		= NULL,
>  };
>  
> @@ -327,6 +329,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;
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-02-09 17:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09  4:11 [PATCHSET v5 0/2] xfs_admin: support upgrading v5 filesystems Darrick J. Wong
2021-02-09  4:11 ` [PATCH 1/2] xfs_repair: enable inobtcount upgrade via repair Darrick J. Wong
2021-02-09  9:18   ` Christoph Hellwig
2021-02-09 17:35   ` Brian Foster
2021-02-09  4:11 ` [PATCH 2/2] xfs_repair: enable bigtime " Darrick J. Wong
2021-02-09  9:18   ` Christoph Hellwig
2021-02-09 17:35   ` Brian Foster

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).