xfs: introduce metadata IO error class
authorCarlos Maiolino <cmaiolino@redhat.com>
Wed, 18 May 2016 01:01:00 +0000 (11:01 +1000)
committerDave Chinner <david@fromorbit.com>
Wed, 18 May 2016 01:01:00 +0000 (11:01 +1000)
Now we have the basic infrastructure, add the first error class so
we can build up the infrastructure in a meaningful way. Add the
metadata async write IO error class and sysfs entry, and introduce a
default configuration that matches the existing "retry forever"
behavior for async write metadata buffers.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_mount.h
fs/xfs/xfs_sysfs.c

index d639795b0310a6344b11f5c2e9af17c2a40e4346..352a5c88d7e9f19b95f85a7a8d8717151a94304b 100644 (file)
@@ -44,9 +44,11 @@ enum {
  * Error numbers define the errors that are configurable.
  */
 enum {
+       XFS_ERR_METADATA,
        XFS_ERR_CLASS_MAX,
 };
 enum {
+       XFS_ERR_DEFAULT,
        XFS_ERR_ERRNO_MAX,
 };
 
@@ -146,6 +148,7 @@ typedef struct xfs_mount {
                                                /* low free space thresholds */
        struct xfs_kobj         m_kobj;
        struct xfs_kobj         m_error_kobj;
+       struct xfs_kobj         m_error_meta_kobj;
        struct xfs_error_cfg    m_error_cfg[XFS_ERR_CLASS_MAX][XFS_ERR_ERRNO_MAX];
        struct xstats           m_stats;        /* per-fs stats */
 
index 74e39407124250d602b30e674e655c7edb58cbf3..07c95999541ecb989992f099dca53c25b2f46189 100644 (file)
@@ -399,11 +399,34 @@ int
 xfs_error_sysfs_init(
        struct xfs_mount        *mp)
 {
+       struct xfs_error_cfg    *cfg;
        int                     error;
 
        /* .../xfs/<dev>/error/ */
        error = xfs_sysfs_init(&mp->m_error_kobj, &xfs_error_ktype,
                                &mp->m_kobj, "error");
+       if (error)
+               return error;
+
+       /* .../xfs/<dev>/error/metadata/ */
+       error = xfs_sysfs_init(&mp->m_error_meta_kobj, &xfs_error_ktype,
+                               &mp->m_error_kobj, "metadata");
+       if (error)
+               goto out_error;
+
+       cfg = &mp->m_error_cfg[XFS_ERR_METADATA][XFS_ERR_DEFAULT];
+       error = xfs_sysfs_init(&cfg->kobj, &xfs_error_cfg_ktype,
+                               &mp->m_error_meta_kobj, "default");
+       if (error)
+               goto out_error_meta;
+       cfg->max_retries = -1;
+
+       return 0;
+
+out_error_meta:
+       xfs_sysfs_del(&mp->m_error_meta_kobj);
+out_error:
+       xfs_sysfs_del(&mp->m_error_kobj);
        return error;
 }
 
@@ -411,5 +434,16 @@ void
 xfs_error_sysfs_del(
        struct xfs_mount        *mp)
 {
+       struct xfs_error_cfg    *cfg;
+       int                     i, j;
+
+       for (i = 0; i < XFS_ERR_CLASS_MAX; i++) {
+               for (j = 0; j < XFS_ERR_ERRNO_MAX; j++) {
+                       cfg = &mp->m_error_cfg[i][j];
+
+                       xfs_sysfs_del(&cfg->kobj);
+               }
+       }
+       xfs_sysfs_del(&mp->m_error_meta_kobj);
        xfs_sysfs_del(&mp->m_error_kobj);
 }