From 2d1e614aa106cb907f17bce15034bdd06ccdfb37 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sun, 18 Nov 2018 23:39:57 +0000 Subject: [PATCH] scst, iscsi-scst: Port to Linux kernel v4.20 (merge r7810 from trunk) git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.3.x@7813 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 fbc8ca277..ffd7bdb65 100644 --- a/iscsi-scst/kernel/iscsi.c +++ b/iscsi-scst/kernel/iscsi.c @@ -1513,7 +1513,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 @@ -1666,7 +1668,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 @@ -1860,7 +1865,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 fe2dc74ba..a6aba9d3d 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -626,7 +626,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 3cab52aee..f6660d2bc 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,