@@ -605,8 +605,7 @@ xfs_scrub_metadata(
if (error)
goto out;
- xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SCRUB,
- "EXPERIMENTAL online scrub feature in use. Use at your own risk!");
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_SCRUB);
sc = kzalloc(sizeof(struct xfs_scrub), XCHK_GFP_FLAGS);
if (!sc) {
@@ -162,9 +162,7 @@ xfs_growfs_data_private(
error = xfs_resizefs_init_new_ags(tp, &id, oagcount, nagcount,
delta, last_pag, &lastag_extended);
} else {
- xfs_warn_mount(mp, XFS_OPSTATE_WARNED_SHRINK,
- "EXPERIMENTAL online shrink feature in use. Use at your own risk!");
-
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_SHRINK);
error = xfs_ag_shrink_space(last_pag, &tp, -delta);
}
xfs_perag_put(last_pag);
@@ -131,3 +131,46 @@ xfs_buf_alert_ratelimited(
__xfs_printk(KERN_ALERT, mp, &vaf);
va_end(args);
}
+
+void
+xfs_warn_experimental(
+ struct xfs_mount *mp,
+ enum xfs_experimental_feat feat)
+{
+ static const struct {
+ const char *name;
+ long opstate;
+ } features[] = {
+ [XFS_EXPERIMENTAL_SCRUB] = {
+ .opstate = XFS_OPSTATE_WARNED_SCRUB,
+ .name = "online scrub",
+ },
+ [XFS_EXPERIMENTAL_SHRINK] = {
+ .opstate = XFS_OPSTATE_WARNED_SHRINK,
+ .name = "online shrink",
+ },
+ [XFS_EXPERIMENTAL_LARP] = {
+ .opstate = XFS_OPSTATE_WARNED_LARP,
+ .name = "logged extended attributes",
+ },
+ [XFS_EXPERIMENTAL_LBS] = {
+ .opstate = XFS_OPSTATE_WARNED_LBS,
+ .name = "large block size",
+ },
+ [XFS_EXPERIMENTAL_EXCHRANGE] = {
+ .opstate = XFS_OPSTATE_WARNED_EXCHRANGE,
+ .name = "exchange range",
+ },
+ [XFS_EXPERIMENTAL_PPTR] = {
+ .opstate = XFS_OPSTATE_WARNED_PPTR,
+ .name = "parent pointer",
+ },
+ };
+ ASSERT(feat >= 0 && feat < XFS_EXPERIMENTAL_MAX);
+ BUILD_BUG_ON(ARRAY_SIZE(features) != XFS_EXPERIMENTAL_MAX);
+
+ if (xfs_should_warn(mp, features[feat].opstate))
+ xfs_warn(mp,
+ "EXPERIMENTAL %s feature enabled. Use at your own risk!",
+ features[feat].name);
+}
@@ -75,12 +75,6 @@ do { \
#define xfs_debug_ratelimited(dev, fmt, ...) \
xfs_printk_ratelimited(xfs_debug, dev, fmt, ##__VA_ARGS__)
-#define xfs_warn_mount(mp, warntag, fmt, ...) \
-do { \
- if (xfs_should_warn((mp), (warntag))) \
- xfs_warn((mp), (fmt), ##__VA_ARGS__); \
-} while (0)
-
#define xfs_warn_once(dev, fmt, ...) \
xfs_printk_once(xfs_warn, dev, fmt, ##__VA_ARGS__)
#define xfs_notice_once(dev, fmt, ...) \
@@ -96,4 +90,16 @@ extern void xfs_hex_dump(const void *p, int length);
void xfs_buf_alert_ratelimited(struct xfs_buf *bp, const char *rlmsg,
const char *fmt, ...);
+enum xfs_experimental_feat {
+ XFS_EXPERIMENTAL_SCRUB,
+ XFS_EXPERIMENTAL_SHRINK,
+ XFS_EXPERIMENTAL_LARP,
+ XFS_EXPERIMENTAL_LBS,
+ XFS_EXPERIMENTAL_EXCHRANGE,
+ XFS_EXPERIMENTAL_PPTR,
+
+ XFS_EXPERIMENTAL_MAX,
+};
+void xfs_warn_experimental(struct xfs_mount *mp, enum xfs_experimental_feat f);
+
#endif /* __XFS_MESSAGE_H */
@@ -479,6 +479,12 @@ __XFS_HAS_FEAT(nouuid, NOUUID)
#define XFS_OPSTATE_UNSET_LOG_INCOMPAT 11
/* Filesystem can use logged extended attributes */
#define XFS_OPSTATE_USE_LARP 12
+/* Kernel has logged a warning about blocksize > pagesize on this fs. */
+#define XFS_OPSTATE_WARNED_LBS 13
+/* Kernel has logged a warning about exchange-range being used on this fs. */
+#define XFS_OPSTATE_WARNED_EXCHRANGE 14
+/* Kernel has logged a warning about parent pointers being used on this fs. */
+#define XFS_OPSTATE_WARNED_PPTR 15
#define __XFS_IS_OPSTATE(name, NAME) \
static inline bool xfs_is_ ## name (struct xfs_mount *mp) \
@@ -1657,9 +1657,7 @@ xfs_fs_fill_super(
goto out_free_sb;
}
- xfs_warn(mp,
-"EXPERIMENTAL: V5 Filesystem with Large Block Size (%d bytes) enabled.",
- mp->m_sb.sb_blocksize);
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_LBS);
}
/* Ensure this filesystem fits in the page cache limits */
@@ -1755,12 +1753,10 @@ xfs_fs_fill_super(
}
if (xfs_has_exchange_range(mp))
- xfs_warn(mp,
- "EXPERIMENTAL exchange-range feature enabled. Use at your own risk!");
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_EXCHRANGE);
if (xfs_has_parent(mp))
- xfs_warn(mp,
- "EXPERIMENTAL parent pointer feature enabled. Use at your own risk!");
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_PPTR);
error = xfs_mountfs(mp);
if (error)
@@ -51,8 +51,7 @@ xfs_attr_grab_log_assist(
return error;
xfs_set_using_logged_xattrs(mp);
- xfs_warn_mount(mp, XFS_OPSTATE_WARNED_LARP,
- "EXPERIMENTAL logged extended attributes feature in use. Use at your own risk!");
+ xfs_warn_experimental(mp, XFS_EXPERIMENTAL_LARP);
return 0;
}