mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-18 11:11:27 +00:00
The changes included in the patch below are:
- If someone tries to build SCST on an RHEL 5 system without having run 'make enable_proc' first, complain. - Do not define set_cpus_allowed_ptr() on RHEL 5 since RHEL 5 does have a declaration for this function. The function itself is not exported from the kernel however (this is probably a bug). Because of that, replace the call to set_cpus_allowed_ptr() in scst_main.c by a call to set_cpus_allowed(). - Do not define the variable 'err' on kernels where that variable is not used in order to avoid a compiler warning. - Also in scst_vdisk.c, pass a 16-bit value as the first argument of put_unaligned() when writing to a 16-bit variable in order to avoid a compiler warning. Signed-off-by: Bart Van Assche <bvanassche@acm.org> with fixes and additions: - In scst_vdisk.c we need 32-bit values, not 16, fixed - Optimal UNMAP granuality changed to 1. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2377 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -33,6 +33,8 @@
|
||||
#ifdef CONFIG_SCST_PROC
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#elif defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5
|
||||
#error The SCST sysfs interface is not supported on RHEL 5. Please run 'make enable_proc'.
|
||||
#endif
|
||||
|
||||
#include <scsi/scsi_cmnd.h>
|
||||
@@ -122,7 +124,7 @@ static inline void cpumask_copy(cpumask_t *dstp,
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26) && !defined(RHEL_MAJOR)
|
||||
static inline int set_cpus_allowed_ptr(struct task_struct *p,
|
||||
const cpumask_t *new_mask)
|
||||
{
|
||||
|
||||
@@ -1353,7 +1353,9 @@ static void vdisk_exec_unmap(struct scst_cmd *cmd, struct scst_vdisk_thr *thr)
|
||||
}
|
||||
|
||||
while ((offset - 8) < descriptor_len) {
|
||||
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27)
|
||||
int err;
|
||||
#endif
|
||||
uint64_t start;
|
||||
uint32_t len;
|
||||
start = be64_to_cpu(get_unaligned((__be64 *)&address[offset]));
|
||||
@@ -1566,7 +1568,7 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
||||
put_unaligned(cpu_to_be32(max_transfer),
|
||||
(uint32_t *)&buf[8]);
|
||||
/*
|
||||
* Let's have optimal transfer len 1MB. Better to not
|
||||
* Let's have optimal transfer len 512KB. Better to not
|
||||
* set it at all, because we don't have such limit,
|
||||
* but some initiators may not understand that (?).
|
||||
* From other side, too big transfers are not optimal,
|
||||
@@ -1574,15 +1576,18 @@ static void vdisk_exec_inquiry(struct scst_cmd *cmd)
|
||||
*/
|
||||
put_unaligned(cpu_to_be32(min_t(int,
|
||||
max_transfer,
|
||||
1*1024*1024 / virt_dev->block_size)),
|
||||
512*1024 / virt_dev->block_size)),
|
||||
(uint32_t *)&buf[12]);
|
||||
if (virt_dev->thin_provisioned) {
|
||||
/* MAXIMUM UNMAP LBA COUNT is UNLIMITED */
|
||||
put_unaligned(cpu_to_be32(0xFFFFFFFF),
|
||||
(uint16_t *)&buf[20]);
|
||||
put_unaligned(__constant_cpu_to_be32(0xFFFFFFFF),
|
||||
(uint32_t *)&buf[20]);
|
||||
/* MAXIMUM UNMAP BLOCK DESCRIPTOR COUNT is UNLIMITED */
|
||||
put_unaligned(cpu_to_be32(0xFFFFFFFF),
|
||||
(uint16_t *)&buf[24]);
|
||||
put_unaligned(__constant_cpu_to_be32(0xFFFFFFFF),
|
||||
(uint32_t *)&buf[24]);
|
||||
/* OPTIMAL UNMAP GRANULARITY is 1 */
|
||||
put_unaligned(__constant_cpu_to_be32(1),
|
||||
(uint32_t *)&buf[28]);
|
||||
}
|
||||
resp_len = buf[3] + 4;
|
||||
} else if ((0xB2 == cmd->cdb[2]) &&
|
||||
|
||||
@@ -1575,8 +1575,13 @@ int scst_add_threads(struct scst_cmd_threads *cmd_threads,
|
||||
strlcpy(nm, tgt_dev->dev->virt_name, ARRAY_SIZE(nm));
|
||||
thr->cmd_thread = kthread_create(scst_cmd_thread,
|
||||
cmd_threads, "%s%d_%d", nm, tgt_dev_num, n++);
|
||||
#ifdef RHEL_MAJOR
|
||||
rc = set_cpus_allowed(thr->cmd_thread,
|
||||
tgt_dev->sess->acg->acg_cpu_mask);
|
||||
#else
|
||||
rc = set_cpus_allowed_ptr(thr->cmd_thread,
|
||||
&tgt_dev->sess->acg->acg_cpu_mask);
|
||||
#endif
|
||||
if (rc != 0)
|
||||
PRINT_ERROR("Setting CPU affinity failed: "
|
||||
"%d", rc);
|
||||
|
||||
Reference in New Issue
Block a user