From 42137a23c287c35db604c7a6872e8fd4323dfd19 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 29 Jun 2014 06:10:22 +0000 Subject: [PATCH] scst: Switch from the cpu_*() to the cpumask_*() API (merge r5596 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.0.x@5646 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 12 ++++-------- scst/include/scst.h | 21 +++++++++++++++++++++ scst/src/scst_main.c | 2 +- scst/src/scst_sysfs.c | 4 ++-- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index 150d9ea98..bba8976b6 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -4009,8 +4009,7 @@ int iscsi_threads_pool_get(const cpumask_t *cpu_mask, list_for_each_entry(p, &iscsi_thread_pools_list, thread_pools_list_entry) { - if ((cpu_mask == NULL) || - __cpus_equal(cpu_mask, &p->cpu_mask, nr_cpumask_bits)) { + if (!cpu_mask || cpumask_equal(cpu_mask, &p->cpu_mask)) { p->thread_pool_ref++; TRACE_DBG("iSCSI thread pool %p found (new ref %d)", p, p->thread_pool_ref); @@ -4044,12 +4043,9 @@ int iscsi_threads_pool_get(const cpumask_t *cpu_mask, INIT_LIST_HEAD(&p->wr_list); init_waitqueue_head(&p->wr_waitQ); if (cpu_mask == NULL) - cpus_setall(p->cpu_mask); - else { - cpus_clear(p->cpu_mask); - for_each_cpu(i, cpu_mask) - cpu_set(i, p->cpu_mask); - } + cpumask_setall(&p->cpu_mask); + else + cpumask_copy(&p->cpu_mask, cpu_mask); p->thread_pool_ref = 1; INIT_LIST_HEAD(&p->threads_list); diff --git a/scst/include/scst.h b/scst/include/scst.h index 57a48d998..911b52b28 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -180,6 +180,27 @@ static inline void cpumask_copy(cpumask_t *dstp, { bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits); } + +/** + * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask + * @dstp: the cpumask pointer + */ +static inline void cpumask_setall(cpumask_t *dstp) +{ + bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits); +} + +/** + * cpumask_equal - *src1p == *src2p + * @src1p: the first input + * @src2p: the second input + */ +static inline bool cpumask_equal(const cpumask_t *src1p, + const cpumask_t *src2p) +{ + return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p), + nr_cpumask_bits); +} #endif #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && \ diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 867e7f6b5..e85a9d0ed 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -2455,7 +2455,7 @@ static int __init init_scst(void) mutex_init(&scst_suspend_mutex); mutex_init(&scst_cmd_threads_mutex); INIT_LIST_HEAD(&scst_cmd_threads_list); - cpus_setall(default_cpu_mask); + cpumask_setall(&default_cpu_mask); scst_init_threads(&scst_main_cmd_threads); diff --git a/scst/src/scst_sysfs.c b/scst/src/scst_sysfs.c index d9768fa5a..6ee2b2ef1 100644 --- a/scst/src/scst_sysfs.c +++ b/scst/src/scst_sysfs.c @@ -1885,7 +1885,7 @@ static ssize_t __scst_acg_cpu_mask_show(struct scst_acg *acg, char *buf) res = cpumask_scnprintf(buf, SCST_SYSFS_BLOCK_SIZE, &acg->acg_cpu_mask); #endif - if (!cpus_equal(acg->acg_cpu_mask, default_cpu_mask)) + if (!cpumask_equal(&acg->acg_cpu_mask, &default_cpu_mask)) res += sprintf(&buf[res], "\n%s\n", SCST_SYSFS_KEY_MARK); return res; @@ -1991,7 +1991,7 @@ static ssize_t __scst_acg_cpu_mask_store(struct scst_acg *acg, goto out_release; } - if (cpus_equal(acg->acg_cpu_mask, work->cpu_mask)) + if (cpumask_equal(&acg->acg_cpu_mask, &work->cpu_mask)) goto out; work->tgt = acg->tgt;