aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/iscsi_tcp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/iscsi_tcp.c')
-rw-r--r--drivers/scsi/iscsi_tcp.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index a21455d0274..6ce4109efdf 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -70,9 +70,7 @@ module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO);
70static inline void 70static inline void
71iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) 71iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size)
72{ 72{
73 ibuf->sg.page = virt_to_page(vbuf); 73 sg_init_one(&ibuf->sg, vbuf, size);
74 ibuf->sg.offset = offset_in_page(vbuf);
75 ibuf->sg.length = size;
76 ibuf->sent = 0; 74 ibuf->sent = 0;
77 ibuf->use_sendmsg = 1; 75 ibuf->use_sendmsg = 1;
78} 76}
@@ -80,13 +78,14 @@ iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size)
80static inline void 78static inline void
81iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg) 79iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg)
82{ 80{
83 ibuf->sg.page = sg->page; 81 sg_init_table(&ibuf->sg, 1);
82 sg_set_page(&ibuf->sg, sg_page(sg));
84 ibuf->sg.offset = sg->offset; 83 ibuf->sg.offset = sg->offset;
85 ibuf->sg.length = sg->length; 84 ibuf->sg.length = sg->length;
86 /* 85 /*
87 * Fastpath: sg element fits into single page 86 * Fastpath: sg element fits into single page
88 */ 87 */
89 if (sg->length + sg->offset <= PAGE_SIZE && !PageSlab(sg->page)) 88 if (sg->length + sg->offset <= PAGE_SIZE && !PageSlab(sg_page(sg)))
90 ibuf->use_sendmsg = 0; 89 ibuf->use_sendmsg = 0;
91 else 90 else
92 ibuf->use_sendmsg = 1; 91 ibuf->use_sendmsg = 1;
@@ -716,7 +715,7 @@ static int iscsi_scsi_data_in(struct iscsi_conn *conn)
716 for (i = tcp_ctask->sg_count; i < scsi_sg_count(sc); i++) { 715 for (i = tcp_ctask->sg_count; i < scsi_sg_count(sc); i++) {
717 char *dest; 716 char *dest;
718 717
719 dest = kmap_atomic(sg[i].page, KM_SOFTIRQ0); 718 dest = kmap_atomic(sg_page(&sg[i]), KM_SOFTIRQ0);
720 rc = iscsi_ctask_copy(tcp_conn, ctask, dest + sg[i].offset, 719 rc = iscsi_ctask_copy(tcp_conn, ctask, dest + sg[i].offset,
721 sg[i].length, offset); 720 sg[i].length, offset);
722 kunmap_atomic(dest, KM_SOFTIRQ0); 721 kunmap_atomic(dest, KM_SOFTIRQ0);
@@ -1103,9 +1102,9 @@ iscsi_send(struct iscsi_conn *conn, struct iscsi_buf *buf, int size, int flags)
1103 * slab case. 1102 * slab case.
1104 */ 1103 */
1105 if (buf->use_sendmsg) 1104 if (buf->use_sendmsg)
1106 res = sock_no_sendpage(sk, buf->sg.page, offset, size, flags); 1105 res = sock_no_sendpage(sk, sg_page(&buf->sg), offset, size, flags);
1107 else 1106 else
1108 res = tcp_conn->sendpage(sk, buf->sg.page, offset, size, flags); 1107 res = tcp_conn->sendpage(sk, sg_page(&buf->sg), offset, size, flags);
1109 1108
1110 if (res >= 0) { 1109 if (res >= 0) {
1111 conn->txdata_octets += res; 1110 conn->txdata_octets += res;