From be309a2e3144d18becb36a6038d9c93d358bca48 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 25 Sep 2019 03:33:46 +0000 Subject: [PATCH] scst: Port to SLES 15 Fixes: https://sourceforge.net/p/scst/tickets/29/. Untested. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8588 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_os.c | 11 +++++++---- qla2x00t/qla_bsg.c | 3 ++- scst/include/backport.h | 17 +++++++++++++---- scst/include/scst.h | 3 ++- scst/src/dev_handlers/scst_vdisk.c | 9 ++++++--- scst/src/scst_lib.c | 21 ++++++++++++++------- scst_local/scst_local.c | 3 ++- 7 files changed, 46 insertions(+), 21 deletions(-) diff --git a/qla2x00t-32gbit/qla_os.c b/qla2x00t-32gbit/qla_os.c index 758f68965..ee8b30eee 100644 --- a/qla2x00t-32gbit/qla_os.c +++ b/qla2x00t-32gbit/qla_os.c @@ -7160,7 +7160,8 @@ static int qla2xxx_map_queues(struct Scsi_Host *shost) if (USER_CTRL_IRQ(vha->hw)) rc = blk_mq_map_queues(&shost->tag_set); else -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \ + !defined(CONFIG_SUSE_KERNEL) /* * See also commit f23f5bece686 ("blk-mq: Allow PCI vector * offset for mapping queues") # v4.17. @@ -7216,8 +7217,9 @@ struct scsi_host_template qla2xxx_driver_template = { .cmd_size = sizeof(srb_t), }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) && \ - LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) && \ + LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static void qla_pci_reset_notify(struct pci_dev *dev, bool prepare) { if (prepare) @@ -7238,7 +7240,8 @@ struct pci_error_handlers qla2xxx_err_handler = { .slot_reset = qla2xxx_pci_slot_reset, .resume = qla2xxx_pci_resume, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 16, 0) -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) .reset_notify = qla_pci_reset_notify, #else .reset_prepare = qla_pci_reset_prepare, diff --git a/qla2x00t/qla_bsg.c b/qla2x00t/qla_bsg.c index 20b716752..3239e77a7 100644 --- a/qla2x00t/qla_bsg.c +++ b/qla2x00t/qla_bsg.c @@ -25,7 +25,8 @@ static inline void set_bsg_result(struct bsg_job *job, int result) { job->req->errors = result; } -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static inline void set_bsg_result(struct bsg_job *job, int result) { scsi_req(job->req)->result = result; diff --git a/scst/include/backport.h b/scst/include/backport.h index 4dbc9536c..f1cac9c3c 100644 --- a/scst/include/backport.h +++ b/scst/include/backport.h @@ -94,7 +94,8 @@ static __always_inline unsigned long long rdtsc(void) /* */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static inline struct bio_set *bioset_create_backport(unsigned int pool_size, unsigned int front_pad, int flags) @@ -107,7 +108,8 @@ static inline struct bio_set *bioset_create_backport(unsigned int pool_size, #endif /* See also commit 74d46992e0d9. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static inline void bio_set_dev(struct bio *bio, struct block_device *bdev) { bio->bi_bdev = bdev; @@ -168,7 +170,8 @@ static inline void *bsg_job_sense(struct bsg_job *job) { #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0) return job->req->sense; -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \ + !defined(CONFIG_SUSE_KERNEL) return scsi_req(job->req)->sense; #else return scsi_req(blk_mq_rq_from_pdu(job))->sense; @@ -465,7 +468,8 @@ static inline ssize_t call_write_iter(struct file *file, struct kiocb *kio, * See also commit b745fafaf70c ("fs: Introduce RWF_NOWAIT and * FMODE_AIO_NOWAIT") # v4.13. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) #define IOCB_NOWAIT 0 #endif @@ -489,7 +493,11 @@ static inline ssize_t kernel_write_backport(struct file *file, const void *buf, size_t count, loff_t *pos) { +#ifndef CONFIG_SUSE_KERNEL return kernel_write(file, buf, count, *pos); +#else + return kernel_write(file, buf, count, pos); +#endif } #define kernel_write kernel_write_backport @@ -910,6 +918,7 @@ static inline void *kvzalloc(size_t size, gfp_t flags) #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0) && \ (!defined(RHEL_MAJOR) || RHEL_MAJOR -0 < 7 || \ RHEL_MAJOR -0 == 7 && RHEL_MINOR -0 < 7) && \ + !defined(CONFIG_SUSE_KERNEL) && \ !defined(_COMPAT_LINUX_MM_H) /* See also commit 1c542f38ab8d ("mm: Introduce kvcalloc()") # v4.18. */ static inline void *kvcalloc(size_t n, size_t size, gfp_t flags) diff --git a/scst/include/scst.h b/scst/include/scst.h index 1c38ce2fc..e6c1ea087 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -5393,7 +5393,8 @@ void scst_dev_inquiry_data_changed(struct scst_device *dev); * allows exclusive wake ups of threads in LIFO order. We need it to let (yet) * unneeded threads sleep and not pollute CPU cache by their stacks. */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static inline void prepare_to_wait_exclusive_head(wait_queue_head_t *q, wait_queue_t *wait, int state) { diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 03102417a..afaf0cce5 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -407,7 +407,8 @@ static void vdev_flush_end_io(struct bio *bio, int error) #else static void vdev_flush_end_io(struct bio *bio) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) int error = bio->bi_error; #else int error = blk_status_to_errno(bio->bi_status); @@ -2864,7 +2865,8 @@ static void blockio_end_sync_io(struct bio *bio, int error) #else static void blockio_end_sync_io(struct bio *bio) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) int error = bio->bi_error; #else int error = blk_status_to_errno(bio->bi_status); @@ -5862,7 +5864,8 @@ static void blockio_endio(struct bio *bio, int error) #else static void blockio_endio(struct bio *bio) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) int error = bio->bi_error; #else int error = blk_status_to_errno(bio->bi_status); diff --git a/scst/src/scst_lib.c b/scst/src/scst_lib.c index ffc78e827..e63e53fc6 100644 --- a/scst/src/scst_lib.c +++ b/scst/src/scst_lib.c @@ -7918,7 +7918,8 @@ static void blk_bio_map_kern_endio(struct bio *bio, int err) #else static void blk_bio_map_kern_endio(struct bio *bio) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) int err = bio->bi_error; #else int err = blk_status_to_errno(bio->bi_status); @@ -8101,7 +8102,8 @@ static struct request *blk_make_request(struct request_queue *q, if (IS_ERR(rq)) return rq; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) || \ + defined(CONFIG_SUSE_KERNEL) scsi_req_init(scsi_req(rq)); #else scsi_req_init(rq); @@ -8110,7 +8112,8 @@ static struct request *blk_make_request(struct request_queue *q, for_each_bio(bio) { int ret; -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) struct bio *bounce_bio = bio; blk_queue_bounce(q, &bounce_bio); @@ -8124,7 +8127,8 @@ static struct request *blk_make_request(struct request_queue *q, * blk_rq_append_bio"). That commit has been backported to * kernel v4.14.11 as 88da02868f77. */ -#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 11) +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 14, 11) && \ + !defined(CONFIG_SUSE_KERNEL) ret = blk_rq_append_bio(rq, bio); if (unlikely(ret)) { blk_put_request(rq); @@ -8347,7 +8351,8 @@ 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, 13, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 13, 0) || \ + defined(CONFIG_SUSE_KERNEL) scsi_req_init(scsi_req(rq)); #else scsi_req_init(rq); @@ -8533,7 +8538,8 @@ out: #endif /* !defined(SCSI_EXEC_REQ_FIFO_DEFINED) */ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30) -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) static void scsi_end_async(struct request *req, int error) #else static void scsi_end_async(struct request *req, blk_status_t error) @@ -8704,7 +8710,8 @@ out_free_unmap: #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) b->bi_end_io(b, res); #else -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 13, 0) && \ + !defined(CONFIG_SUSE_KERNEL) b->bi_error = res; #else b->bi_status = errno_to_blk_status(res); diff --git a/scst_local/scst_local.c b/scst_local/scst_local.c index 9fa1e4209..b88561acf 100644 --- a/scst_local/scst_local.c +++ b/scst_local/scst_local.c @@ -1174,7 +1174,8 @@ static int scst_local_change_queue_depth(struct scsi_device *sdev, int qdepth) static int scst_local_slave_alloc(struct scsi_device *sdev) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 17, 0) && \ + !defined(CONFIG_SUSE_KERNEL) #if !defined(RHEL_MAJOR) || RHEL_MAJOR -0 >= 6 queue_flag_set_unlocked(QUEUE_FLAG_BIDI, sdev->request_queue); #endif