mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-19 22:42:38 +00:00
Cleanup of support of kernels prior 2.6.18
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@2368 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -309,12 +309,7 @@ struct iscsi_cmnd *cmnd_alloc(struct iscsi_conn *conn,
|
||||
struct iscsi_cmnd *cmnd;
|
||||
|
||||
/* ToDo: __GFP_NOFAIL?? */
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
cmnd = kmem_cache_alloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
|
||||
memset(cmnd, 0, sizeof(*cmnd));
|
||||
#else
|
||||
cmnd = kmem_cache_zalloc(iscsi_cmnd_cache, GFP_KERNEL|__GFP_NOFAIL);
|
||||
#endif
|
||||
|
||||
atomic_set(&cmnd->ref_cnt, 1);
|
||||
cmnd->scst_state = ISCSI_CMD_STATE_NEW;
|
||||
|
||||
@@ -147,35 +147,6 @@ static inline int set_cpus_allowed_ptr(struct task_struct *p,
|
||||
#define SCST_INTERFACE_VERSION \
|
||||
SCST_VERSION_STRING "$Revision$" SCST_CONST_VERSION
|
||||
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18))
|
||||
#define COMPLETION_INITIALIZER_ONSTACK(work) \
|
||||
({ init_completion(&work); work; })
|
||||
|
||||
/*
|
||||
* Lockdep needs to run a non-constant initializer for on-stack
|
||||
* completions - so we use the _ONSTACK() variant for those that
|
||||
* are on the kernel stack:
|
||||
*/
|
||||
#ifdef CONFIG_LOCKDEP
|
||||
# define DECLARE_COMPLETION_ONSTACK(work) \
|
||||
struct completion work = COMPLETION_INITIALIZER_ONSTACK(work)
|
||||
#else
|
||||
# define DECLARE_COMPLETION_ONSTACK(work) DECLARE_COMPLETION(work)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* list_is_last - tests whether @list is the last entry in list @head
|
||||
* @list: the entry to test
|
||||
* @head: the head of the list
|
||||
*/
|
||||
static inline int list_is_last(const struct list_head *list,
|
||||
const struct list_head *head)
|
||||
{
|
||||
return list->next == head;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define SCST_LOCAL_NAME "scst_local"
|
||||
|
||||
/*************************************************************
|
||||
@@ -1818,10 +1789,6 @@ struct scst_cmd {
|
||||
|
||||
unsigned long start_time;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
struct scsi_request *scsi_req; /* SCSI request */
|
||||
#endif
|
||||
|
||||
/* List entry for tgt_dev's SN related lists */
|
||||
struct list_head sn_cmd_list_entry;
|
||||
|
||||
@@ -2166,11 +2133,6 @@ struct scst_device {
|
||||
/* Used for storage of dev handler private stuff */
|
||||
void *dh_priv;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
/* Used to translate SCSI's cmd to SCST's cmd */
|
||||
struct gendisk *rq_disk;
|
||||
#endif
|
||||
|
||||
/* Corresponding real SCSI device, could be NULL for virtual devices */
|
||||
struct scsi_device *scsi_dev;
|
||||
|
||||
|
||||
@@ -60,20 +60,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
#define WARN_ON_ONCE(condition) ({ \
|
||||
static int __warned; \
|
||||
typeof(condition) __ret_warn_once = (condition); \
|
||||
\
|
||||
if (unlikely(__ret_warn_once)) \
|
||||
if (!__warned) { \
|
||||
WARN_ON(1); \
|
||||
__warned = 1; \
|
||||
} \
|
||||
unlikely(__ret_warn_once); \
|
||||
})
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCST_EXTRACHECKS
|
||||
#define EXTRACHECKS_BUG_ON(a) sBUG_ON(a)
|
||||
#define EXTRACHECKS_WARN_ON(a) WARN_ON(a)
|
||||
|
||||
@@ -721,13 +721,7 @@ static struct scst_user_cmd *dev_user_alloc_ucmd(struct scst_user_dev *dev,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
ucmd = kmem_cache_alloc(user_cmd_cachep, gfp_mask);
|
||||
if (ucmd != NULL)
|
||||
memset(ucmd, 0, sizeof(*ucmd));
|
||||
#else
|
||||
ucmd = kmem_cache_zalloc(user_cmd_cachep, gfp_mask);
|
||||
#endif
|
||||
if (unlikely(ucmd == NULL)) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "Unable to allocate "
|
||||
"user cmd (gfp_mask %x)", gfp_mask);
|
||||
|
||||
@@ -898,13 +898,7 @@ static struct scst_vdisk_thr *vdisk_init_thr_data(
|
||||
|
||||
EXTRACHECKS_BUG_ON(virt_dev->nullio);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
res = kmem_cache_alloc(vdisk_thr_cachep, GFP_KERNEL);
|
||||
if (res != NULL)
|
||||
memset(res, 0, sizeof(*res));
|
||||
#else
|
||||
res = kmem_cache_zalloc(vdisk_thr_cachep, GFP_KERNEL);
|
||||
#endif
|
||||
if (res == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "%s", "Unable to allocate struct "
|
||||
"scst_vdisk_thr");
|
||||
|
||||
@@ -2642,19 +2642,12 @@ static struct scst_acg_dev *scst_alloc_acg_dev(struct scst_acg *acg,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
res = kmem_cache_alloc(scst_acgd_cachep, GFP_KERNEL);
|
||||
#else
|
||||
res = kmem_cache_zalloc(scst_acgd_cachep, GFP_KERNEL);
|
||||
#endif
|
||||
if (res == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM,
|
||||
"%s", "Allocation of scst_acg_dev failed");
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
memset(res, 0, sizeof(*res));
|
||||
#endif
|
||||
|
||||
res->dev = dev;
|
||||
res->acg = acg;
|
||||
@@ -3280,20 +3273,13 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
tgt_dev = kmem_cache_alloc(scst_tgtd_cachep, GFP_KERNEL);
|
||||
#else
|
||||
tgt_dev = kmem_cache_zalloc(scst_tgtd_cachep, GFP_KERNEL);
|
||||
#endif
|
||||
if (tgt_dev == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_tgt_dev "
|
||||
"failed");
|
||||
res = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
memset(tgt_dev, 0, sizeof(*tgt_dev));
|
||||
#endif
|
||||
|
||||
tgt_dev->dev = dev;
|
||||
tgt_dev->lun = acg_dev->lun;
|
||||
@@ -3824,69 +3810,6 @@ int scst_finish_internal_cmd(struct scst_cmd *cmd)
|
||||
return res;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
static void scst_req_done(struct scsi_cmnd *scsi_cmd)
|
||||
{
|
||||
struct scsi_request *req;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (scsi_cmd) {
|
||||
req = scsi_cmd->sc_request;
|
||||
if (req) {
|
||||
if (req->sr_bufflen)
|
||||
kfree(req->sr_buffer);
|
||||
scsi_release_request(req);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
|
||||
static void scst_send_release(struct scst_device *dev)
|
||||
{
|
||||
struct scsi_request *req;
|
||||
struct scsi_device *scsi_dev;
|
||||
uint8_t cdb[6];
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
if (dev->scsi_dev == NULL)
|
||||
goto out;
|
||||
|
||||
scsi_dev = dev->scsi_dev;
|
||||
|
||||
req = scsi_allocate_request(scsi_dev, GFP_KERNEL);
|
||||
if (req == NULL) {
|
||||
PRINT_ERROR("Allocation of scsi_request failed: unable "
|
||||
"to RELEASE device %s", dev->virt_name);
|
||||
goto out;
|
||||
}
|
||||
|
||||
memset(cdb, 0, sizeof(cdb));
|
||||
cdb[0] = RELEASE;
|
||||
cdb[1] = (scsi_dev->scsi_level <= SCSI_2) ?
|
||||
((scsi_dev->lun << 5) & 0xe0) : 0;
|
||||
memcpy(req->sr_cmnd, cdb, sizeof(cdb));
|
||||
req->sr_cmd_len = sizeof(cdb);
|
||||
req->sr_data_direction = SCST_DATA_NONE;
|
||||
req->sr_use_sg = 0;
|
||||
req->sr_bufflen = 0;
|
||||
req->sr_buffer = NULL;
|
||||
req->sr_request->rq_disk = dev->rq_disk;
|
||||
req->sr_sense_buffer[0] = 0;
|
||||
|
||||
TRACE(TRACE_DEBUG | TRACE_SCSI, "Sending RELEASE req %p to SCSI "
|
||||
"mid-level", req);
|
||||
scst_do_req(req, req->sr_cmnd, (void *)req->sr_buffer, req->sr_bufflen,
|
||||
scst_req_done, 15, 3);
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
|
||||
static void scst_send_release(struct scst_device *dev)
|
||||
{
|
||||
struct scsi_device *scsi_dev;
|
||||
@@ -3933,7 +3856,6 @@ out:
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
|
||||
|
||||
/* scst_mutex supposed to be held */
|
||||
static void scst_clear_reservation(struct scst_tgt_dev *tgt_dev)
|
||||
@@ -3973,19 +3895,12 @@ struct scst_session *scst_alloc_session(struct scst_tgt *tgt, gfp_t gfp_mask,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
sess = kmem_cache_alloc(scst_sess_cachep, gfp_mask);
|
||||
#else
|
||||
sess = kmem_cache_zalloc(scst_sess_cachep, gfp_mask);
|
||||
#endif
|
||||
if (sess == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "%s",
|
||||
"Allocation of scst_session failed");
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
memset(sess, 0, sizeof(*sess));
|
||||
#endif
|
||||
|
||||
sess->init_phase = SCST_SESS_IPH_INITING;
|
||||
sess->shut_phase = SCST_SESS_SPH_READY;
|
||||
@@ -4203,18 +4118,11 @@ struct scst_cmd *scst_alloc_cmd(const uint8_t *cdb,
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
cmd = kmem_cache_alloc(scst_cmd_cachep, gfp_mask);
|
||||
#else
|
||||
cmd = kmem_cache_zalloc(scst_cmd_cachep, gfp_mask);
|
||||
#endif
|
||||
if (cmd == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "%s", "Allocation of scst_cmd failed");
|
||||
goto out;
|
||||
}
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
#endif
|
||||
|
||||
cmd->state = SCST_CMD_STATE_INIT_WAIT;
|
||||
cmd->start_time = jiffies;
|
||||
@@ -4297,16 +4205,6 @@ void scst_free_cmd(struct scst_cmd *cmd)
|
||||
|
||||
sBUG_ON(cmd->unblock_dev);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
#if defined(CONFIG_SCST_EXTRACHECKS)
|
||||
if (cmd->scsi_req) {
|
||||
PRINT_ERROR("%s: %s", __func__, "Cmd with unfreed "
|
||||
"scsi_req!");
|
||||
scst_release_request(cmd);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Target driver can already free sg buffer before calling
|
||||
* scst_tgt_cmd_done(). E.g., scst_local has to do that.
|
||||
@@ -4478,49 +4376,6 @@ void scst_free_mgmt_cmd(struct scst_mgmt_cmd *mcmd)
|
||||
return;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
int scst_alloc_request(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = 0;
|
||||
struct scsi_request *req;
|
||||
int gm = GFP_KERNEL;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
/* cmd->dev->scsi_dev must be non-NULL here */
|
||||
req = scsi_allocate_request(cmd->dev->scsi_dev, gm);
|
||||
if (req == NULL) {
|
||||
TRACE(TRACE_OUT_OF_MEM, "%s",
|
||||
"Allocation of scsi_request failed");
|
||||
res = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
cmd->scsi_req = req;
|
||||
|
||||
memcpy(req->sr_cmnd, cmd->cdb, cmd->cdb_len);
|
||||
req->sr_cmd_len = cmd->cdb_len;
|
||||
req->sr_data_direction = cmd->data_direction;
|
||||
req->sr_use_sg = cmd->sg_cnt;
|
||||
req->sr_bufflen = cmd->bufflen;
|
||||
req->sr_buffer = cmd->sg;
|
||||
req->sr_request->rq_disk = cmd->dev->rq_disk;
|
||||
req->sr_sense_buffer[0] = 0;
|
||||
|
||||
cmd->scsi_req->upper_private_data = cmd;
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return res;
|
||||
}
|
||||
|
||||
void scst_release_request(struct scst_cmd *cmd)
|
||||
{
|
||||
scsi_release_request(cmd->scsi_req);
|
||||
cmd->scsi_req = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool scst_on_sg_tablesize_low(struct scst_cmd *cmd, bool out)
|
||||
{
|
||||
bool res;
|
||||
|
||||
+1
-30
@@ -885,18 +885,6 @@ static int scst_register_device(struct scsi_device *scsidp)
|
||||
}
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
dev->rq_disk = alloc_disk(1);
|
||||
if (dev->rq_disk == NULL) {
|
||||
PRINT_ERROR("Unable to alloc disk object for device %s",
|
||||
dev->virt_name);
|
||||
res = -ENOMEM;
|
||||
/* virt_name will be freed in scst_free_dev() */
|
||||
goto out_free_dev;
|
||||
}
|
||||
dev->rq_disk->major = SCST_MAJOR;
|
||||
#endif
|
||||
|
||||
dev->scsi_dev = scsidp;
|
||||
|
||||
list_add_tail(&dev->dev_list_entry, &scst_dev_list);
|
||||
@@ -935,9 +923,6 @@ out:
|
||||
|
||||
out_del:
|
||||
list_del(&dev->dev_list_entry);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
put_disk(dev->rq_disk);
|
||||
#endif
|
||||
|
||||
out_free_dev:
|
||||
scst_free_device(dev);
|
||||
@@ -986,10 +971,6 @@ static void scst_unregister_device(struct scsi_device *scsidp)
|
||||
|
||||
mutex_unlock(&scst_mutex);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
put_disk(dev->rq_disk);
|
||||
#endif
|
||||
|
||||
scst_resume_activity();
|
||||
|
||||
scst_dev_sysfs_del(dev);
|
||||
@@ -2143,21 +2124,11 @@ static int __init init_scst(void)
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
{
|
||||
struct scsi_request *req;
|
||||
BUILD_BUG_ON(SCST_SENSE_BUFFERSIZE !=
|
||||
sizeof(req->sr_sense_buffer));
|
||||
}
|
||||
#else
|
||||
{
|
||||
struct scsi_sense_hdr *shdr;
|
||||
BUILD_BUG_ON(SCST_SENSE_BUFFERSIZE < sizeof(*shdr));
|
||||
}
|
||||
#endif
|
||||
{
|
||||
struct scst_tgt_dev *t;
|
||||
struct scst_cmd *c;
|
||||
BUILD_BUG_ON(SCST_SENSE_BUFFERSIZE < sizeof(*shdr));
|
||||
BUILD_BUG_ON(sizeof(t->curr_sn) != sizeof(t->expected_sn));
|
||||
BUILD_BUG_ON(sizeof(c->sn) != sizeof(t->expected_sn));
|
||||
}
|
||||
|
||||
+1
-25
@@ -27,10 +27,6 @@
|
||||
#include <scsi/scsi_device.h>
|
||||
#include <scsi/scsi_host.h>
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
#include <scsi/scsi_request.h>
|
||||
#endif
|
||||
|
||||
#define LOG_PREFIX "scst"
|
||||
|
||||
#ifdef INSIDE_KERNEL_TREE
|
||||
@@ -39,10 +35,6 @@
|
||||
#include "scst_debug.h"
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
#define SCST_MAJOR 177
|
||||
#endif
|
||||
|
||||
#define TRACE_RTRY 0x80000000
|
||||
#define TRACE_SCSI_SERIALIZING 0x40000000
|
||||
/** top being the edge away from the interupt */
|
||||
@@ -374,23 +366,7 @@ static inline void scst_destroy_cmd(struct scst_cmd *cmd)
|
||||
|
||||
void scst_check_retries(struct scst_tgt *tgt);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
int scst_alloc_request(struct scst_cmd *cmd);
|
||||
void scst_release_request(struct scst_cmd *cmd);
|
||||
|
||||
static inline void scst_do_req(struct scsi_request *sreq,
|
||||
const void *cmnd, void *buffer, unsigned bufflen,
|
||||
void (*done)(struct scsi_cmnd *), int timeout, int retries)
|
||||
{
|
||||
#ifdef CONFIG_SCST_STRICT_SERIALIZING
|
||||
scsi_do_req(sreq, cmnd, buffer, bufflen, done, timeout, retries);
|
||||
#elif !defined(SCSI_EXEC_REQ_FIFO_DEFINED)
|
||||
sBUG();
|
||||
#else
|
||||
scsi_do_req_fifo(sreq, cmnd, buffer, bufflen, done, timeout, retries);
|
||||
#endif
|
||||
}
|
||||
#elif LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
|
||||
static inline int scst_exec_req(struct scsi_device *sdev,
|
||||
const unsigned char *cmd, int cmd_len, int data_direction,
|
||||
struct scatterlist *sgl, unsigned bufflen, unsigned nents,
|
||||
|
||||
@@ -228,11 +228,7 @@ static int strcasecmp(const char *s1, const char *s2)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 17)
|
||||
static int strncasecmp(const char *s1, const char *s2, int n)
|
||||
#else
|
||||
static int strncasecmp(const char *s1, const char *s2, size_t n)
|
||||
#endif
|
||||
{
|
||||
int c1, c2;
|
||||
do {
|
||||
|
||||
@@ -1495,63 +1495,6 @@ static inline enum scst_exec_context scst_optimize_post_exec_context(
|
||||
return context;
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
static inline struct scst_cmd *scst_get_cmd(struct scsi_cmnd *scsi_cmd,
|
||||
struct scsi_request **req)
|
||||
{
|
||||
struct scst_cmd *cmd = NULL;
|
||||
|
||||
if (scsi_cmd) {
|
||||
*req = scsi_cmd->sc_request;
|
||||
if (*req)
|
||||
cmd = (struct scst_cmd *)(*req)->upper_private_data;
|
||||
}
|
||||
|
||||
if (cmd == NULL) {
|
||||
PRINT_ERROR("%s", "Request with NULL cmd");
|
||||
if (*req)
|
||||
scsi_release_request(*req);
|
||||
}
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
static void scst_cmd_done(struct scsi_cmnd *scsi_cmd)
|
||||
{
|
||||
struct scsi_request *req = NULL;
|
||||
struct scst_cmd *cmd;
|
||||
|
||||
TRACE_ENTRY();
|
||||
|
||||
cmd = scst_get_cmd(scsi_cmd, &req);
|
||||
if (cmd == NULL)
|
||||
goto out;
|
||||
|
||||
scst_do_cmd_done(cmd, req->sr_result, req->sr_sense_buffer,
|
||||
sizeof(req->sr_sense_buffer), scsi_cmd->resid);
|
||||
|
||||
/* Clear out request structure */
|
||||
req->sr_use_sg = 0;
|
||||
req->sr_sglist_len = 0;
|
||||
req->sr_bufflen = 0;
|
||||
req->sr_buffer = NULL;
|
||||
req->sr_underflow = 0;
|
||||
req->sr_request->rq_disk = NULL; /* disown request blk */
|
||||
|
||||
scst_release_request(cmd);
|
||||
|
||||
cmd->state = SCST_CMD_STATE_PRE_DEV_DONE;
|
||||
|
||||
scst_process_redirect_cmd(cmd,
|
||||
scst_optimize_post_exec_context(cmd, scst_estimate_context()),
|
||||
0);
|
||||
|
||||
out:
|
||||
TRACE_EXIT();
|
||||
return;
|
||||
}
|
||||
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
|
||||
|
||||
/**
|
||||
* scst_pass_through_cmd_done - done callback for pass-through commands
|
||||
* @data: private opaque data
|
||||
@@ -1582,8 +1525,6 @@ out:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(scst_pass_through_cmd_done);
|
||||
|
||||
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18) */
|
||||
|
||||
static void scst_cmd_done_local(struct scst_cmd *cmd, int next_state,
|
||||
enum scst_exec_context pref_context)
|
||||
{
|
||||
@@ -2516,9 +2457,7 @@ static struct scst_cmd *scst_post_exec_sn(struct scst_cmd *cmd,
|
||||
static int scst_do_real_exec(struct scst_cmd *cmd)
|
||||
{
|
||||
int res = SCST_EXEC_NOT_COMPLETED;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18)
|
||||
int rc;
|
||||
#endif
|
||||
struct scst_device *dev = cmd->dev;
|
||||
struct scst_dev_type *handler = dev->handler;
|
||||
struct io_context *old_ctx = NULL;
|
||||
@@ -2563,18 +2502,6 @@ static int scst_do_real_exec(struct scst_cmd *cmd)
|
||||
|
||||
scst_set_cur_start(cmd);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
if (unlikely(scst_alloc_request(cmd) != 0)) {
|
||||
PRINT_INFO("%s", "Unable to allocate request, sending BUSY "
|
||||
"status");
|
||||
goto out_busy;
|
||||
}
|
||||
|
||||
scst_do_req(cmd->scsi_req, (void *)cmd->cdb,
|
||||
(void *)cmd->scsi_req->sr_buffer,
|
||||
cmd->scsi_req->sr_bufflen, scst_cmd_done, cmd->timeout,
|
||||
cmd->retries);
|
||||
#else
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 30)
|
||||
rc = scst_exec_req(dev->scsi_dev, cmd->cdb, cmd->cdb_len,
|
||||
cmd->data_direction, cmd->sg, cmd->bufflen,
|
||||
@@ -2587,7 +2514,6 @@ static int scst_do_real_exec(struct scst_cmd *cmd)
|
||||
PRINT_ERROR("scst pass-through exec failed: %x", rc);
|
||||
goto out_error;
|
||||
}
|
||||
#endif
|
||||
|
||||
out_complete:
|
||||
res = SCST_EXEC_COMPLETED;
|
||||
@@ -2602,12 +2528,6 @@ out_error:
|
||||
scst_set_cmd_error(cmd, SCST_LOAD_SENSE(scst_sense_hardw_error));
|
||||
goto out_done;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 18)
|
||||
out_busy:
|
||||
scst_set_busy(cmd);
|
||||
/* go through */
|
||||
#endif
|
||||
|
||||
out_done:
|
||||
res = SCST_EXEC_COMPLETED;
|
||||
/* Report the result */
|
||||
|
||||
Reference in New Issue
Block a user