Blame SOURCES/xfsprogs-5.12.0-default-bigtime-inobtcnt-on.patch

01ed80
--- xfsprogs-5.12.0.orig/man/man8/mkfs.xfs.8
01ed80
+++ xfsprogs-5.12.0/man/man8/mkfs.xfs.8
01ed80
@@ -203,7 +203,7 @@ December 1901 to January 2038, and quota
01ed80
 .IP
01ed80
 By default,
01ed80
 .B mkfs.xfs
01ed80
-will not enable this feature.
01ed80
+in RHEL9 will enable this feature.
01ed80
 If the option
01ed80
 .B \-m crc=0
01ed80
 is used, the large timestamp feature is not supported and is disabled.
01ed80
@@ -256,7 +256,7 @@ This can be used to reduce mount times w
01ed80
 .IP
01ed80
 By default,
01ed80
 .B mkfs.xfs
01ed80
-will not enable this option.
01ed80
+in RHEL9 will enable this option.
01ed80
 This feature is only available for filesystems created with the (default)
01ed80
 .B \-m finobt=1
01ed80
 option set.
01ed80
--- xfsprogs-5.12.0.orig/mkfs/xfs_mkfs.c
01ed80
+++ xfsprogs-5.12.0/mkfs/xfs_mkfs.c
01ed80
@@ -3795,6 +3797,23 @@ cfgfile_parse(
01ed80
 		cli->cfgfile);
01ed80
 }
01ed80
 
01ed80
+static unsigned int get_system_kver(void)
01ed80
+{
01ed80
+	const char *kver = getenv("KVER");
01ed80
+	struct utsname utsname;
01ed80
+	int a, b, c;
01ed80
+
01ed80
+	if (!kver) {
01ed80
+		uname(&utsname);
01ed80
+		kver = utsname.release;
01ed80
+	}
01ed80
+
01ed80
+	if (sscanf(kver, "%d.%d.%d", &a, &b, &c) != 3)
01ed80
+		return LINUX_VERSION_CODE;
01ed80
+
01ed80
+	return KERNEL_VERSION(a,b,c);
01ed80
+}
01ed80
+
01ed80
 int
01ed80
 main(
01ed80
 	int			argc,
01ed80
@@ -3848,17 +3867,25 @@ main(
01ed80
 			.spinodes = true,
01ed80
 			.rmapbt = false,
01ed80
 			.reflink = true,
01ed80
-			.inobtcnt = false,
01ed80
+			.inobtcnt = true,
01ed80
 			.parent_pointers = false,
01ed80
 			.nodalign = false,
01ed80
 			.nortalign = false,
01ed80
-			.bigtime = false,
01ed80
+			.bigtime = true,
01ed80
 		},
01ed80
 	};
01ed80
 
01ed80
 	struct list_head	buffer_list;
01ed80
+	unsigned int		kver;
01ed80
 	int			error;
01ed80
 
01ed80
+	/* turn bigtime & inobtcnt back off if running under older kernels */
01ed80
+	kver = get_system_kver();
01ed80
+	if (kver < KERNEL_VERSION(5,10,0)) {
01ed80
+		dft.sb_feat.inobtcnt = false;
01ed80
+		dft.sb_feat.bigtime = false;
01ed80
+	}
01ed80
+
01ed80
 	platform_uuid_generate(&cli.uuid);
01ed80
 	progname = basename(argv[0]);
01ed80
 	setlocale(LC_ALL, "");
9eeddb
--- xfsprogs-5.14.0/mkfs/xfs_mkfs.c.orig
9eeddb
+++ xfsprogs-5.14.0/mkfs/xfs_mkfs.c
9eeddb
@@ -12,6 +12,8 @@
9eeddb
 #include "libfrog/convert.h"
9eeddb
 #include "proto.h"
9eeddb
 #include <ini.h>
9eeddb
+#include <linux/version.h>
9eeddb
+#include <sys/utsname.h>
9eeddb
9eeddb
 #define TERABYTES(count, blog)	((uint64_t)(count) << (40 - (blog)))
9eeddb
 #define GIGABYTES(count, blog)	((uint64_t)(count) << (30 - (blog)))