From 5a1474df43c837b9b3cf568cde286355d7578662 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 10 Nov 2018 17:51:41 +0000 Subject: [PATCH] scst, iscsi-scst: Port to Linux kernel v4.20 git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7810 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/iscsi.c | 14 +++++++++++--- iscsi-scst/kernel/nthread.c | 4 +++- scst/src/dev_handlers/scst_vdisk.c | 4 ++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/iscsi-scst/kernel/iscsi.c b/iscsi-scst/kernel/iscsi.c index fefc2fcc8..973a88053 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1498,7 +1498,9 @@ static void cmnd_prepare_get_rejected_immed_data(struct iscsi_cmnd *cmnd) e = min_t(u32, s, PAGE_SIZE); conn->read_iov[i].iov_len = e; } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, i, size); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, conn->read_iov, i, size); #else @@ -1651,7 +1653,10 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn, } i++; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, i, + read_size); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, conn->read_iov, i, read_size); #else @@ -1845,7 +1850,10 @@ static int nop_out_start(struct iscsi_cmnd *cmnd) sBUG_ON(size != 0); } -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, + i, cmnd->pdu.datasize); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, conn->read_iov, i, cmnd->pdu.datasize); #else diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index 92e47dc62..1692dcbeb 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -470,7 +470,9 @@ static inline void iscsi_conn_init_read(struct iscsi_conn *conn, { conn->read_iov[0].iov_base = data; conn->read_iov[0].iov_len = len; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + iov_iter_kvec(&conn->read_msg.msg_iter, READ, conn->read_iov, 1, len); +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0) iov_iter_kvec(&conn->read_msg.msg_iter, READ | ITER_KVEC, conn->read_iov, 1, len); #else diff --git a/scst/src/dev_handlers/scst_vdisk.c b/scst/src/dev_handlers/scst_vdisk.c index 431d947b5..8f605949d 100644 --- a/scst/src/dev_handlers/scst_vdisk.c +++ b/scst/src/dev_handlers/scst_vdisk.c @@ -3299,8 +3299,12 @@ static enum compl_status_e fileio_exec_async(struct vdisk_cmd_params *p) length = scst_get_buf_next(cmd, &address); } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) + iov_iter_kvec(&iter, dir, p->async.kvec, kvec - p->async.kvec, total); +#else iov_iter_kvec(&iter, ITER_KVEC | dir, p->async.kvec, kvec - p->async.kvec, total); +#endif p->async.iocb = (struct kiocb) { .ki_pos = p->loff, .ki_filp = fd,