Skip to content

Commit aa563d7

Browse files
committed
iov_iter: Separate type from direction and use accessor functions
In the iov_iter struct, separate the iterator type from the iterator direction and use accessor functions to access them in most places. Convert a bunch of places to use switch-statements to access them rather then chains of bitwise-AND statements. This makes it easier to add further iterator types. Also, this can be more efficient as to implement a switch of small contiguous integers, the compiler can use ~50% fewer compare instructions than it has to use bitwise-and instructions. Further, cease passing the iterator type into the iterator setup function. The iterator function can set that itself. Only the direction is required. Signed-off-by: David Howells <dhowells@redhat.com>
1 parent 00e2370 commit aa563d7

File tree

40 files changed

+96
-105
lines changed

40 files changed

+96
-105
lines changed

drivers/block/drbd/drbd_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,7 +1856,7 @@ int drbd_send(struct drbd_connection *connection, struct socket *sock,
18561856

18571857
/* THINK if (signal_pending) return ... ? */
18581858

1859-
iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, &iov, 1, size);
1859+
iov_iter_kvec(&msg.msg_iter, WRITE, &iov, 1, size);
18601860

18611861
if (sock == connection->data.socket) {
18621862
rcu_read_lock();

drivers/block/drbd/drbd_receiver.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ static int drbd_recv_short(struct socket *sock, void *buf, size_t size, int flag
516516
struct msghdr msg = {
517517
.msg_flags = (flags ? flags : MSG_WAITALL | MSG_NOSIGNAL)
518518
};
519-
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1, size);
519+
iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, size);
520520
return sock_recvmsg(sock, &msg, msg.msg_flags);
521521
}
522522

drivers/block/loop.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos)
268268
struct iov_iter i;
269269
ssize_t bw;
270270

271-
iov_iter_bvec(&i, ITER_BVEC | WRITE, bvec, 1, bvec->bv_len);
271+
iov_iter_bvec(&i, WRITE, bvec, 1, bvec->bv_len);
272272

273273
file_start_write(file);
274274
bw = vfs_iter_write(file, &i, ppos, 0);
@@ -346,7 +346,7 @@ static int lo_read_simple(struct loop_device *lo, struct request *rq,
346346
ssize_t len;
347347

348348
rq_for_each_segment(bvec, rq, iter) {
349-
iov_iter_bvec(&i, ITER_BVEC, &bvec, 1, bvec.bv_len);
349+
iov_iter_bvec(&i, READ, &bvec, 1, bvec.bv_len);
350350
len = vfs_iter_read(lo->lo_backing_file, &i, &pos, 0);
351351
if (len < 0)
352352
return len;
@@ -387,7 +387,7 @@ static int lo_read_transfer(struct loop_device *lo, struct request *rq,
387387
b.bv_offset = 0;
388388
b.bv_len = bvec.bv_len;
389389

390-
iov_iter_bvec(&i, ITER_BVEC, &b, 1, b.bv_len);
390+
iov_iter_bvec(&i, READ, &b, 1, b.bv_len);
391391
len = vfs_iter_read(lo->lo_backing_file, &i, &pos, 0);
392392
if (len < 0) {
393393
ret = len;
@@ -554,8 +554,7 @@ static int lo_rw_aio(struct loop_device *lo, struct loop_cmd *cmd,
554554
}
555555
atomic_set(&cmd->ref, 2);
556556

557-
iov_iter_bvec(&iter, ITER_BVEC | rw, bvec,
558-
segments, blk_rq_bytes(rq));
557+
iov_iter_bvec(&iter, rw, bvec, segments, blk_rq_bytes(rq));
559558
iter.iov_offset = offset;
560559

561560
cmd->iocb.ki_pos = pos;

drivers/block/nbd.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
473473
u32 nbd_cmd_flags = 0;
474474
int sent = nsock->sent, skip = 0;
475475

476-
iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request));
476+
iov_iter_kvec(&from, WRITE, &iov, 1, sizeof(request));
477477

478478
switch (req_op(req)) {
479479
case REQ_OP_DISCARD:
@@ -564,8 +564,7 @@ static int nbd_send_cmd(struct nbd_device *nbd, struct nbd_cmd *cmd, int index)
564564

565565
dev_dbg(nbd_to_dev(nbd), "request %p: sending %d bytes data\n",
566566
req, bvec.bv_len);
567-
iov_iter_bvec(&from, ITER_BVEC | WRITE,
568-
&bvec, 1, bvec.bv_len);
567+
iov_iter_bvec(&from, WRITE, &bvec, 1, bvec.bv_len);
569568
if (skip) {
570569
if (skip >= iov_iter_count(&from)) {
571570
skip -= iov_iter_count(&from);
@@ -624,7 +623,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
624623
int ret = 0;
625624

626625
reply.magic = 0;
627-
iov_iter_kvec(&to, READ | ITER_KVEC, &iov, 1, sizeof(reply));
626+
iov_iter_kvec(&to, READ, &iov, 1, sizeof(reply));
628627
result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);
629628
if (result <= 0) {
630629
if (!nbd_disconnected(config))
@@ -678,8 +677,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
678677
struct bio_vec bvec;
679678

680679
rq_for_each_segment(bvec, req, iter) {
681-
iov_iter_bvec(&to, ITER_BVEC | READ,
682-
&bvec, 1, bvec.bv_len);
680+
iov_iter_bvec(&to, READ, &bvec, 1, bvec.bv_len);
683681
result = sock_xmit(nbd, index, 0, &to, MSG_WAITALL, NULL);
684682
if (result <= 0) {
685683
dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n",
@@ -1073,7 +1071,7 @@ static void send_disconnects(struct nbd_device *nbd)
10731071
for (i = 0; i < config->num_connections; i++) {
10741072
struct nbd_sock *nsock = config->socks[i];
10751073

1076-
iov_iter_kvec(&from, WRITE | ITER_KVEC, &iov, 1, sizeof(request));
1074+
iov_iter_kvec(&from, WRITE, &iov, 1, sizeof(request));
10771075
mutex_lock(&nsock->tx_lock);
10781076
ret = sock_xmit(nbd, i, 1, &from, 0, NULL);
10791077
if (ret <= 0)

drivers/fsi/fsi-sbefifo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo)
638638
}
639639
ffdc_iov.iov_base = ffdc;
640640
ffdc_iov.iov_len = SBEFIFO_MAX_FFDC_SIZE;
641-
iov_iter_kvec(&ffdc_iter, WRITE | ITER_KVEC, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE);
641+
iov_iter_kvec(&ffdc_iter, WRITE, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE);
642642
cmd[0] = cpu_to_be32(2);
643643
cmd[1] = cpu_to_be32(SBEFIFO_CMD_GET_SBE_FFDC);
644644
rc = sbefifo_do_command(sbefifo, cmd, 2, &ffdc_iter);
@@ -735,7 +735,7 @@ int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
735735
rbytes = (*resp_len) * sizeof(__be32);
736736
resp_iov.iov_base = response;
737737
resp_iov.iov_len = rbytes;
738-
iov_iter_kvec(&resp_iter, WRITE | ITER_KVEC, &resp_iov, 1, rbytes);
738+
iov_iter_kvec(&resp_iter, WRITE, &resp_iov, 1, rbytes);
739739

740740
/* Perform the command */
741741
mutex_lock(&sbefifo->lock);

drivers/isdn/mISDN/l1oip_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,7 @@ l1oip_socket_thread(void *data)
718718
printk(KERN_DEBUG "%s: socket created and open\n",
719719
__func__);
720720
while (!signal_pending(current)) {
721-
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, &iov, 1,
722-
recvbuf_size);
721+
iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, recvbuf_size);
723722
recvlen = sock_recvmsg(socket, &msg, 0);
724723
if (recvlen > 0) {
725724
l1oip_socket_parse(hc, &sin_rx, recvbuf, recvlen);

drivers/misc/vmw_vmci/vmci_queue_pair.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3030,7 +3030,7 @@ ssize_t vmci_qpair_enqueue(struct vmci_qp *qpair,
30303030
if (!qpair || !buf)
30313031
return VMCI_ERROR_INVALID_ARGS;
30323032

3033-
iov_iter_kvec(&from, WRITE | ITER_KVEC, &v, 1, buf_size);
3033+
iov_iter_kvec(&from, WRITE, &v, 1, buf_size);
30343034

30353035
qp_lock(qpair);
30363036

@@ -3074,7 +3074,7 @@ ssize_t vmci_qpair_dequeue(struct vmci_qp *qpair,
30743074
if (!qpair || !buf)
30753075
return VMCI_ERROR_INVALID_ARGS;
30763076

3077-
iov_iter_kvec(&to, READ | ITER_KVEC, &v, 1, buf_size);
3077+
iov_iter_kvec(&to, READ, &v, 1, buf_size);
30783078

30793079
qp_lock(qpair);
30803080

@@ -3119,7 +3119,7 @@ ssize_t vmci_qpair_peek(struct vmci_qp *qpair,
31193119
if (!qpair || !buf)
31203120
return VMCI_ERROR_INVALID_ARGS;
31213121

3122-
iov_iter_kvec(&to, READ | ITER_KVEC, &v, 1, buf_size);
3122+
iov_iter_kvec(&to, READ, &v, 1, buf_size);
31233123

31243124
qp_lock(qpair);
31253125

drivers/nvme/target/io-cmd-file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ static ssize_t nvmet_file_submit_bvec(struct nvmet_req *req, loff_t pos,
101101
rw = READ;
102102
}
103103

104-
iov_iter_bvec(&iter, ITER_BVEC | rw, req->f.bvec, nr_segs, count);
104+
iov_iter_bvec(&iter, rw, req->f.bvec, nr_segs, count);
105105

106106
iocb->ki_pos = pos;
107107
iocb->ki_filp = req->ns->file;

drivers/target/iscsi/iscsi_target_util.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,8 +1258,7 @@ static int iscsit_do_rx_data(
12581258
return -1;
12591259

12601260
memset(&msg, 0, sizeof(struct msghdr));
1261-
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC,
1262-
count->iov, count->iov_count, data);
1261+
iov_iter_kvec(&msg.msg_iter, READ, count->iov, count->iov_count, data);
12631262

12641263
while (msg_data_left(&msg)) {
12651264
rx_loop = sock_recvmsg(conn->sock, &msg, MSG_WAITALL);
@@ -1315,8 +1314,7 @@ int tx_data(
13151314

13161315
memset(&msg, 0, sizeof(struct msghdr));
13171316

1318-
iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC,
1319-
iov, iov_count, data);
1317+
iov_iter_kvec(&msg.msg_iter, WRITE, iov, iov_count, data);
13201318

13211319
while (msg_data_left(&msg)) {
13221320
int tx_loop = sock_sendmsg(conn->sock, &msg);

drivers/target/target_core_file.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ fd_execute_rw_aio(struct se_cmd *cmd, struct scatterlist *sgl, u32 sgl_nents,
303303
len += sg->length;
304304
}
305305

306-
iov_iter_bvec(&iter, ITER_BVEC | is_write, bvec, sgl_nents, len);
306+
iov_iter_bvec(&iter, is_write, bvec, sgl_nents, len);
307307

308308
aio_cmd->cmd = cmd;
309309
aio_cmd->len = len;
@@ -353,7 +353,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd,
353353
len += sg->length;
354354
}
355355

356-
iov_iter_bvec(&iter, ITER_BVEC, bvec, sgl_nents, len);
356+
iov_iter_bvec(&iter, READ, bvec, sgl_nents, len);
357357
if (is_write)
358358
ret = vfs_iter_write(fd, &iter, &pos, 0);
359359
else
@@ -490,7 +490,7 @@ fd_execute_write_same(struct se_cmd *cmd)
490490
len += se_dev->dev_attrib.block_size;
491491
}
492492

493-
iov_iter_bvec(&iter, ITER_BVEC, bvec, nolb, len);
493+
iov_iter_bvec(&iter, READ, bvec, nolb, len);
494494
ret = vfs_iter_write(fd_dev->fd_file, &iter, &pos, 0);
495495

496496
kfree(bvec);

drivers/usb/usbip/usbip_common.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ int usbip_recv(struct socket *sock, void *buf, int size)
309309
if (!sock || !buf || !size)
310310
return -EINVAL;
311311

312-
iov_iter_kvec(&msg.msg_iter, READ|ITER_KVEC, &iov, 1, size);
312+
iov_iter_kvec(&msg.msg_iter, READ, &iov, 1, size);
313313

314314
usbip_dbg_xmit("enter\n");
315315

drivers/xen/pvcalls-back.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ static void pvcalls_conn_back_read(void *opaque)
137137
if (masked_prod < masked_cons) {
138138
vec[0].iov_base = data->in + masked_prod;
139139
vec[0].iov_len = wanted;
140-
iov_iter_kvec(&msg.msg_iter, ITER_KVEC|WRITE, vec, 1, wanted);
140+
iov_iter_kvec(&msg.msg_iter, WRITE, vec, 1, wanted);
141141
} else {
142142
vec[0].iov_base = data->in + masked_prod;
143143
vec[0].iov_len = array_size - masked_prod;
144144
vec[1].iov_base = data->in;
145145
vec[1].iov_len = wanted - vec[0].iov_len;
146-
iov_iter_kvec(&msg.msg_iter, ITER_KVEC|WRITE, vec, 2, wanted);
146+
iov_iter_kvec(&msg.msg_iter, WRITE, vec, 2, wanted);
147147
}
148148

149149
atomic_set(&map->read, 0);
@@ -195,13 +195,13 @@ static void pvcalls_conn_back_write(struct sock_mapping *map)
195195
if (pvcalls_mask(prod, array_size) > pvcalls_mask(cons, array_size)) {
196196
vec[0].iov_base = data->out + pvcalls_mask(cons, array_size);
197197
vec[0].iov_len = size;
198-
iov_iter_kvec(&msg.msg_iter, ITER_KVEC|READ, vec, 1, size);
198+
iov_iter_kvec(&msg.msg_iter, READ, vec, 1, size);
199199
} else {
200200
vec[0].iov_base = data->out + pvcalls_mask(cons, array_size);
201201
vec[0].iov_len = array_size - pvcalls_mask(cons, array_size);
202202
vec[1].iov_base = data->out;
203203
vec[1].iov_len = size - vec[0].iov_len;
204-
iov_iter_kvec(&msg.msg_iter, ITER_KVEC|READ, vec, 2, size);
204+
iov_iter_kvec(&msg.msg_iter, READ, vec, 2, size);
205205
}
206206

207207
atomic_set(&map->write, 0);

fs/9p/vfs_addr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static int v9fs_fid_readpage(struct p9_fid *fid, struct page *page)
6565
if (retval == 0)
6666
return retval;
6767

68-
iov_iter_bvec(&to, ITER_BVEC | READ, &bvec, 1, PAGE_SIZE);
68+
iov_iter_bvec(&to, READ, &bvec, 1, PAGE_SIZE);
6969

7070
retval = p9_client_read(fid, page_offset(page), &to, &err);
7171
if (err) {
@@ -175,7 +175,7 @@ static int v9fs_vfs_writepage_locked(struct page *page)
175175
bvec.bv_page = page;
176176
bvec.bv_offset = 0;
177177
bvec.bv_len = len;
178-
iov_iter_bvec(&from, ITER_BVEC | WRITE, &bvec, 1, len);
178+
iov_iter_bvec(&from, WRITE, &bvec, 1, len);
179179

180180
/* We should have writeback_fid always set */
181181
BUG_ON(!v9inode->writeback_fid);

fs/9p/vfs_dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ static int v9fs_dir_readdir(struct file *file, struct dir_context *ctx)
133133
if (rdir->tail == rdir->head) {
134134
struct iov_iter to;
135135
int n;
136-
iov_iter_kvec(&to, READ | ITER_KVEC, &kvec, 1, buflen);
136+
iov_iter_kvec(&to, READ, &kvec, 1, buflen);
137137
n = p9_client_read(file->private_data, ctx->pos, &to,
138138
&err);
139139
if (err)

fs/9p/xattr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
3232
struct iov_iter to;
3333
int err;
3434

35-
iov_iter_kvec(&to, READ | ITER_KVEC, &kvec, 1, buffer_size);
35+
iov_iter_kvec(&to, READ, &kvec, 1, buffer_size);
3636

3737
attr_fid = p9_client_xattrwalk(fid, name, &attr_size);
3838
if (IS_ERR(attr_fid)) {
@@ -107,7 +107,7 @@ int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name,
107107
struct iov_iter from;
108108
int retval, err;
109109

110-
iov_iter_kvec(&from, WRITE | ITER_KVEC, &kvec, 1, value_len);
110+
iov_iter_kvec(&from, WRITE, &kvec, 1, value_len);
111111

112112
p9_debug(P9_DEBUG_VFS, "name = %s value_len = %zu flags = %d\n",
113113
name, value_len, flags);

fs/afs/rxrpc.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ static void afs_load_bvec(struct afs_call *call, struct msghdr *msg,
286286
offset = 0;
287287
}
288288

289-
iov_iter_bvec(&msg->msg_iter, WRITE | ITER_BVEC, bv, nr, bytes);
289+
iov_iter_bvec(&msg->msg_iter, WRITE, bv, nr, bytes);
290290
}
291291

292292
/*
@@ -401,8 +401,7 @@ long afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call,
401401

402402
msg.msg_name = NULL;
403403
msg.msg_namelen = 0;
404-
iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, iov, 1,
405-
call->request_size);
404+
iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, call->request_size);
406405
msg.msg_control = NULL;
407406
msg.msg_controllen = 0;
408407
msg.msg_flags = MSG_WAITALL | (call->send_pages ? MSG_MORE : 0);
@@ -432,7 +431,7 @@ long afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call,
432431
rxrpc_kernel_abort_call(call->net->socket, rxcall,
433432
RX_USER_ABORT, ret, "KSD");
434433
} else {
435-
iov_iter_kvec(&msg.msg_iter, READ | ITER_KVEC, NULL, 0, 0);
434+
iov_iter_kvec(&msg.msg_iter, READ, NULL, 0, 0);
436435
rxrpc_kernel_recv_data(call->net->socket, rxcall,
437436
&msg.msg_iter, false,
438437
&call->abort_code, &call->service_id);
@@ -468,7 +467,7 @@ static void afs_deliver_to_call(struct afs_call *call)
468467
if (state == AFS_CALL_SV_AWAIT_ACK) {
469468
struct iov_iter iter;
470469

471-
iov_iter_kvec(&iter, READ | ITER_KVEC, NULL, 0, 0);
470+
iov_iter_kvec(&iter, READ, NULL, 0, 0);
472471
ret = rxrpc_kernel_recv_data(call->net->socket,
473472
call->rxcall, &iter, false,
474473
&remote_abort,
@@ -825,7 +824,7 @@ void afs_send_empty_reply(struct afs_call *call)
825824

826825
msg.msg_name = NULL;
827826
msg.msg_namelen = 0;
828-
iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, NULL, 0, 0);
827+
iov_iter_kvec(&msg.msg_iter, WRITE, NULL, 0, 0);
829828
msg.msg_control = NULL;
830829
msg.msg_controllen = 0;
831830
msg.msg_flags = 0;
@@ -864,7 +863,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)
864863
iov[0].iov_len = len;
865864
msg.msg_name = NULL;
866865
msg.msg_namelen = 0;
867-
iov_iter_kvec(&msg.msg_iter, WRITE | ITER_KVEC, iov, 1, len);
866+
iov_iter_kvec(&msg.msg_iter, WRITE, iov, 1, len);
868867
msg.msg_control = NULL;
869868
msg.msg_controllen = 0;
870869
msg.msg_flags = 0;
@@ -905,7 +904,7 @@ int afs_extract_data(struct afs_call *call, void *buf, size_t count,
905904

906905
iov.iov_base = buf + call->offset;
907906
iov.iov_len = count - call->offset;
908-
iov_iter_kvec(&iter, ITER_KVEC | READ, &iov, 1, count - call->offset);
907+
iov_iter_kvec(&iter, READ, &iov, 1, count - call->offset);
909908

910909
ret = rxrpc_kernel_recv_data(net->socket, call->rxcall, &iter,
911910
want_more, &remote_abort,

fs/ceph/file.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -821,7 +821,7 @@ static void ceph_aio_complete_req(struct ceph_osd_request *req)
821821
aio_req->total_len = rc + zlen;
822822
}
823823

824-
iov_iter_bvec(&i, ITER_BVEC, osd_data->bvec_pos.bvecs,
824+
iov_iter_bvec(&i, READ, osd_data->bvec_pos.bvecs,
825825
osd_data->num_bvecs,
826826
osd_data->bvec_pos.iter.bi_size);
827827
iov_iter_advance(&i, rc);
@@ -1044,8 +1044,7 @@ ceph_direct_read_write(struct kiocb *iocb, struct iov_iter *iter,
10441044
int zlen = min_t(size_t, len - ret,
10451045
size - pos - ret);
10461046

1047-
iov_iter_bvec(&i, ITER_BVEC, bvecs, num_pages,
1048-
len);
1047+
iov_iter_bvec(&i, READ, bvecs, num_pages, len);
10491048
iov_iter_advance(&i, ret);
10501049
iov_iter_zero(zlen, &i);
10511050
ret += zlen;

fs/cifs/connect.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
588588
{
589589
struct msghdr smb_msg;
590590
struct kvec iov = {.iov_base = buf, .iov_len = to_read};
591-
iov_iter_kvec(&smb_msg.msg_iter, READ | ITER_KVEC, &iov, 1, to_read);
591+
iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read);
592592

593593
return cifs_readv_from_socket(server, &smb_msg);
594594
}
@@ -600,7 +600,7 @@ cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
600600
struct msghdr smb_msg;
601601
struct bio_vec bv = {
602602
.bv_page = page, .bv_len = to_read, .bv_offset = page_offset};
603-
iov_iter_bvec(&smb_msg.msg_iter, READ | ITER_BVEC, &bv, 1, to_read);
603+
iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read);
604604
return cifs_readv_from_socket(server, &smb_msg);
605605
}
606606

0 commit comments

Comments
 (0)