staging: lustre: obd: add case LCFG_PARAM to osd_process_config
authorEmoly Liu <emoly.liu@intel.com>
Thu, 28 Apr 2016 16:07:36 +0000 (12:07 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Apr 2016 04:55:26 +0000 (21:55 -0700)
Some proc parameters were moved from ofd to osd module and only
their symlinks were kept in ofd for interoperability/compatibility.
To process this kind of config params passed by ofd, this patch is
to do the following fixes:

 - since these parameters are not included by the static lprocfs var
   list, a pre-check is added for them to avoid "unknown param" error
   message confuses the uses. If they are matched in this check, they
   will be passed to the osd directly.
 - improve the error messages in class_process_proc_param() and
   class_process_proc_seq_param() a little.

Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4221
Reviewed-on: http://review.whamcloud.com/8238
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre_param.h
drivers/staging/lustre/lustre/obdclass/obd_config.c

index 383fe6febe4ba874f98684c7ea2d7e21f207867d..a42cf90c1cd8d8b401da13c9a756dcf23cd22a1b 100644 (file)
@@ -89,6 +89,7 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char **endh);
 
 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
 #define PARAM_OST                "ost."
+#define PARAM_OSD              "osd."
 #define PARAM_OSC                "osc."
 #define PARAM_MDT                "mdt."
 #define PARAM_MDD                "mdd."
index a3a2abc1a81eefc0879fb562854c973d56c6d404..cb1d65c3d95d92be145a38418dd50593bdff9bfd 100644 (file)
@@ -1000,7 +1000,13 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
        for (i = 1; i < lcfg->lcfg_bufcount; i++) {
                key = lustre_cfg_buf(lcfg, i);
                /* Strip off prefix */
-               class_match_param(key, prefix, &key);
+               if (class_match_param(key, prefix, &key)) {
+                       /*
+                        * If the prefix doesn't match, return error so we
+                        * can pass it down the stack
+                        */
+                       return -ENOSYS;
+               }
                sval = strchr(key, '=');
                if (!sval || (*(sval + 1) == 0)) {
                        CERROR("Can't parse param %s (missing '=')\n", key);
@@ -1033,18 +1039,14 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars,
                        j++;
                }
                if (!matched) {
-                       /* If the prefix doesn't match, return error so we
-                        * can pass it down the stack
-                        */
-                       if (strnchr(key, keylen, '.'))
-                               return -ENOSYS;
-                       CERROR("%s: unknown param %s\n",
+                       CERROR("%.*s: %s unknown param %s\n",
+                              (int)strlen(prefix) - 1, prefix,
                               (char *)lustre_cfg_string(lcfg, 0), key);
                        /* rc = -EINVAL;        continue parsing other params */
                        skip++;
                } else if (rc < 0) {
-                       CERROR("writing proc entry %s err %d\n",
-                              var->name, rc);
+                       CERROR("%s: error writing proc entry '%s': rc = %d\n",
+                              prefix, var->name, rc);
                        rc = 0;
                } else {
                        CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n",