cifs: convert async read code to use pages array without kmapping
Replace the "marshal_iov" function with a "read_into_pages" function. That function will copy the read data off the socket and into the pages array, kmapping and reading pages one at a time. Signed-off-by: Jeff Layton <jlayton@redhat.com>
This commit is contained in:

committed by
Steve French

parent
c5fab6f4f0
commit
8321fec436
@@ -1496,6 +1496,7 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
|
||||
/* set up first iov for signature check */
|
||||
rdata->iov[0].iov_base = buf;
|
||||
rdata->iov[0].iov_len = server->total_read;
|
||||
rdata->nr_iov = 1;
|
||||
cFYI(1, "0: iov_base=%p iov_len=%zu",
|
||||
rdata->iov[0].iov_base, rdata->iov[0].iov_len);
|
||||
|
||||
@@ -1507,23 +1508,11 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid)
|
||||
return cifs_readv_discard(server, mid);
|
||||
}
|
||||
|
||||
/* marshal up the page array */
|
||||
cifs_kmap_lock();
|
||||
len = rdata->marshal_iov(rdata, data_len);
|
||||
cifs_kmap_unlock();
|
||||
data_len -= len;
|
||||
|
||||
/* issue the read if we have any iovecs left to fill */
|
||||
if (rdata->nr_iov > 1) {
|
||||
length = cifs_readv_from_socket(server, &rdata->iov[1],
|
||||
rdata->nr_iov - 1, len);
|
||||
if (length < 0)
|
||||
return length;
|
||||
server->total_read += length;
|
||||
} else {
|
||||
length = 0;
|
||||
}
|
||||
length = rdata->read_into_pages(server, rdata, data_len);
|
||||
if (length < 0)
|
||||
return length;
|
||||
|
||||
server->total_read += length;
|
||||
rdata->bytes = length;
|
||||
|
||||
cFYI(1, "total_read=%u buflen=%u remaining=%u", server->total_read,
|
||||
@@ -1544,7 +1533,11 @@ cifs_readv_callback(struct mid_q_entry *mid)
|
||||
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
|
||||
struct TCP_Server_Info *server = tcon->ses->server;
|
||||
struct smb_rqst rqst = { .rq_iov = rdata->iov,
|
||||
.rq_nvec = rdata->nr_iov };
|
||||
.rq_nvec = rdata->nr_iov,
|
||||
.rq_pages = rdata->pages,
|
||||
.rq_npages = rdata->nr_pages,
|
||||
.rq_pagesz = rdata->pagesz,
|
||||
.rq_tailsz = rdata->tailsz };
|
||||
|
||||
cFYI(1, "%s: mid=%llu state=%d result=%d bytes=%u", __func__,
|
||||
mid->mid, mid->mid_state, rdata->result, rdata->bytes);
|
||||
|
Reference in New Issue
Block a user