scst, iscsi-scst: Port to RHEL / CentOS 8.2 (merge r9026 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/3.4.x@9200 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-12-03 03:31:25 +00:00
parent 9d1a29333b
commit a2d594c890
4 changed files with 30 additions and 20 deletions

View File

@@ -1502,11 +1502,8 @@ 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(4, 20, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 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
conn->read_msg.msg_iov = conn->read_iov;
conn->read_msg.msg_iovlen = i;
@@ -1654,12 +1651,9 @@ static int cmnd_prepare_recv_pdu(struct iscsi_conn *conn,
}
i++;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 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
conn->read_msg.msg_iov = conn->read_iov;
conn->read_msg.msg_iovlen = i;
@@ -1850,12 +1844,9 @@ static int nop_out_start(struct iscsi_cmnd *cmnd)
sBUG_ON(size != 0);
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 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
conn->read_msg.msg_iov = conn->read_iov;
conn->read_msg.msg_iovlen = i;

View File

@@ -463,11 +463,8 @@ 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(4, 20, 0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 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
conn->read_msg.msg_iov = conn->read_iov;
conn->read_msg.msg_iovlen = 1;

View File

@@ -1544,6 +1544,32 @@ typedef unsigned long uintptr_t;
char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap);
#endif
/* <linux/uio.h> */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0)
/* See also commit abb78f875f3f ("new helper: iov_iter_kvec()") # v3.19. */
static inline void
iov_iter_kvec_backport(struct iov_iter *i, unsigned int direction,
const struct kvec *kvec, unsigned long nr_segs,
size_t count)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0) || \
(defined(RHEL_MAJOR) && \
(RHEL_MAJOR -0 > 8 || (RHEL_MAJOR -0 == 8 && RHEL_MINOR -0 >= 2)))
/*
* For iov_iter_kvec() implementations that have a WARN_ON(direction &
* ~(READ | WRITE)) statement. See also commit aa563d7bca6e ("iov_iter:
* Separate type from direction and use accessor functions") # v4.20.
*/
iov_iter_kvec(i, direction, kvec, nr_segs, count);
#else
iov_iter_kvec(i, ITER_KVEC | direction, kvec, nr_segs, count);
#endif
}
#define iov_iter_kvec iov_iter_kvec_backport
#endif
/* <linux/unaligned.h> */
#if defined(RHEL_MAJOR) && RHEL_MAJOR -0 <= 5

View File

@@ -3262,11 +3262,7 @@ static enum compl_status_e fileio_exec_async(struct vdisk_cmd_params *p)
WARN_ON_ONCE(sg_cnt != cmd->sg_cnt);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
iov_iter_kvec(&iter, dir, p->async.kvec, sg_cnt, total);
#else
iov_iter_kvec(&iter, ITER_KVEC | dir, p->async.kvec, sg_cnt, total);
#endif
*iocb = (struct kiocb) {
.ki_pos = p->loff,
.ki_filp = fd,