Whamcloud - gitweb
LU-8837 lod: move lod-specifc pool config code into lod_dev 93/41993/4
authorMr NeilBrown <neilb@suse.de>
Fri, 8 Jan 2021 03:23:01 +0000 (14:23 +1100)
committerOleg Drokin <green@whamcloud.com>
Tue, 30 Mar 2021 04:16:54 +0000 (04:16 +0000)
obd_config.c contains code that only applies to lod devices, for
managing a QMT pool along-side each normal pool.

As this code is specific to lod, it is best to move it into the lod
module.  This is particularly helpful as it removes it from
client-only builds.

Test-Parameters: trivial
Signed-off-by: Mr NeilBrown <neilb@suse.de>
Change-Id: I9e0d014a299c28b73e48ce2e06581cb011acce47
Reviewed-on: https://review.whamcloud.com/41993
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/lod/lod_dev.c
lustre/obdclass/obd_config.c

index d64a604..fd24323 100644 (file)
@@ -2202,16 +2202,84 @@ static int lod_obd_set_info_async(const struct lu_env *env,
        RETURN(rc);
 }
 
+
+#define QMT0_DEV_NAME_LEN (LUSTRE_MAXFSNAME + sizeof("-QMT0000"))
+static struct obd_device *obd_find_qmt0(char *obd_name)
+{
+       char qmt_name[QMT0_DEV_NAME_LEN];
+       struct obd_device *qmt = NULL;
+
+       if (!server_name2fsname(obd_name, qmt_name, NULL)) {
+               strlcat(qmt_name, "-QMT0000", QMT0_DEV_NAME_LEN);
+               qmt = class_name2obd(qmt_name);
+       }
+
+       return qmt;
+}
+
+static int lod_pool_new_q(struct obd_device *obd, char *poolname)
+{
+       int err = lod_pool_new(obd, poolname);
+
+       if (!err) {
+               obd = obd_find_qmt0(obd->obd_name);
+               if (obd)
+                       obd_pool_new(obd, poolname);
+       }
+
+       return err;
+}
+
+static int lod_pool_remove_q(struct obd_device *obd, char *poolname,
+                            char *ostname)
+{
+       int err = lod_pool_remove(obd, poolname, ostname);
+
+       if (!err) {
+               obd = obd_find_qmt0(obd->obd_name);
+               if (obd)
+                       obd_pool_rem(obd, poolname, ostname);
+       }
+
+       return err;
+}
+
+static int lod_pool_add_q(struct obd_device *obd, char *poolname, char *ostname)
+{
+       int err = lod_pool_add(obd, poolname, ostname);
+
+       if (!err) {
+               obd = obd_find_qmt0(obd->obd_name);
+               if (obd)
+                       obd_pool_add(obd, poolname, ostname);
+       }
+
+       return err;
+}
+
+static int lod_pool_del_q(struct obd_device *obd, char *poolname)
+{
+       int err = lod_pool_del(obd, poolname);
+
+       if (!err) {
+               obd = obd_find_qmt0(obd->obd_name);
+               if (obd)
+                       obd_pool_del(obd, poolname);
+       }
+
+       return err;
+}
+
 static const struct obd_ops lod_obd_device_ops = {
        .o_owner        = THIS_MODULE,
        .o_connect      = lod_obd_connect,
        .o_disconnect   = lod_obd_disconnect,
        .o_get_info     = lod_obd_get_info,
        .o_set_info_async = lod_obd_set_info_async,
-       .o_pool_new     = lod_pool_new,
-       .o_pool_rem     = lod_pool_remove,
-       .o_pool_add     = lod_pool_add,
-       .o_pool_del     = lod_pool_del,
+       .o_pool_new     = lod_pool_new_q,
+       .o_pool_rem     = lod_pool_remove_q,
+       .o_pool_add     = lod_pool_add_q,
+       .o_pool_del     = lod_pool_del_q,
 };
 
 static int __init lod_init(void)
index 69ca1b4..b951063 100644 (file)
@@ -1343,20 +1343,6 @@ void lustre_register_quota_process_config(int (*qpc)(struct lustre_cfg *lcfg))
 EXPORT_SYMBOL(lustre_register_quota_process_config);
 #endif /* HAVE_SERVER_SUPPORT */
 
-#define QMT0_DEV_NAME_LEN (LUSTRE_MAXFSNAME + sizeof("-QMT0000"))
-static struct obd_device *obd_find_qmt0(char *obd_name)
-{
-       char qmt_name[QMT0_DEV_NAME_LEN];
-       struct obd_device *qmt = NULL;
-
-       if (!server_name2fsname(obd_name, qmt_name, NULL)) {
-               strlcat(qmt_name, "-QMT0000", QMT0_DEV_NAME_LEN);
-               qmt = class_name2obd(qmt_name);
-       }
-
-       return qmt;
-}
-
 /**
  * Process configuration commands given in lustre_cfg form.
  * These may come from direct calls (e.g. class_manual_cleanup)
@@ -1538,42 +1524,20 @@ int class_process_config(struct lustre_cfg *lcfg)
        }
        case LCFG_POOL_NEW: {
                err = obd_pool_new(obd, lustre_cfg_string(lcfg, 2));
-               if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
-                       obd = obd_find_qmt0(obd->obd_name);
-                       if (obd)
-                               obd_pool_new(obd, lustre_cfg_string(lcfg, 2));
-               }
                GOTO(out, err = 0);
        }
        case LCFG_POOL_ADD: {
                err = obd_pool_add(obd, lustre_cfg_string(lcfg, 2),
                                    lustre_cfg_string(lcfg, 3));
-               if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
-                       obd = obd_find_qmt0(obd->obd_name);
-                       if (obd)
-                               obd_pool_add(obd, lustre_cfg_string(lcfg, 2),
-                                            lustre_cfg_string(lcfg, 3));
-               }
                GOTO(out, err = 0);
        }
        case LCFG_POOL_REM: {
                err = obd_pool_rem(obd, lustre_cfg_string(lcfg, 2),
                                    lustre_cfg_string(lcfg, 3));
-               if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
-                       obd = obd_find_qmt0(obd->obd_name);
-                       if (obd)
-                               obd_pool_rem(obd, lustre_cfg_string(lcfg, 2),
-                                            lustre_cfg_string(lcfg, 3));
-               }
                GOTO(out, err = 0);
        }
        case LCFG_POOL_DEL: {
                err = obd_pool_del(obd, lustre_cfg_string(lcfg, 2));
-               if (!err && !strcmp(obd->obd_type->typ_name, LUSTRE_LOD_NAME)) {
-                       obd = obd_find_qmt0(obd->obd_name);
-                       if (obd)
-                               obd_pool_del(obd, lustre_cfg_string(lcfg, 2));
-               }
                GOTO(out, err = 0);
        }
        /*