Whamcloud - gitweb
LU-2183 interop: handle deprecated quota param
authorNiu Yawei <niu@whamcloud.com>
Wed, 14 Nov 2012 03:33:33 +0000 (22:33 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 15 Nov 2012 21:38:59 +0000 (16:38 -0500)
The 'quota_type' param is deprecated now, we should ignore them
when processing config logs.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ife12d266db9ac049487217076410671685063389
Reviewed-on: http://review.whamcloud.com/4528
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Yu Jian <yujian@whamcloud.com>
lustre/include/lustre_param.h
lustre/mdt/mdt_handler.c
lustre/ofd/ofd_dev.c

index 320f641..fbafab0 100644 (file)
@@ -48,7 +48,7 @@
  * @{
  */
 
  * @{
  */
 
-/* For interoperability between 1.8 and 2.0. */
+/* For interoperability */
 struct cfg_interop_param {
        char *old_param;
        char *new_param;
 struct cfg_interop_param {
        char *old_param;
        char *new_param;
index 37ac715..0eae56f 100644 (file)
@@ -5149,10 +5149,13 @@ err_lmi:
         return (rc);
 }
 
         return (rc);
 }
 
-/* For interoperability between 1.8 and 2.0. */
+/* For interoperability, the left element is old parameter, the right one
+ * is the new version of the parameter, if some parameter is deprecated,
+ * the new version should be set as NULL. */
 static struct cfg_interop_param mdt_interop_param[] = {
        { "mdt.group_upcall",   NULL },
 static struct cfg_interop_param mdt_interop_param[] = {
        { "mdt.group_upcall",   NULL },
-       { "mdt.quota_type",     "mdd.quota_type" },
+       { "mdt.quota_type",     NULL },
+       { "mdd.quota_type",     NULL },
        { "mdt.rootsquash",     "mdt.root_squash" },
        { "mdt.nosquash_nid",   "mdt.nosquash_nids" },
        { NULL }
        { "mdt.rootsquash",     "mdt.root_squash" },
        { "mdt.nosquash_nid",   "mdt.nosquash_nids" },
        { NULL }
@@ -5165,7 +5168,7 @@ static int mdt_process_config(const struct lu_env *env,
         struct mdt_device *m = mdt_dev(d);
         struct md_device *md_next = m->mdt_child;
         struct lu_device *next = md2lu_dev(md_next);
         struct mdt_device *m = mdt_dev(d);
         struct md_device *md_next = m->mdt_child;
         struct lu_device *next = md2lu_dev(md_next);
-        int rc = 0;
+        int rc;
         ENTRY;
 
        switch (cfg->lcfg_command) {
         ENTRY;
 
        switch (cfg->lcfg_command) {
@@ -5173,7 +5176,7 @@ static int mdt_process_config(const struct lu_env *env,
                struct lprocfs_static_vars  lvars;
                struct obd_device          *obd = d->ld_obd;
 
                struct lprocfs_static_vars  lvars;
                struct obd_device          *obd = d->ld_obd;
 
-               /* For interoperability between 1.8 and 2.0. */
+               /* For interoperability */
                struct cfg_interop_param   *ptr = NULL;
                struct lustre_cfg          *old_cfg = NULL;
                char                       *param = NULL;
                struct cfg_interop_param   *ptr = NULL;
                struct lustre_cfg          *old_cfg = NULL;
                char                       *param = NULL;
@@ -5188,9 +5191,10 @@ static int mdt_process_config(const struct lu_env *env,
                ptr = class_find_old_param(param, mdt_interop_param);
                if (ptr != NULL) {
                        if (ptr->new_param == NULL) {
                ptr = class_find_old_param(param, mdt_interop_param);
                if (ptr != NULL) {
                        if (ptr->new_param == NULL) {
-                               CWARN("For 1.8 interoperability, skip this %s."
+                               rc = 0;
+                               CWARN("For interoperability, skip this %s."
                                      " It is obsolete.\n", ptr->old_param);
                                      " It is obsolete.\n", ptr->old_param);
-                                       break;
+                               break;
                        }
 
                        CWARN("Found old param %s, changed it to %s.\n",
                        }
 
                        CWARN("Found old param %s, changed it to %s.\n",
index bc26331..b315be0 100644 (file)
@@ -179,6 +179,12 @@ static void ofd_stack_fini(const struct lu_env *env, struct ofd_device *m,
        EXIT;
 }
 
        EXIT;
 }
 
+/* For interoperability, see mdt_interop_param[]. */
+static struct cfg_interop_param ofd_interop_param[] = {
+       { "ost.quota_type",     NULL },
+       { NULL }
+};
+
 /* used by MGS to process specific configurations */
 static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
                              struct lustre_cfg *cfg)
 /* used by MGS to process specific configurations */
 static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
                              struct lustre_cfg *cfg)
@@ -194,6 +200,38 @@ static int ofd_process_config(const struct lu_env *env, struct lu_device *d,
        case LCFG_PARAM: {
                struct lprocfs_static_vars lvars;
 
        case LCFG_PARAM: {
                struct lprocfs_static_vars lvars;
 
+               /* For interoperability */
+               struct cfg_interop_param   *ptr = NULL;
+               struct lustre_cfg          *old_cfg = NULL;
+               char                       *param = NULL;
+
+               param = lustre_cfg_string(cfg, 1);
+               if (param == NULL) {
+                       CERROR("param is empty\n");
+                       rc = -EINVAL;
+                       break;
+               }
+
+               ptr = class_find_old_param(param, ofd_interop_param);
+               if (ptr != NULL) {
+                       if (ptr->new_param == NULL) {
+                               rc = 0;
+                               CWARN("For interoperability, skip this %s."
+                                     " It is obsolete.\n", ptr->old_param);
+                               break;
+                       }
+
+                       CWARN("Found old param %s, changed it to %s.\n",
+                             ptr->old_param, ptr->new_param);
+
+                       old_cfg = cfg;
+                       cfg = lustre_cfg_rename(old_cfg, ptr->new_param);
+                       if (IS_ERR(cfg)) {
+                               rc = PTR_ERR(cfg);
+                               break;
+                       }
+               }
+
                lprocfs_ofd_init_vars(&lvars);
                rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, cfg,
                                              d->ld_obd);
                lprocfs_ofd_init_vars(&lvars);
                rc = class_process_proc_param(PARAM_OST, lvars.obd_vars, cfg,
                                              d->ld_obd);