From eeb40d255991694d6ad376b69e0d66b2fe220027 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Tue, 10 Feb 2015 13:27:19 +0000 Subject: [PATCH] scst_local: Improve automatic queue depth adjustment for older kernels (merge r4800 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@6047 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst_local/scst_local.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 9d77b0c5c..85f4e2af1 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1162,11 +1162,6 @@ static int scst_local_targ_pre_exec(struct scst_cmd *scst_cmd) return res; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) || \ - defined(CONFIG_SUSE_KERNEL) || \ - !(!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) - static int scst_local_get_max_queue_depth(struct scsi_device *sdev) { int res; @@ -1184,6 +1179,11 @@ static int scst_local_get_max_queue_depth(struct scsi_device *sdev) return res; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) || \ + defined(CONFIG_SUSE_KERNEL) || \ + !(!defined(RHEL_RELEASE_CODE) || \ + RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) + static int scst_local_change_queue_depth(struct scsi_device *sdev, int depth, int reason) { @@ -1230,6 +1230,16 @@ out: return res; } +#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) || defined(CONFIG_SUSE_KERNEL) || !(!defined(RHEL_RELEASE_CODE) || RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) */ + +static int scst_local_change_queue_depth(struct scsi_device *sdev, int qdepth) +{ + scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev), qdepth); + return sdev->queue_depth; +} + +#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) || defined(CONFIG_SUSE_KERNEL) || !(!defined(RHEL_RELEASE_CODE) || RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) */ + static int scst_local_slave_alloc(struct scsi_device *sdev) { queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdev->request_queue); @@ -1256,8 +1266,6 @@ static int scst_local_slave_configure(struct scsi_device *sdev) return 0; } -#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) && !defined(CONFIG_SUSE_KERNEL) && (!defined(RHEL_RELEASE_CODE) || RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) */ - /* Must be called under sess->aen_lock. Drops then reacquires it inside. */ static void scst_process_aens(struct scst_local_sess *sess, bool cleanup_only) @@ -1558,14 +1566,9 @@ static struct scsi_host_template scst_lcl_ini_driver_template = { #else .queuecommand = scst_local_queuecommand, #endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33) || \ - defined(CONFIG_SUSE_KERNEL) || \ - !(!defined(RHEL_RELEASE_CODE) || \ - RHEL_RELEASE_CODE -0 < RHEL_RELEASE_VERSION(6, 1)) .change_queue_depth = scst_local_change_queue_depth, .slave_alloc = scst_local_slave_alloc, .slave_configure = scst_local_slave_configure, -#endif .eh_abort_handler = scst_local_abort, .eh_device_reset_handler = scst_local_device_reset, #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 25))