mirror of
https://github.com/SCST-project/scst.git
synced 2026-07-25 01:23:14 +00:00
Merge branch 'svn-trunk'
This commit is contained in:
@@ -1400,7 +1400,11 @@ static void isert_kref_free(struct kref *kref)
|
||||
|
||||
void isert_conn_free(struct isert_connection *isert_conn)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
sBUG_ON(kref_read(&isert_conn->kref) == 0);
|
||||
#else
|
||||
sBUG_ON(atomic_read(&isert_conn->kref.refcount) == 0);
|
||||
#endif
|
||||
kref_put(&isert_conn->kref, isert_kref_free);
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,11 @@ static void isert_kref_release_dev(struct kref *kref)
|
||||
|
||||
static void isert_dev_release(struct isert_conn_dev *dev)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
sBUG_ON(kref_read(&dev->kref) == 0);
|
||||
#else
|
||||
sBUG_ON(atomic_read(&dev->kref.refcount) == 0);
|
||||
#endif
|
||||
mutex_lock(&isert_listen_dev.conn_lock);
|
||||
kref_put(&dev->kref, isert_kref_release_dev);
|
||||
mutex_unlock(&isert_listen_dev.conn_lock);
|
||||
|
||||
@@ -89,11 +89,6 @@ And on SUSE systems these packages can be installed by running the following com
|
||||
<pre>[root@proj ]# zypper install gcc ncurses-devel kernel-devel lsscsi patch subversion</pre>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Download the latest QLogic SCST target driver:
|
||||
<pre>[root@proj ]# git clone git://git.qlogic.com/scst-qla2xxx.git</pre>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Download the SCST source code. That source code can be downloaded either
|
||||
from the <a href="http://scst.sourceforge.net/downloads.html">SCST
|
||||
@@ -113,14 +108,15 @@ And on SUSE systems these packages can be installed by running the following com
|
||||
</li>
|
||||
|
||||
<li>
|
||||
In the SCST directory, create a soft link to the QLogic driver:
|
||||
<pre>[root@proj ]# cd scst
|
||||
If you want to use the latest QLogic SCST target driver from the QLogic git, download it by:
|
||||
<pre>[root@proj ]# git clone git://git.qlogic.com/scst-qla2xxx.git
|
||||
[root@proj ]# cd scst
|
||||
[root@proj scst]# ln -s ../scst-qla2xxx/drivers/scsi/qla2xxx qla2x00t_git</pre>
|
||||
Note, this driver is not stable at the moment, therefore use of the driver from the SCST tree is recommended.
|
||||
</li>
|
||||
|
||||
<li>
|
||||
Find out whether you will need SCSI pass-through and/or the iSCSI
|
||||
zero-copy optimization. If not, skip the kernel download, patch, rebuild
|
||||
Find out whether you will need iSCSI zero-copy optimization. Since it is valuable only with scst_user user space dev handlers, most likely, you don't need this feature. If you don't, skip the kernel download, patch, rebuild
|
||||
and reboot steps and continue with the <a href="#blacklist">SCST build step</a>.
|
||||
</li>
|
||||
|
||||
|
||||
@@ -738,27 +738,4 @@ static inline int scsi_bidi_cmnd(struct scsi_cmnd *cmd)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* <scsi/scsi_request.h> */
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
static inline struct request *scsi_req(struct request *rq)
|
||||
{
|
||||
return rq;
|
||||
}
|
||||
|
||||
static inline void scsi_req_init(struct request *rq)
|
||||
{
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0)
|
||||
rq->cmd_type = REQ_TYPE_BLOCK_PC;
|
||||
rq->__data_len = 0;
|
||||
rq->__sector = (sector_t) -1;
|
||||
rq->bio = rq->biotail = NULL;
|
||||
memset(rq->__cmd, 0, sizeof(rq->__cmd));
|
||||
rq->cmd = rq->__cmd;
|
||||
#else
|
||||
return blk_rq_set_block_pc(rq);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _SCST_BACKPORT_H_ */
|
||||
|
||||
@@ -5690,6 +5690,10 @@ struct scst_data_descriptor {
|
||||
};
|
||||
|
||||
void scst_write_same(struct scst_cmd *cmd, struct scst_data_descriptor *where);
|
||||
int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
|
||||
int data_direction, void *buffer, unsigned bufflen,
|
||||
unsigned char *sense, int timeout, int retries,
|
||||
u64 flags);
|
||||
|
||||
__be64 scst_pack_lun(const uint64_t lun, enum scst_lun_addr_method addr_method);
|
||||
uint64_t scst_unpack_lun(const uint8_t *lun, int len);
|
||||
|
||||
@@ -96,13 +96,9 @@ static int cdrom_attach(struct scst_device *dev)
|
||||
data_dir = SCST_DATA_READ;
|
||||
|
||||
TRACE_DBG("%s", "Doing READ_CAPACITY");
|
||||
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_CDROM_REG_TIMEOUT, 3, 0);
|
||||
|
||||
TRACE_DBG("READ_CAPACITY done: %x", rc);
|
||||
|
||||
|
||||
@@ -193,13 +193,9 @@ static int disk_attach(struct scst_device *dev)
|
||||
data_dir = SCST_DATA_READ;
|
||||
|
||||
TRACE_DBG("%s", "Doing READ_CAPACITY");
|
||||
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_DISK_REG_TIMEOUT, 3, 0);
|
||||
|
||||
TRACE_DBG("READ_CAPACITY done: %x", rc);
|
||||
|
||||
|
||||
@@ -197,13 +197,9 @@ static int modisk_attach(struct scst_device *dev)
|
||||
data_dir = SCST_DATA_READ;
|
||||
|
||||
TRACE_DBG("%s", "Doing READ_CAPACITY");
|
||||
rc = scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
rc = scst_scsi_execute(dev->scsi_dev, cmd, data_dir, buffer,
|
||||
buffer_size, sense_buffer,
|
||||
SCST_GENERIC_MODISK_REG_TIMEOUT, 3, 0);
|
||||
|
||||
TRACE_DBG("READ_CAPACITY done: %x", rc);
|
||||
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
#include <linux/poll.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#include <linux/sched/signal.h>
|
||||
#endif
|
||||
|
||||
#define LOG_PREFIX DEV_USER_NAME
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)
|
||||
#include <linux/falloc.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#include <linux/sched/signal.h>
|
||||
#endif
|
||||
|
||||
#define LOG_PREFIX "dev_vdisk"
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#include <linux/sched/signal.h>
|
||||
#endif
|
||||
|
||||
#ifdef INSIDE_KERNEL_TREE
|
||||
#include <scst/scst.h>
|
||||
|
||||
+59
-23
@@ -37,6 +37,9 @@
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
|
||||
#include <linux/crc-t10dif.h>
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
#include <linux/sched/task_stack.h>
|
||||
#endif
|
||||
#include <linux/namei.h>
|
||||
#include <linux/mount.h>
|
||||
|
||||
@@ -6883,6 +6886,25 @@ out:
|
||||
return res;
|
||||
}
|
||||
|
||||
int scst_scsi_execute(struct scsi_device *sdev, const unsigned char *cmd,
|
||||
int data_direction, void *buffer, unsigned bufflen,
|
||||
unsigned char *sense, int timeout, int retries, u64 flags)
|
||||
{
|
||||
return scsi_execute(sdev, cmd, data_direction, buffer, bufflen, sense,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
NULL, /* sshdr */
|
||||
#endif
|
||||
timeout, retries, flags
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
, 0 /* rq_flags */
|
||||
#endif
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL /* resid */
|
||||
#endif
|
||||
);
|
||||
}
|
||||
EXPORT_SYMBOL(scst_scsi_execute);
|
||||
|
||||
static void scst_send_release(struct scst_device *dev)
|
||||
{
|
||||
struct scsi_device *scsi_dev;
|
||||
@@ -6907,12 +6929,8 @@ static void scst_send_release(struct scst_device *dev)
|
||||
|
||||
TRACE(TRACE_DEBUG | TRACE_SCSI, "%s", "Sending RELEASE req to "
|
||||
"SCSI mid-level");
|
||||
rc = scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
|
||||
sense, 15, 0, 0
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
rc = scst_scsi_execute(scsi_dev, cdb, SCST_DATA_NONE, NULL, 0,
|
||||
sense, 15, 0, 0);
|
||||
TRACE_DBG("RELEASE done: %x", rc);
|
||||
|
||||
if (scsi_status_is_good(rc)) {
|
||||
@@ -7945,7 +7963,11 @@ static struct request *blk_make_request(struct request_queue *q,
|
||||
if (IS_ERR(rq))
|
||||
return rq;
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
scsi_req_init(rq);
|
||||
#else
|
||||
blk_rq_set_block_pc(rq);
|
||||
#endif
|
||||
|
||||
for_each_bio(bio) {
|
||||
struct bio *bounce_bio = bio;
|
||||
@@ -8155,7 +8177,11 @@ static struct request *blk_map_kern_sg(struct request_queue *q,
|
||||
if (unlikely(!rq))
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
scsi_req_init(rq);
|
||||
#else
|
||||
rq->cmd_type = REQ_TYPE_BLOCK_PC;
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -8357,11 +8383,13 @@ static void scsi_end_async(struct request *req, int error)
|
||||
SAM_STAT_CHECK_CONDITION : 0;
|
||||
|
||||
if (sioc->done)
|
||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 30)
|
||||
sioc->done(sioc->data, sioc->sense, errors, req->data_len);
|
||||
#else
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
sioc->done(sioc->data, sioc->sense, errors,
|
||||
scsi_req(req)->resid_len);
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
|
||||
sioc->done(sioc->data, sioc->sense, errors, req->resid_len);
|
||||
#else
|
||||
sioc->done(sioc->data, sioc->sense, errors, req->data_len);
|
||||
#endif
|
||||
|
||||
kmem_cache_free(scsi_io_context_cache, sioc);
|
||||
@@ -8382,6 +8410,11 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
|
||||
int res = 0;
|
||||
struct request_queue *q = cmd->dev->scsi_dev->request_queue;
|
||||
struct request *rq;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
struct scsi_request *req;
|
||||
#else
|
||||
struct request *req;
|
||||
#endif
|
||||
struct scsi_io_context *sioc;
|
||||
bool reading = !(cmd->data_direction & SCST_DATA_WRITE);
|
||||
gfp_t gfp = cmd->cmd_gfp_mask;
|
||||
@@ -8430,15 +8463,21 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
|
||||
sioc->data = data;
|
||||
sioc->done = done;
|
||||
|
||||
scsi_req(rq)->cmd_len = cmd_len;
|
||||
if (scsi_req(rq)->cmd_len <= BLK_MAX_CDB) {
|
||||
memset(scsi_req(rq)->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
|
||||
memcpy(scsi_req(rq)->cmd, cmd->cdb, cmd->cdb_len);
|
||||
} else
|
||||
scsi_req(rq)->cmd = cmd->cdb;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
req = scsi_req(rq);
|
||||
#else
|
||||
req = rq;
|
||||
#endif
|
||||
|
||||
scsi_req(rq)->sense = sioc->sense;
|
||||
scsi_req(rq)->sense_len = sizeof(sioc->sense);
|
||||
req->cmd_len = cmd_len;
|
||||
if (req->cmd_len <= BLK_MAX_CDB) {
|
||||
memset(req->cmd, 0, BLK_MAX_CDB); /* ATAPI hates garbage after CDB */
|
||||
memcpy(req->cmd, cmd->cdb, cmd->cdb_len);
|
||||
} else
|
||||
req->cmd = cmd->cdb;
|
||||
|
||||
req->sense = sioc->sense;
|
||||
req->sense_len = sizeof(sioc->sense);
|
||||
rq->timeout = cmd->timeout;
|
||||
rq->retries = cmd->retries;
|
||||
rq->end_io_data = sioc;
|
||||
@@ -13359,12 +13398,9 @@ int scst_obtain_device_parameters(struct scst_device *dev,
|
||||
memset(sense_buffer, 0, sizeof(sense_buffer));
|
||||
|
||||
TRACE(TRACE_SCSI, "%s", "Doing internal MODE_SENSE");
|
||||
rc = scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ, buffer,
|
||||
sizeof(buffer), sense_buffer, 15, 0, 0
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29)
|
||||
, NULL
|
||||
#endif
|
||||
);
|
||||
rc = scst_scsi_execute(dev->scsi_dev, cmd, SCST_DATA_READ,
|
||||
buffer, sizeof(buffer), sense_buffer,
|
||||
15, 0, 0);
|
||||
|
||||
TRACE_DBG("MODE_SENSE done: %x", rc);
|
||||
|
||||
|
||||
@@ -1204,10 +1204,10 @@ void scst_kobject_put_and_wait(struct kobject *kobj, const char *category,
|
||||
|
||||
PRINT_INFO("Waiting for release of sysfs entry for %s %s (%d refs)",
|
||||
category, name ? : "(?)",
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
|
||||
atomic_read(&kobj->kref.refcount)
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
|
||||
kref_read(&kobj->kref)
|
||||
#else
|
||||
atomic_read(&kobj->kref.refcount.refs)
|
||||
atomic_read(&kobj->kref.refcount)
|
||||
#endif
|
||||
);
|
||||
wait_for_completion(c);
|
||||
|
||||
Reference in New Issue
Block a user