Whamcloud - gitweb
LU-9859 libcfs: rename cfs_cpt_table to cfs_cpt_tab 19/37519/2
authorNeilBrown <neilb@suse.com>
Mon, 10 Feb 2020 16:22:02 +0000 (11:22 -0500)
committerOleg Drokin <green@whamcloud.com>
Thu, 20 Feb 2020 07:15:06 +0000 (07:15 +0000)
The variable "cfs_cpt_table" has the same name as
the structure "struct cfs_cpt_table".
This makes it hard to use #define to make one disappear
on a uni-processor build, but keep the other.
So rename the variable to cfs_cpt_tab.

Linux-commit: 457d63ea5c1aa81fe0b9a66a77a2282856b88983

Test-Parameters: trivial

Change-Id: I77cc6694183df2485974c8a962a5766a905fb5f9
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-on: https://review.whamcloud.com/37519
Reviewed-by: Neil Brown <neilb@suse.de>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/libcfs_cpu.h
libcfs/libcfs/libcfs_cpu.c
libcfs/libcfs/module.c
lnet/lnet/api-ni.c
lnet/selftest/framework.c
lustre/mdt/mdt_mds.c
lustre/ost/ost_handler.c
lustre/ptlrpc/client.c
lustre/ptlrpc/ptlrpcd.c
lustre/ptlrpc/service.c

index e25c1d9..34db1f6 100644 (file)
@@ -58,9 +58,9 @@
  *   . NUMA allocators, CPU affinity threads are built over CPU partitions,
  *     instead of HW CPUs or HW nodes.
  *
- *   . By default, Lustre modules should refer to the global cfs_cpt_table,
+ *   . By default, Lustre modules should refer to the global cfs_cpt_tab,
  *     instead of accessing HW CPUs directly, so concurrency of Lustre can be
- *     configured by cpu_npartitions of the global cfs_cpt_table
+ *     configured by cpu_npartitions of the global cfs_cpt_tab
  *
  *   . If cpu_npartitions=1(all CPUs in one pool), lustre should work the
  *     same way as 2.2 or earlier versions
@@ -124,7 +124,7 @@ struct cfs_cpt_table {
 /* any CPU partition */
 #define CFS_CPT_ANY            (-1)
 
-extern struct cfs_cpt_table    *cfs_cpt_table;
+extern struct cfs_cpt_table    *cfs_cpt_tab;
 
 /**
  * destroy a CPU partition table
index 955f1aa..ea273a9 100644 (file)
@@ -36,8 +36,8 @@
 #include <libcfs/libcfs.h>
 
 /** Global CPU partition table */
-struct cfs_cpt_table *cfs_cpt_table __read_mostly;
-EXPORT_SYMBOL(cfs_cpt_table);
+struct cfs_cpt_table *cfs_cpt_tab __read_mostly;
+EXPORT_SYMBOL(cfs_cpt_tab);
 
 /**
  * modparam for setting number of partitions
@@ -1161,8 +1161,8 @@ static struct notifier_block cfs_cpu_notifier = {
 
 void cfs_cpu_fini(void)
 {
-       if (!IS_ERR_OR_NULL(cfs_cpt_table))
-               cfs_cpt_table_free(cfs_cpt_table);
+       if (!IS_ERR_OR_NULL(cfs_cpt_tab))
+               cfs_cpt_table_free(cfs_cpt_tab);
 
 #ifdef CONFIG_HOTPLUG_CPU
 #ifdef HAVE_HOTPLUG_STATE_MACHINE
@@ -1179,7 +1179,7 @@ int cfs_cpu_init(void)
 {
        int ret;
 
-       LASSERT(!cfs_cpt_table);
+       LASSERT(!cfs_cpt_tab);
 
 #ifdef CONFIG_HOTPLUG_CPU
 #ifdef HAVE_HOTPLUG_STATE_MACHINE
@@ -1203,20 +1203,20 @@ int cfs_cpu_init(void)
 
        get_online_cpus();
        if (*cpu_pattern) {
-               cfs_cpt_table = cfs_cpt_table_create_pattern(cpu_pattern);
-               if (IS_ERR(cfs_cpt_table)) {
+               cfs_cpt_tab = cfs_cpt_table_create_pattern(cpu_pattern);
+               if (IS_ERR(cfs_cpt_tab)) {
                        CERROR("Failed to create cptab from pattern '%s'\n",
                               cpu_pattern);
-                       ret = PTR_ERR(cfs_cpt_table);
+                       ret = PTR_ERR(cfs_cpt_tab);
                        goto failed_alloc_table;
                }
 
        } else {
-               cfs_cpt_table = cfs_cpt_table_create(cpu_npartitions);
-               if (IS_ERR(cfs_cpt_table)) {
+               cfs_cpt_tab = cfs_cpt_table_create(cpu_npartitions);
+               if (IS_ERR(cfs_cpt_tab)) {
                        CERROR("Failed to create cptab with npartitions %d\n",
                               cpu_npartitions);
-                       ret = PTR_ERR(cfs_cpt_table);
+                       ret = PTR_ERR(cfs_cpt_tab);
                        goto failed_alloc_table;
                }
        }
@@ -1225,14 +1225,14 @@ int cfs_cpu_init(void)
 
        LCONSOLE(0, "HW NUMA nodes: %d, HW CPU cores: %d, npartitions: %d\n",
                 num_online_nodes(), num_online_cpus(),
-                cfs_cpt_number(cfs_cpt_table));
+                cfs_cpt_number(cfs_cpt_tab));
        return 0;
 
 failed_alloc_table:
        put_online_cpus();
 
-       if (!IS_ERR_OR_NULL(cfs_cpt_table))
-               cfs_cpt_table_free(cfs_cpt_table);
+       if (!IS_ERR_OR_NULL(cfs_cpt_tab))
+               cfs_cpt_table_free(cfs_cpt_tab);
 
 #ifdef CONFIG_HOTPLUG_CPU
 #ifdef HAVE_HOTPLUG_STATE_MACHINE
index d0f417f..d925a6c 100644 (file)
@@ -403,14 +403,14 @@ static int __proc_cpt_table(void *data, int write,
        if (write)
                return -EPERM;
 
-       LASSERT(cfs_cpt_table != NULL);
+       LASSERT(cfs_cpt_tab);
 
        while (1) {
                LIBCFS_ALLOC(buf, len);
                if (buf == NULL)
                        return -ENOMEM;
 
-               rc = cfs_cpt_table_print(cfs_cpt_table, buf, len);
+               rc = cfs_cpt_table_print(cfs_cpt_tab, buf, len);
                if (rc >= 0)
                        break;
 
@@ -451,14 +451,14 @@ static int __proc_cpt_distance(void *data, int write,
        if (write)
                return -EPERM;
 
-       LASSERT(cfs_cpt_table != NULL);
+       LASSERT(cfs_cpt_tab);
 
        while (1) {
                LIBCFS_ALLOC(buf, len);
                if (buf == NULL)
                        return -ENOMEM;
 
-               rc = cfs_cpt_distance_print(cfs_cpt_table, buf, len);
+               rc = cfs_cpt_distance_print(cfs_cpt_tab, buf, len);
                if (rc >= 0)
                        break;
 
index 702ddbf..f580a89 100644 (file)
@@ -2490,8 +2490,8 @@ int lnet_lib_init(void)
        lnet_assert_wire_constants();
 
        /* refer to global cfs_cpt_table for now */
-       the_lnet.ln_cpt_table   = cfs_cpt_table;
-       the_lnet.ln_cpt_number  = cfs_cpt_number(cfs_cpt_table);
+       the_lnet.ln_cpt_table = cfs_cpt_tab;
+       the_lnet.ln_cpt_number = cfs_cpt_number(cfs_cpt_tab);
 
        LASSERT(the_lnet.ln_cpt_number > 0);
        if (the_lnet.ln_cpt_number > LNET_CPT_MAX) {
index 328331a..19691f6 100644 (file)
@@ -593,7 +593,7 @@ sfw_load_test(struct sfw_test_instance *tsi)
 
        CDEBUG(D_NET, "Reserved %d buffers for test %s\n",
               nbuf * (srpc_serv_is_framework(svc) ?
-                      1 : cfs_cpt_number(cfs_cpt_table)), svc->sv_name);
+                      1 : cfs_cpt_number(cfs_cpt_tab)), svc->sv_name);
        return 0;
 }
 
index 86a6e41..860cdf9 100644 (file)
@@ -487,10 +487,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;
 
index 68ece80..b98d462 100644 (file)
@@ -172,10 +172,10 @@ static int ost_setup(struct obd_device *obd, struct lustre_cfg* lcfg)
                GOTO(out_service, rc);
         }
 
-       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;
 
index 5064a6f..cc93dd4 100644 (file)
@@ -1064,8 +1064,8 @@ struct ptlrpc_request_set *ptlrpc_prep_set(void)
        int cpt;
 
        ENTRY;
-       cpt = cfs_cpt_current(cfs_cpt_table, 0);
-       OBD_CPT_ALLOC(set, cfs_cpt_table, cpt, sizeof(*set));
+       cpt = cfs_cpt_current(cfs_cpt_tab, 0);
+       OBD_CPT_ALLOC(set, cfs_cpt_tab, cpt, sizeof(*set));
        if (!set)
                RETURN(NULL);
        atomic_set(&set->set_refcount, 1);
index 914f326..6e6045b 100644 (file)
@@ -175,7 +175,7 @@ ptlrpcd_select_pc(struct ptlrpc_request *req)
        if (req != NULL && req->rq_send_state != LUSTRE_IMP_FULL)
                return &ptlrpcd_rcv;
 
-       cpt = cfs_cpt_current(cfs_cpt_table, 1);
+       cpt = cfs_cpt_current(cfs_cpt_tab, 1);
        if (ptlrpcds_cpt_idx == NULL)
                idx = cpt;
        else
@@ -445,7 +445,7 @@ static int ptlrpcd(void *arg)
 
        unshare_fs_struct();
 
-       if (cfs_cpt_bind(cfs_cpt_table, pc->pc_cpt) != 0)
+       if (cfs_cpt_bind(cfs_cpt_tab, pc->pc_cpt) != 0)
                CWARN("Failed to bind %s on CPT %d\n", pc->pc_name, pc->pc_cpt);
 
        /*
@@ -592,7 +592,7 @@ static int ptlrpcd_partners(struct ptlrpcd *pd, int index)
        if (pc->pc_npartners <= 0)
                GOTO(out, rc);
 
-       OBD_CPT_ALLOC(pc->pc_partners, cfs_cpt_table, pc->pc_cpt,
+       OBD_CPT_ALLOC(pc->pc_partners, cfs_cpt_tab, pc->pc_cpt,
                      sizeof(struct ptlrpcd_ctl *) * pc->pc_npartners);
        if (pc->pc_partners == NULL) {
                pc->pc_npartners = 0;
@@ -729,7 +729,7 @@ static void ptlrpcd_fini(void)
        ptlrpcd_free(&ptlrpcd_rcv);
 
        if (ptlrpcds_cpt_idx != NULL) {
-               ncpts = cfs_cpt_number(cfs_cpt_table);
+               ncpts = cfs_cpt_number(cfs_cpt_tab);
                OBD_FREE(ptlrpcds_cpt_idx, ncpts * sizeof(ptlrpcds_cpt_idx[0]));
                ptlrpcds_cpt_idx = NULL;
        }
@@ -756,7 +756,7 @@ static int ptlrpcd_init(void)
        /*
         * Determine the CPTs that ptlrpcd threads will run on.
         */
-       cptable = cfs_cpt_table;
+       cptable = cfs_cpt_tab;
        ncpts = cfs_cpt_number(cptable);
        if (ptlrpcd_cpts != NULL) {
                struct cfs_expr_list *el;
index ef341fd..a0eb608 100644 (file)
@@ -229,7 +229,7 @@ struct ptlrpc_hr_partition {
 #define HRT_STOPPING 1
 
 struct ptlrpc_hr_service {
-       /* CPU partition table, it's just cfs_cpt_table for now */
+       /* CPU partition table, it's just cfs_cpt_tab for now */
        struct cfs_cpt_table            *hr_cpt_table;
        /** controller sleep waitq */
        wait_queue_head_t               hr_waitq;
@@ -725,7 +725,7 @@ struct ptlrpc_service *ptlrpc_register_service(struct ptlrpc_service_conf *conf,
 
        cptable = cconf->cc_cptable;
        if (cptable == NULL)
-               cptable = cfs_cpt_table;
+               cptable = cfs_cpt_tab;
 
        if (conf->psc_thr.tc_cpu_bind > 1) {
                CERROR("%s: Invalid cpu bind value %d, only 1 or 0 allowed\n",
@@ -3287,7 +3287,7 @@ int ptlrpc_hr_init(void)
        ENTRY;
 
        memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr));
-       ptlrpc_hr.hr_cpt_table = cfs_cpt_table;
+       ptlrpc_hr.hr_cpt_table = cfs_cpt_tab;
 
        ptlrpc_hr.hr_partitions = cfs_percpt_alloc(ptlrpc_hr.hr_cpt_table,
                                                   sizeof(*hrp));