summaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2012-09-19 01:20:35 +0200
committerSteve French <smfrench@gmail.com>2012-09-25 04:46:31 +0200
commitfec344e3f31aa911297cd3a4639432d983b1f324 (patch)
treec46deb8e54d4a1f00be47f7d34e572730b0df988 /fs/cifs/cifssmb.c
parentcifs: teach signing routines how to deal with arrays of pages in a smb_rqst (diff)
downloadlinux-fec344e3f31aa911297cd3a4639432d983b1f324.tar.xz
linux-fec344e3f31aa911297cd3a4639432d983b1f324.zip
cifs: change cifs_call_async to use smb_rqst structs
For now, none of the callers populate rq_pages. That will be done for writes in a later patch. While we're at it, change the prototype of setup_async_request not to need a return pointer argument. Just return the pointer to the mid_q_entry or an ERR_PTR. Reviewed-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 6786b5ee5326..2f86c84468cb 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -725,6 +725,8 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
ECHO_REQ *smb;
int rc = 0;
struct kvec iov;
+ struct smb_rqst rqst = { .rq_iov = &iov,
+ .rq_nvec = 1 };
cFYI(1, "In echo request");
@@ -742,7 +744,7 @@ CIFSSMBEcho(struct TCP_Server_Info *server)
iov.iov_base = smb;
iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
- rc = cifs_call_async(server, &iov, 1, NULL, cifs_echo_callback,
+ rc = cifs_call_async(server, &rqst, NULL, cifs_echo_callback,
server, CIFS_ASYNC_OP | CIFS_ECHO_OP);
if (rc)
cFYI(1, "Echo request failed: %d", rc);
@@ -1585,6 +1587,8 @@ cifs_async_readv(struct cifs_readdata *rdata)
READ_REQ *smb = NULL;
int wct;
struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink);
+ struct smb_rqst rqst = { .rq_iov = rdata->iov,
+ .rq_nvec = 1 };
cFYI(1, "%s: offset=%llu bytes=%u", __func__,
rdata->offset, rdata->bytes);
@@ -1628,9 +1632,8 @@ cifs_async_readv(struct cifs_readdata *rdata)
rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4;
kref_get(&rdata->refcount);
- rc = cifs_call_async(tcon->ses->server, rdata->iov, 1,
- cifs_readv_receive, cifs_readv_callback,
- rdata, 0);
+ rc = cifs_call_async(tcon->ses->server, &rqst, cifs_readv_receive,
+ cifs_readv_callback, rdata, 0);
if (rc == 0)
cifs_stats_inc(&tcon->stats.cifs_stats.num_reads);
@@ -2035,6 +2038,7 @@ cifs_async_writev(struct cifs_writedata *wdata)
int wct;
struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
struct kvec *iov = NULL;
+ struct smb_rqst rqst = { };
if (tcon->ses->capabilities & CAP_LARGE_FILES) {
wct = 14;
@@ -2051,11 +2055,13 @@ cifs_async_writev(struct cifs_writedata *wdata)
goto async_writev_out;
/* 1 iov per page + 1 for header */
- iov = kzalloc((wdata->nr_pages + 1) * sizeof(*iov), GFP_NOFS);
+ rqst.rq_nvec = wdata->nr_pages + 1;
+ iov = kzalloc((rqst.rq_nvec) * sizeof(*iov), GFP_NOFS);
if (iov == NULL) {
rc = -ENOMEM;
goto async_writev_out;
}
+ rqst.rq_iov = iov;
smb->hdr.Pid = cpu_to_le16((__u16)wdata->pid);
smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16));
@@ -2104,8 +2110,8 @@ cifs_async_writev(struct cifs_writedata *wdata)
}
kref_get(&wdata->refcount);
- rc = cifs_call_async(tcon->ses->server, iov, wdata->nr_pages + 1,
- NULL, cifs_writev_callback, wdata, 0);
+ rc = cifs_call_async(tcon->ses->server, &rqst, NULL,
+ cifs_writev_callback, wdata, 0);
if (rc == 0)
cifs_stats_inc(&tcon->stats.cifs_stats.num_writes);