scst: Port to Linux kernel v5.0 (merge r7849 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7888 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2019-01-13 21:27:19 +00:00
parent 5d081b0af4
commit 2b477bd719
5 changed files with 35 additions and 3 deletions

View File

@@ -1875,7 +1875,7 @@ static void qla25xx_set_que(srb_t *sp, struct rsp_que **rsp)
{
struct scsi_cmnd *cmd = GET_CMD_SP(sp);
struct qla_hw_data *ha = sp->fcport->vha->hw;
int affinity = cmd->request->cpu;
int affinity = scst_blk_rq_cpu(cmd->request);
if (ha->flags.cpu_affinity_enabled && affinity >= 0 &&
affinity < ha->max_rsp_queues - 1)

View File

@@ -304,7 +304,9 @@ struct scsi_host_template qla2xxx_driver_template = {
#endif
.this_id = -1,
.cmd_per_lun = 3,
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
.use_clustering = ENABLE_CLUSTERING,
#endif
.sg_tablesize = SG_ALL,
.max_sectors = 0xFFFF,
@@ -1160,7 +1162,8 @@ __qla2xxx_eh_generic_reset(char *name, enum nexus_wait_type type,
goto eh_reset_failed;
}
err = 2;
if (do_reset(fcport, cmd->device->lun, cmd->request->cpu + 1)
if (do_reset(fcport, cmd->device->lun,
scst_blk_rq_cpu(cmd->request) + 1)
!= QLA_SUCCESS) {
ql_log(ql_log_warn, vha, 0x800c,
"do_reset failed for cmd=%p.\n", cmd);

View File

@@ -22,6 +22,9 @@
#include <linux/bio.h>
#include <linux/blkdev.h> /* struct request_queue */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 21, 0)
#include <linux/blk-mq.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
#include <linux/bsg-lib.h> /* struct bsg_job */
#endif
@@ -116,6 +119,17 @@ static inline unsigned int queue_max_hw_sectors(struct request_queue *q)
}
#endif
/* <linux/blk-mq.h> */
static inline unsigned int scst_blk_rq_cpu(struct request *rq)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
return rq->cpu;
#else
return blk_mq_rq_cpu(rq);
#endif
}
/* <linux/bsg-lib.h> */
/*

View File

@@ -5281,7 +5281,12 @@ static int scst_alloc_add_tgt_dev(struct scst_session *sess,
ini_sg = shost->sg_tablesize;
ini_unchecked_isa_dma = shost->unchecked_isa_dma;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
ini_use_clustering = shost->use_clustering == ENABLE_CLUSTERING;
#else
ini_use_clustering = !(shost->dma_boundary == PAGE_SIZE - 1 &&
shost->max_segment_size == PAGE_SIZE);
#endif
} else {
ini_sg = (1 << 15) /* infinite */;
ini_unchecked_isa_dma = 0;
@@ -8398,7 +8403,7 @@ static void scsi_end_async(struct request *req, blk_status_t error)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
lockdep_assert_held(req->q->queue_lock);
#else
#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
if (!req->q->mq_ops)
lockdep_assert_held(req->q->queue_lock);
#endif
@@ -8429,7 +8434,12 @@ static void scsi_end_async(struct request *req, blk_status_t error)
kmem_cache_free(scsi_io_context_cache, sioc);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
/* See also commit 92bc5a24844a ("block: remove __blk_put_request()") */
__blk_put_request(req->q, req);
#else
blk_put_request(req);
#endif
return;
}

View File

@@ -1663,7 +1663,12 @@ static struct scsi_host_template scst_lcl_ini_driver_template = {
.sg_tablesize = 0xFFFF,
.max_sectors = 0xffff,
/* Possible pass-through backend device may not support clustering */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 21, 0)
.use_clustering = DISABLE_CLUSTERING,
#else
.dma_boundary = PAGE_SIZE - 1,
.max_segment_size = PAGE_SIZE,
#endif
.skip_settle_delay = 1,
.module = THIS_MODULE,
};