The filesystem cannot be downgraded after this feature is enabled.
This upgrade can fail if any AG has less than 5% free space remaining.
This feature is not upstream yet.
+.TP 0.4i
+.B rtsb
+Write a superblock to the realtime volume to aid in identifying realtime
+volumes.
+The filesystem cannot be downgraded after this feature is enabled.
+This upgrade is only possible if the filesystem already supports rtgroups.
+This upgrade is not possible if a realtime volume has already been added to the
+filesystem.
+This feature is not upstream yet.
+.TP 0.4i
+.B rtgroups
+Create allocation groups for the realtime volume, to increase parallelism.
+This is required for reverse mapping btrees and reflink support on the realtime
+device.
+The filesystem cannot be downgraded after this feature is enabled.
+This upgrade is not possible if a realtime volume has already been added to the
+filesystem.
+This feature is not upstream yet.
.RE
.TP
.BI \-U " uuid"
bool add_rmapbt; /* add reverse mapping btrees */
bool add_parent; /* add parent pointers */
bool add_metadir; /* add metadata directory tree */
+bool add_rtsb; /* add realtime superblock */
+bool add_rtgroups; /* add realtime allocation groups */
/* misc status variables */
extern bool add_rmapbt; /* add reverse mapping btrees */
extern bool add_parent; /* add parent pointers */
extern bool add_metadir; /* add metadata directory tree */
+extern bool add_rtsb; /* add realtime superblock */
+extern bool add_rtgroups; /* add realtime allocation groups */
/* misc status variables */
return true;
}
+static bool
+set_rtsb(
+ struct xfs_mount *mp,
+ struct xfs_sb *new_sb)
+{
+ if (xfs_has_rtsb(mp)) {
+ printf(_("Filesystem already supports realtime superblock.\n"));
+ exit(0);
+ }
+
+ if (!xfs_has_rtgroups(mp) && !add_rtgroups) {
+ printf(
+ _("Realtime superblock feature only supported if realtime groups are enabled.\n"));
+ exit(0);
+ }
+
+ if (!xfs_has_crc(mp)) {
+ printf(
+ _("Realtime superblock only supported on V5 filesystems.\n"));
+ exit(0);
+ }
+
+ if (xfs_has_realtime(mp)) {
+ printf(
+ _("Realtime superblock feature cannot be added to existing realtime volumes.\n"));
+ exit(0);
+ }
+
+ printf(_("Adding realtime superblock to filesystem.\n"));
+ new_sb->sb_features_ro_compat |= XFS_SB_FEAT_RO_COMPAT_RTSB;
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+ return true;
+}
+
+static bool
+set_rtgroups(
+ struct xfs_mount *mp,
+ struct xfs_sb *new_sb)
+{
+ if (xfs_has_rtgroups(mp)) {
+ printf(_("Filesystem already supports realtime groups.\n"));
+ exit(0);
+ }
+
+ if (!xfs_has_metadir(mp) && !add_metadir) {
+ printf(
+ _("Realtime allocation group feature only supported if metadir is enabled.\n"));
+ exit(0);
+ }
+
+ if (!xfs_has_crc(mp)) {
+ printf(
+ _("Realtime allocation groups only supported on V5 filesystems.\n"));
+ exit(0);
+ }
+
+ if (xfs_has_realtime(mp)) {
+ printf(
+ _("Realtime allocation group feature cannot be added to existing realtime volumes.\n"));
+ exit(0);
+ }
+
+ printf(_("Adding realtime groups to filesystem.\n"));
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_RTGROUPS;
+ new_sb->sb_features_incompat |= XFS_SB_FEAT_INCOMPAT_NEEDSREPAIR;
+ new_sb->sb_rgcount = 0;
+ /*
+ * The allocation group size is 1TB, rounded down to the nearest rt
+ * extent.
+ */
+ new_sb->sb_rgextents =
+ (1ULL << (40 - mp->m_sb.sb_blocklog)) >> mp->m_sb.sb_rextslog;
+ return true;
+}
+
struct check_state {
struct xfs_sb sb;
uint64_t features;
dirty |= set_parent(mp, &new_sb);
if (add_metadir)
dirty |= set_metadir(mp, &new_sb);
+ if (add_rtsb)
+ dirty |= set_rtsb(mp, &new_sb);
+ if (add_rtgroups)
+ dirty |= set_rtgroups(mp, &new_sb);
if (!dirty)
return;
CONVERT_RMAPBT,
CONVERT_PARENT,
CONVERT_METADIR,
+ CONVERT_RTSB,
+ CONVERT_RTGROUPS,
C_MAX_OPTS,
};
[CONVERT_RMAPBT] = "rmapbt",
[CONVERT_PARENT] = "parent",
[CONVERT_METADIR] = "metadir",
+ [CONVERT_RTSB] = "rtsb",
+ [CONVERT_RTGROUPS] = "rtgroups",
[C_MAX_OPTS] = NULL,
};
_("-c metadir only supports upgrades\n"));
add_metadir = true;
break;
+ case CONVERT_RTSB:
+ if (!val)
+ do_abort(
+ _("-c rtsb requires a parameter\n"));
+ if (strtol(val, NULL, 0) != 1)
+ do_abort(
+ _("-c rtsb only supports upgrades\n"));
+ add_rtsb = true;
+ break;
+ case CONVERT_RTGROUPS:
+ if (!val)
+ do_abort(
+ _("-c rtgroups requires a parameter\n"));
+ if (strtol(val, NULL, 0) != 1)
+ do_abort(
+ _("-c rtgroups only supports upgrades\n"));
+ add_rtgroups = true;
+ break;
default:
unknown('c', val);
break;