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

 #define TERABYTES(count, blog)	((uint64_t)(count) << (40 - (blog)))
 #define GIGABYTES(count, blog)	((uint64_t)(count) << (30 - (blog)))