Whamcloud - gitweb
LU-9679 general: add missing spaces to folded strings.
[fs/lustre-release.git] / lustre / ost / ost_handler.c
index d9cc62b..68ece80 100644 (file)
@@ -23,7 +23,7 @@
  * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2017, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -51,14 +51,20 @@ static int oss_num_threads;
 module_param(oss_num_threads, int, 0444);
 MODULE_PARM_DESC(oss_num_threads, "number of OSS service threads to start");
 
-static int ost_num_threads;
-module_param(ost_num_threads, int, 0444);
-MODULE_PARM_DESC(ost_num_threads, "number of OST service threads to start (deprecated)");
+static unsigned int oss_cpu_bind = 1;
+module_param(oss_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(oss_cpu_bind,
+                "bind OSS service threads to particular CPU partitions");
 
 static int oss_num_create_threads;
 module_param(oss_num_create_threads, int, 0444);
 MODULE_PARM_DESC(oss_num_create_threads, "number of OSS create threads to start");
 
+static unsigned int oss_create_cpu_bind = 1;
+module_param(oss_create_cpu_bind, uint, 0444);
+MODULE_PARM_DESC(oss_create_cpu_bind,
+                "bind OSS create threads to particular CPU partitions");
+
 static char *oss_cpts;
 module_param(oss_cpts, charp, 0444);
 MODULE_PARM_DESC(oss_cpts, "CPU partitions OSS threads should run on");
@@ -71,16 +77,6 @@ MODULE_PARM_DESC(oss_io_cpts, "CPU partitions OSS IO threads should run on");
 
 static struct cfs_cpt_table    *ost_io_cptable;
 
-#ifdef CONFIG_PROC_FS
-LPROC_SEQ_FOPS_RO_TYPE(ost, uuid);
-
-static struct lprocfs_vars lprocfs_ost_obd_vars[] = {
-       { .name =       "uuid",
-         .fops =       &ost_uuid_fops  },
-       { NULL }
-};
-#endif /* CONFIG_PROC_FS */
-
 /* Sigh - really, this is an OSS, the _server_, not the _target_ */
 static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
 {
@@ -90,10 +86,10 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
        int rc;
        ENTRY;
 
-#ifdef CONFIG_PROC_FS
-       obd->obd_vars = lprocfs_ost_obd_vars;
-       lprocfs_obd_setup(obd);
-#endif
+       rc = lprocfs_obd_setup(obd, true);
+       if (rc)
+               return rc;
+
        mutex_init(&ost->ost_health_mutex);
 
        svc_conf = (typeof(svc_conf)) {
@@ -114,11 +110,12 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                        .tc_nthrs_base          = OSS_NTHRS_BASE,
                        .tc_nthrs_max           = oss_max_threads,
                        .tc_nthrs_user          = oss_num_threads,
-                       .tc_cpu_affinity        = 1,
+                       .tc_cpu_bind            = oss_cpu_bind,
                        .tc_ctx_tags            = LCT_DT_THREAD,
                },
                .psc_cpt                = {
                        .cc_pattern             = oss_cpts,
+                       .cc_affinity            = true,
                },
                .psc_ops                = {
                        .so_req_handler         = tgt_request_handle,
@@ -127,7 +124,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                },
        };
        ost->ost_service = ptlrpc_register_service(&svc_conf,
-                                                  obd->obd_proc_entry);
+                                                  &obd->obd_kset,
+                                                  obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_service)) {
                rc = PTR_ERR(ost->ost_service);
                CERROR("failed to start service: %d\n", rc);
@@ -153,11 +151,12 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                        .tc_nthrs_base          = OSS_CR_NTHRS_BASE,
                        .tc_nthrs_max           = OSS_CR_NTHRS_MAX,
                        .tc_nthrs_user          = oss_num_create_threads,
-                       .tc_cpu_affinity        = 1,
+                       .tc_cpu_bind            = oss_create_cpu_bind,
                        .tc_ctx_tags            = LCT_DT_THREAD,
                },
                .psc_cpt                = {
                        .cc_pattern             = oss_cpts,
+                       .cc_affinity            = true,
                },
                .psc_ops                = {
                        .so_req_handler         = tgt_request_handle,
@@ -165,7 +164,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                },
        };
        ost->ost_create_service = ptlrpc_register_service(&svc_conf,
-                                                         obd->obd_proc_entry);
+                                                         &obd->obd_kset,
+                                                         obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_create_service)) {
                rc = PTR_ERR(ost->ost_create_service);
                CERROR("failed to start OST create service: %d\n", rc);
@@ -188,8 +188,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
 
                        rc = cfs_cpt_set_node(ost_io_cptable, cpt++, i);
                        if (!rc) {
-                               CWARN("OSS Failed to set node %d for"
-                                     "IO CPT table\n", i);
+                               CWARN("OSS Failed to set node %d for IO CPT table\n",
+                                     i);
                                cfs_cpt_table_free(ost_io_cptable);
                                ost_io_cptable = NULL;
                                break;
@@ -216,13 +216,14 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                        .tc_nthrs_base          = OSS_NTHRS_BASE,
                        .tc_nthrs_max           = oss_max_threads,
                        .tc_nthrs_user          = oss_num_threads,
-                       .tc_cpu_affinity        = 1,
+                       .tc_cpu_bind            = oss_cpu_bind,
                        .tc_ctx_tags            = LCT_DT_THREAD,
                },
                .psc_cpt                = {
                        .cc_cptable             = ost_io_cptable,
                        .cc_pattern             = ost_io_cptable == NULL ?
                                                  oss_io_cpts : NULL,
+                       .cc_affinity            = true,
                },
                .psc_ops                = {
                        .so_thr_init            = tgt_io_thread_init,
@@ -233,7 +234,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                },
        };
        ost->ost_io_service = ptlrpc_register_service(&svc_conf,
-                                                     obd->obd_proc_entry);
+                                                     &obd->obd_kset,
+                                                     obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_io_service)) {
                rc = PTR_ERR(ost->ost_io_service);
                CERROR("failed to start OST I/O service: %d\n", rc);
@@ -260,12 +262,13 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                        .tc_nthrs_base          = OSS_CR_NTHRS_BASE,
                        .tc_nthrs_max           = OSS_CR_NTHRS_MAX,
                        .tc_nthrs_user          = oss_num_create_threads,
-                       .tc_cpu_affinity        = 1,
+                       .tc_cpu_bind            = oss_create_cpu_bind,
                        .tc_ctx_tags            = LCT_DT_THREAD,
                },
 
                .psc_cpt                = {
-                       .cc_pattern          = oss_cpts,
+                       .cc_pattern             = oss_cpts,
+                       .cc_affinity            = true,
                },
                .psc_ops                = {
                        .so_req_handler         = tgt_request_handle,
@@ -274,7 +277,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                },
        };
        ost->ost_seq_service = ptlrpc_register_service(&svc_conf,
-                                                     obd->obd_proc_entry);
+                                                      &obd->obd_kset,
+                                                      obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_seq_service)) {
                rc = PTR_ERR(ost->ost_seq_service);
                CERROR("failed to start OST seq service: %d\n", rc);
@@ -306,12 +310,13 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                        .tc_nthrs_base          = OSS_CR_NTHRS_BASE,
                        .tc_nthrs_max           = OSS_CR_NTHRS_MAX,
                        .tc_nthrs_user          = oss_num_create_threads,
-                       .tc_cpu_affinity        = 1,
+                       .tc_cpu_bind            = oss_create_cpu_bind,
                        .tc_ctx_tags            = LCT_MD_THREAD |
                                                  LCT_DT_THREAD,
                },
                .psc_cpt                = {
                        .cc_pattern             = oss_cpts,
+                       .cc_affinity            = true,
                },
                .psc_ops                = {
                        .so_req_handler         = tgt_request_handle,
@@ -320,7 +325,8 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                },
        };
        ost->ost_out_service = ptlrpc_register_service(&svc_conf,
-                                                      obd->obd_proc_entry);
+                                                      &obd->obd_kset,
+                                                      obd->obd_debugfs_entry);
        if (IS_ERR(ost->ost_out_service)) {
                rc = PTR_ERR(ost->ost_out_service);
                CERROR("failed to start out service: %d\n", rc);
@@ -345,7 +351,7 @@ out_service:
         ptlrpc_unregister_service(ost->ost_service);
         ost->ost_service = NULL;
 out_lprocfs:
-        lprocfs_obd_cleanup(obd);
+       lprocfs_obd_cleanup(obd);
         RETURN(rc);
 }
 
@@ -401,7 +407,7 @@ static int ost_health_check(const struct lu_env *env, struct obd_device *obd)
 }
 
 /* use obd ops to offer management infrastructure */
-static struct obd_ops ost_obd_ops = {
+static const struct obd_ops ost_obd_ops = {
         .o_owner        = THIS_MODULE,
         .o_setup        = ost_setup,
         .o_cleanup      = ost_cleanup,
@@ -415,16 +421,9 @@ static int __init ost_init(void)
 
        ENTRY;
 
-       rc = class_register_type(&ost_obd_ops, NULL, true, NULL,
+       rc = class_register_type(&ost_obd_ops, NULL, false, NULL,
                                 LUSTRE_OSS_NAME, NULL);
 
-        if (ost_num_threads != 0 && oss_num_threads == 0) {
-                LCONSOLE_INFO("ost_num_threads module parameter is deprecated, "
-                              "use oss_num_threads instead or unset both for "
-                              "dynamic thread startup\n");
-                oss_num_threads = ost_num_threads;
-        }
-
         RETURN(rc);
 }