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
This commit is contained in:
Bart Van Assche
2014-06-29 06:10:22 +00:00
parent 7fd827e0ef
commit 42137a23c2
4 changed files with 28 additions and 11 deletions

View File

@@ -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);

View File

@@ -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) && \

View File

@@ -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);

View File

@@ -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;