scst: Kernel v4.12 build fixes

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7158 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2017-05-01 21:01:33 +00:00
parent 0c83846917
commit 2fcd2f24b0
2 changed files with 24 additions and 8 deletions

View File

@@ -1091,7 +1091,9 @@ check:
if (virt_dev->unmap_opt_gran == virt_dev->unmap_align)
virt_dev->unmap_align = 0;
virt_dev->unmap_max_lba_cnt = q->limits.max_discard_sectors >> (block_shift - 9);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0)
virt_dev->discard_zeroes_data = q->limits.discard_zeroes_data;
#endif
#else
sBUG();
#endif

View File

@@ -8267,16 +8267,26 @@ static void scsi_end_async(struct request *req, int error)
lockdep_assert_held(req->q->queue_lock);
#endif
if (sioc->done)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
sioc->done(sioc->data, sioc->sense, req->errors,
scsi_req(req)->resid_len);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
sioc->done(sioc->data, sioc->sense, req->errors,
req->resid_len);
if (sioc->done) {
int result, resid_len;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
result = scsi_req(req)->result;
#else
sioc->done(sioc->data, sioc->sense, req->errors, req->data_len);
result = req->errors;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
resid_len = scsi_req(req)->resid_len;
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
resid_len = req->resid_len;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
sioc->done(sioc->data, sioc->sense, result, resid_len);
#else
sioc->done(sioc->data, sioc->sense, result, req->data_len);
#endif
}
kmem_cache_free(scsi_io_context_cache, sioc);
@@ -8365,7 +8375,11 @@ int scst_scsi_exec_async(struct scst_cmd *cmd, void *data,
req->sense = sioc->sense;
req->sense_len = sizeof(sioc->sense);
rq->timeout = cmd->timeout;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
req->retries = cmd->retries;
#else
rq->retries = cmd->retries;
#endif
rq->end_io_data = sioc;
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35)
rq->cmd_flags |= REQ_FAILFAST_MASK;