Whamcloud - gitweb
LU-14659 test: improve generate_uneven_mdts() in sanity.sh
[fs/lustre-release.git] / lustre / mdt / mdt_mds.c
index d7408b1..85b5b13 100644 (file)
@@ -60,7 +60,6 @@ struct mds_device {
        struct ptlrpc_service   *mds_regular_service;
        struct ptlrpc_service   *mds_readpage_service;
        struct ptlrpc_service   *mds_out_service;
-       struct ptlrpc_service   *mds_setattr_service;
        struct ptlrpc_service   *mds_mdsc_service;
        struct ptlrpc_service   *mds_mdss_service;
        struct ptlrpc_service   *mds_fld_service;
@@ -116,22 +115,6 @@ module_param(mds_rdpg_num_cpts, charp, 0444);
 MODULE_PARM_DESC(mds_rdpg_num_cpts,
                 "CPU partitions MDS readpage threads should run on");
 
-/* NB: these two should be removed along with setattr service in the future */
-static unsigned long mds_attr_num_threads;
-module_param(mds_attr_num_threads, ulong, 0444);
-MODULE_PARM_DESC(mds_attr_num_threads,
-                "number of MDS setattr service threads to start");
-
-static unsigned int mds_attr_cpu_bind = 1;
-module_param(mds_attr_cpu_bind, uint, 0444);
-MODULE_PARM_DESC(mds_attr_cpu_bind,
-                "bind MDS setattr threads to particular CPU partitions");
-
-static char *mds_attr_num_cpts;
-module_param(mds_attr_num_cpts, charp, 0444);
-MODULE_PARM_DESC(mds_attr_num_cpts,
-                "CPU partitions MDS setattr threads should run on");
-
 /* device init/fini methods */
 static void mds_stop_ptlrpc_service(struct mds_device *m)
 {
@@ -150,10 +133,6 @@ static void mds_stop_ptlrpc_service(struct mds_device *m)
                ptlrpc_unregister_service(m->mds_out_service);
                m->mds_out_service = NULL;
        }
-       if (m->mds_setattr_service != NULL) {
-               ptlrpc_unregister_service(m->mds_setattr_service);
-               m->mds_setattr_service = NULL;
-       }
        if (m->mds_mdsc_service != NULL) {
                ptlrpc_unregister_service(m->mds_mdsc_service);
                m->mds_mdsc_service = NULL;
@@ -282,55 +261,6 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
                GOTO(err_mds_svc, rc);
        }
 
-       /*
-        * setattr service configuration.
-        *
-        * XXX To keep the compatibility with old client(< 2.2), we need to
-        * preserve this portal for a certain time, it should be removed
-        * eventually. LU-617.
-        */
-       memset(&conf, 0, sizeof(conf));
-       conf = (typeof(conf)) {
-               .psc_name               = LUSTRE_MDT_NAME "_setattr",
-               .psc_watchdog_factor    = MDT_SERVICE_WATCHDOG_FACTOR,
-               .psc_buf                = {
-                       .bc_nbufs               = MDS_NBUFS,
-                       .bc_buf_size            = MDS_BUFSIZE,
-                       .bc_req_max_size        = MDS_MAXREQSIZE,
-                       .bc_rep_max_size        = MDS_LOV_MAXREPSIZE,
-                       .bc_req_portal          = MDS_SETATTR_PORTAL,
-                       .bc_rep_portal          = MDC_REPLY_PORTAL,
-               },
-               .psc_thr                = {
-                       .tc_thr_name            = LUSTRE_MDT_NAME "_attr",
-                       .tc_thr_factor          = MDS_SETA_THR_FACTOR,
-                       .tc_nthrs_init          = MDS_SETA_NTHRS_INIT,
-                       .tc_nthrs_base          = MDS_SETA_NTHRS_BASE,
-                       .tc_nthrs_max           = MDS_SETA_NTHRS_MAX,
-                       .tc_nthrs_user          = mds_attr_num_threads,
-                       .tc_cpu_bind            = mds_attr_cpu_bind,
-                       .tc_ctx_tags            = LCT_MD_THREAD,
-               },
-               .psc_cpt                = {
-                       .cc_pattern             = mds_attr_num_cpts,
-                       .cc_affinity            = true,
-               },
-               .psc_ops                = {
-                       .so_req_handler         = tgt_request_handle,
-                       .so_req_printer         = target_print_req,
-                       .so_hpreq_handler       = NULL,
-               },
-       };
-       m->mds_setattr_service = ptlrpc_register_service(&conf, &obd->obd_kset,
-                                                        obd->obd_debugfs_entry);
-       if (IS_ERR(m->mds_setattr_service)) {
-               rc = PTR_ERR(m->mds_setattr_service);
-               CERROR("failed to start setattr service: %d\n", rc);
-               m->mds_setattr_service = NULL;
-
-               GOTO(err_mds_svc, rc);
-       }
-
        /* Object update service */
        conf = (typeof(conf)) {
                .psc_name               = LUSTRE_MDT_NAME "_out",
@@ -487,10 +417,10 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
        }
 
 
-       mask = cfs_cpt_nodemask(cfs_cpt_table, CFS_CPT_ANY);
+       mask = cfs_cpt_nodemask(cfs_cpt_tab, CFS_CPT_ANY);
        /* event CPT feature is disabled in libcfs level by set partition
         * number to 1, we still want to set node affinity for io service */
-       if (cfs_cpt_number(cfs_cpt_table) == 1 && nodes_weight(*mask) > 1) {
+       if (cfs_cpt_number(cfs_cpt_tab) == 1 && nodes_weight(*mask) > 1) {
                int cpt = 0;
                int i;
 
@@ -503,8 +433,8 @@ static int mds_start_ptlrpc_service(struct mds_device *m)
 
                        rc = cfs_cpt_set_node(mdt_io_cptable, cpt++, i);
                        if (!rc) {
-                               CWARN("MDS Failed to set node %d for"
-                                     "IO CPT table\n", i);
+                               CWARN("MDS Failed to set node %d for IO CPT table\n",
+                                     i);
                                cfs_cpt_table_free(mdt_io_cptable);
                                mdt_io_cptable = NULL;
                                break;
@@ -567,7 +497,7 @@ err_mds_svc:
 
 static inline struct mds_device *mds_dev(struct lu_device *d)
 {
-       return container_of0(d, struct mds_device, mds_md_dev.md_lu_dev);
+       return container_of_safe(d, struct mds_device, mds_md_dev.md_lu_dev);
 }
 
 static struct lu_device *mds_device_fini(const struct lu_env *env,
@@ -638,7 +568,7 @@ static struct lu_device *mds_device_alloc(const struct lu_env *env,
 /* type constructor/destructor: mdt_type_init, mdt_type_fini */
 LU_TYPE_INIT_FINI(mds, &mdt_thread_key);
 
-static struct lu_device_type_operations mds_device_type_ops = {
+static const struct lu_device_type_operations mds_device_type_ops = {
        .ldto_init = mds_type_init,
        .ldto_fini = mds_type_fini,
 
@@ -667,7 +597,6 @@ static int mds_health_check(const struct lu_env *env, struct obd_device *obd)
        rc |= ptlrpc_service_health_check(mds->mds_regular_service);
        rc |= ptlrpc_service_health_check(mds->mds_readpage_service);
        rc |= ptlrpc_service_health_check(mds->mds_out_service);
-       rc |= ptlrpc_service_health_check(mds->mds_setattr_service);
        rc |= ptlrpc_service_health_check(mds->mds_mdsc_service);
        rc |= ptlrpc_service_health_check(mds->mds_mdss_service);
        rc |= ptlrpc_service_health_check(mds->mds_fld_service);
@@ -677,14 +606,14 @@ static int mds_health_check(const struct lu_env *env, struct obd_device *obd)
        return rc != 0 ? 1 : 0;
 }
 
-static struct obd_ops mds_obd_device_ops = {
+static const struct obd_ops mds_obd_device_ops = {
        .o_owner           = THIS_MODULE,
        .o_health_check    = mds_health_check,
 };
 
 int mds_mod_init(void)
 {
-       return class_register_type(&mds_obd_device_ops, NULL, false, NULL,
+       return class_register_type(&mds_obd_device_ops, NULL, false,
                                   LUSTRE_MDS_NAME, &mds_device_type);
 }