xfs: Add larp debug option
authorAllison Henderson <allison.henderson@oracle.com>
Wed, 11 May 2022 07:01:22 +0000 (17:01 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 11 May 2022 07:01:22 +0000 (17:01 +1000)
This patch adds a debug option to enable log attribute replay. Eventually
this can be removed when delayed attrs becomes permanent.

Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Chandan Babu R <chandanrlinux@gmail.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/libxfs/xfs_attr.h
fs/xfs/xfs_globals.c
fs/xfs/xfs_sysctl.h
fs/xfs/xfs_sysfs.c

index 5331551d5939d67691360756b986a405b4b5b5be..78884e826ca4707e9d61da5b9ddbc3094250e72a 100644 (file)
@@ -30,7 +30,11 @@ struct xfs_attr_list_context;
 
 static inline bool xfs_has_larp(struct xfs_mount *mp)
 {
+#ifdef DEBUG
+       return xfs_globals.larp;
+#else
        return false;
+#endif
 }
 
 /*
index f62fa652c2fd248b186f021cc1dcab9c9b5f78db..4d0a98f920cad98af20238e9a8b227bd8b1fb179 100644 (file)
@@ -41,5 +41,6 @@ struct xfs_globals xfs_globals = {
 #endif
 #ifdef DEBUG
        .pwork_threads          =       -1,     /* automatic thread detection */
+       .larp                   =       false,  /* log attribute replay */
 #endif
 };
index 7692e76ead33cc42aaee60ce5bc91338c67f6b3c..f78ad6b10ea58dedb0f93773abfc5f156de08f85 100644 (file)
@@ -83,6 +83,7 @@ extern xfs_param_t    xfs_params;
 struct xfs_globals {
 #ifdef DEBUG
        int     pwork_threads;          /* parallel workqueue threads */
+       bool    larp;                   /* log attribute replay */
 #endif
        int     log_recovery_delay;     /* log recovery delay (secs) */
        int     mount_delay;            /* mount setup delay (secs) */
index 574b80c29fe16993d351f3114dff61a4e01e6b89..f7faf6e70d7f3ef31423116b5bfc95e19f8794aa 100644 (file)
@@ -228,6 +228,29 @@ pwork_threads_show(
        return sysfs_emit(buf, "%d\n", xfs_globals.pwork_threads);
 }
 XFS_SYSFS_ATTR_RW(pwork_threads);
+
+static ssize_t
+larp_store(
+       struct kobject  *kobject,
+       const char      *buf,
+       size_t          count)
+{
+       ssize_t         ret;
+
+       ret = kstrtobool(buf, &xfs_globals.larp);
+       if (ret < 0)
+               return ret;
+       return count;
+}
+
+STATIC ssize_t
+larp_show(
+       struct kobject  *kobject,
+       char            *buf)
+{
+       return snprintf(buf, PAGE_SIZE, "%d\n", xfs_globals.larp);
+}
+XFS_SYSFS_ATTR_RW(larp);
 #endif /* DEBUG */
 
 static struct attribute *xfs_dbg_attrs[] = {
@@ -237,6 +260,7 @@ static struct attribute *xfs_dbg_attrs[] = {
        ATTR_LIST(always_cow),
 #ifdef DEBUG
        ATTR_LIST(pwork_threads),
+       ATTR_LIST(larp),
 #endif
        NULL,
 };