From 95f713444e20c6b12e29aceea91addf5465d4ae9 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 30 Aug 2010 20:58:20 +0000 Subject: [PATCH] Some scst_local cleanups git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2024 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 8 +++++++- scst/src/scst_main.c | 3 ++- scst_local/scst_local.c | 20 ++++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/scst/include/scst.h b/scst/include/scst.h index 6f82d32ed..02e6fe75c 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -97,7 +97,7 @@ static inline int list_is_last(const struct list_head *list, #endif -#define SCST_LOCAL_NAME "scst_lcl_drvr" +#define SCST_LOCAL_NAME "scst_local" /************************************************************* ** States of command processing state machine. At first, @@ -581,6 +581,9 @@ struct scst_tgt_template { #ifdef CONFIG_SCST_PROC /* True, if the template doesn't need the entry in /proc */ unsigned no_proc_entry:1; +#else + /* True, if this target doesn't need "enabled" attribute */ + unsigned enabled_attr_not_needed:1; #endif /* @@ -831,6 +834,9 @@ struct scst_tgt_template { * while target not yet completed the initial configuration. In this * case the too early connected initiators would see not those devices, * which they intended to see. + * + * If you are sure your target driver doesn't need enabling target, + * you should set enabled_attr_not_needed in 1. */ int (*enable_target) (struct scst_tgt *tgt, bool enable); diff --git a/scst/src/scst_main.c b/scst/src/scst_main.c index d7056406a..d97f0f03e 100644 --- a/scst/src/scst_main.c +++ b/scst/src/scst_main.c @@ -239,7 +239,8 @@ int __scst_register_target_template(struct scst_tgt_template *vtt, } #ifndef CONFIG_SCST_PROC - if (!vtt->enable_target || !vtt->is_target_enabled) + if ((!vtt->enable_target || !vtt->is_target_enabled) && + !vtt->enabled_attr_not_needed) PRINT_WARNING("Target driver %s doesn't have enable_target() " "and/or is_target_enabled() method(s). This is unsafe " "and can lead that initiators connected on the " diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index e85fa424a..79256adc8 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -183,19 +183,17 @@ static struct kmem_cache *tgt_specific_pool; static LIST_HEAD(scst_local_host_list); static DEFINE_SPINLOCK(scst_local_host_list_lock); -static char scst_local_proc_name[] = "scst_ini_targ_debug"; - static struct bus_type scst_fake_lld_bus; static struct device scst_fake_primary; static struct device_driver scst_local_driverfs_driver = { - .name = scst_local_proc_name, + .name = SCST_LOCAL_NAME, .bus = &scst_fake_lld_bus, }; -module_param_named(add_host, scst_local_add_host, int, S_IRUGO | S_IWUSR); -module_param_named(num_tgts, scst_local_num_tgts, int, S_IRUGO | S_IWUSR); -module_param_named(max_luns, scst_local_max_luns, int, S_IRUGO | S_IWUSR); +module_param_named(add_host, scst_local_add_host, int, S_IRUGO); +module_param_named(num_tgts, scst_local_num_tgts, int, S_IRUGO); +module_param_named(max_luns, scst_local_max_luns, int, S_IRUGO); MODULE_AUTHOR("Richard Sharpe + ideas from SCSI_DEBUG"); MODULE_DESCRIPTION("SCSI+SCST local adapter driver"); @@ -941,7 +939,7 @@ static void scst_local_remove_adapter(void) static struct scsi_host_template scst_lcl_ini_driver_template = { .proc_info = scst_local_proc_info, - .proc_name = scst_local_proc_name, + .proc_name = SCST_LOCAL_NAME, .name = SCST_LOCAL_NAME, .info = scst_local_info, /* .ioctl = scst_local_ioctl, */ @@ -957,11 +955,8 @@ static struct scsi_host_template scst_lcl_ini_driver_template = { .sg_tablesize = SG_MAX_SINGLE_ALLOC, .cmd_per_lun = 32, .max_sectors = 0xffff, - /* - * There's no gain to merge requests on this level. If necessary, - * they will be merged at the backstorage level. - */ - .use_clustering = DISABLE_CLUSTERING, + /* SCST doesn't support sg chaining */ + .use_clustering = ENABLE_CLUSTERING, .skip_settle_delay = 1, .module = THIS_MODULE, }; @@ -1349,6 +1344,7 @@ static struct scst_tgt_template scst_local_targ_tmpl = { .name = "scst_local_tgt", .sg_tablesize = 0xffff, .xmit_response_atomic = 1, + .enabled_attr_not_needed = 1, .detect = scst_local_targ_detect, .release = scst_local_targ_release, .pre_exec = scst_local_targ_pre_exec,