diff --git a/scst/include/scst.h b/scst/include/scst.h index dc2551bbf..6b01af6b6 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -33,6 +33,8 @@ #ifdef CONFIG_SCST_PROC #include #include +#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 @@ -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) { diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 5cc83de9c..12c795c39 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -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]) && diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index 6479639bc..f994ff42e 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -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);