@@ -156,6 +156,13 @@ data fork extent count will be 2^48 - 1, while the maximum attribute fork
extent count will be 2^32 - 1. 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.19.
+.TP 0.4i
+.B finobt
+Track free inodes through a separate free inode btree index to speed up inode
+allocation on old filesystems.
+This upgrade can fail if any AG has less than 1% free space remaining.
+The filesystem cannot be downgraded after this feature is enabled.
+This feature was added to Linux 3.16.
.RE
.TP
.BI \-U " uuid"
@@ -52,6 +52,7 @@ bool features_changed; /* did we change superblock feature bits? */
bool add_inobtcount; /* add inode btree counts to AGI */
bool add_bigtime; /* add support for timestamps up to 2486 */
bool add_nrext64;
+bool add_finobt; /* add free inode btrees */
/* misc status variables */
@@ -93,6 +93,7 @@ extern bool features_changed; /* did we change superblock feature bits? */
extern bool add_inobtcount; /* add inode btree counts to AGI */
extern bool add_bigtime; /* add support for timestamps up to 2486 */
extern bool add_nrext64;
+extern bool add_finobt; /* add free inode btrees */
/* misc status variables */
@@ -203,6 +203,28 @@ set_nrext64(
return true;
}
+static bool
+set_finobt(
+ struct xfs_mount *mp,
+ struct xfs_sb *new_sb)
+{
+ if (!xfs_has_crc(mp)) {
+ printf(
+ _("Free inode btree feature only supported on V5 filesystems.\n"));
+ exit(0);
+ }
+
+ if (xfs_has_finobt(mp)) {
+ printf(_("Filesystem already supports free inode btrees.\n"));
+ exit(0);
+ }
+
+ printf(_("Adding free inode btrees to filesystem.\n"));
+ new_sb->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_FINOBT;
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+ return true;
+}
+
struct check_state {
struct xfs_sb sb;
uint64_t features;
@@ -370,6 +392,8 @@ need_check_fs_free_space(
struct xfs_mount *mp,
const struct check_state *old)
{
+ if (xfs_has_finobt(mp) && !(old->features & XFS_FEAT_FINOBT))
+ return true;
return false;
}
@@ -445,6 +469,8 @@ upgrade_filesystem(
dirty |= set_bigtime(mp, &new_sb);
if (add_nrext64)
dirty |= set_nrext64(mp, &new_sb);
+ if (add_finobt)
+ dirty |= set_finobt(mp, &new_sb);
if (!dirty)
return;
@@ -69,6 +69,7 @@ enum c_opt_nums {
CONVERT_INOBTCOUNT,
CONVERT_BIGTIME,
CONVERT_NREXT64,
+ CONVERT_FINOBT,
C_MAX_OPTS,
};
@@ -77,6 +78,7 @@ static char *c_opts[] = {
[CONVERT_INOBTCOUNT] = "inobtcount",
[CONVERT_BIGTIME] = "bigtime",
[CONVERT_NREXT64] = "nrext64",
+ [CONVERT_FINOBT] = "finobt",
[C_MAX_OPTS] = NULL,
};
@@ -336,6 +338,15 @@ process_args(int argc, char **argv)
_("-c nrext64 only supports upgrades\n"));
add_nrext64 = true;
break;
+ case CONVERT_FINOBT:
+ if (!val)
+ do_abort(
+ _("-c finobt requires a parameter\n"));
+ if (strtol(val, NULL, 0) != 1)
+ do_abort(
+ _("-c finobt only supports upgrades\n"));
+ add_finobt = true;
+ break;
default:
unknown('c', val);
break;