diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-09-19 06:22:34 -0700 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 21:46:32 -0500 |
commit | 5819575ec6b82345e1a21a960d381c699a91c700 (patch) | |
tree | 9ffe9d41ddbc8009c7ecbf132533d5d1315f0f13 /fs | |
parent | 8321fec436050b586cee448f2da0a6999e5172dd (diff) | |
download | linux-3.10-5819575ec6b82345e1a21a960d381c699a91c700.tar.gz linux-3.10-5819575ec6b82345e1a21a960d381c699a91c700.tar.bz2 linux-3.10-5819575ec6b82345e1a21a960d381c699a91c700.zip |
cifs: replace kvec array in readdata with a single kvec
The array is no longer needed. We just need a single kvec to hold the
header for signature checking.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsglob.h | 3 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 29 | ||||
-rw-r--r-- | fs/cifs/file.c | 9 | ||||
-rw-r--r-- | fs/cifs/smb2pdu.c | 12 |
4 files changed, 21 insertions, 32 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 93e16200b2e..79e8b6f0602 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -981,10 +981,9 @@ struct cifs_readdata { int (*read_into_pages)(struct TCP_Server_Info *server, struct cifs_readdata *rdata, unsigned int len); + struct kvec iov; unsigned int pagesz; unsigned int tailsz; - unsigned int nr_iov; - struct kvec *iov; unsigned int nr_pages; struct page *pages[]; }; diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 5d7bd757dcf..88bbb3ef95b 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -1436,10 +1436,10 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) len = min_t(unsigned int, buflen, server->vals->read_rsp_size) - HEADER_SIZE(server) + 1; - rdata->iov[0].iov_base = buf + HEADER_SIZE(server) - 1; - rdata->iov[0].iov_len = len; + rdata->iov.iov_base = buf + HEADER_SIZE(server) - 1; + rdata->iov.iov_len = len; - length = cifs_readv_from_socket(server, rdata->iov, 1, len); + length = cifs_readv_from_socket(server, &rdata->iov, 1, len); if (length < 0) return length; server->total_read += length; @@ -1485,20 +1485,19 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) len = data_offset - server->total_read; if (len > 0) { /* read any junk before data into the rest of smallbuf */ - rdata->iov[0].iov_base = buf + server->total_read; - rdata->iov[0].iov_len = len; - length = cifs_readv_from_socket(server, rdata->iov, 1, len); + rdata->iov.iov_base = buf + server->total_read; + rdata->iov.iov_len = len; + length = cifs_readv_from_socket(server, &rdata->iov, 1, len); if (length < 0) return length; server->total_read += length; } /* 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; + rdata->iov.iov_base = buf; + rdata->iov.iov_len = server->total_read; cFYI(1, "0: iov_base=%p iov_len=%zu", - rdata->iov[0].iov_base, rdata->iov[0].iov_len); + rdata->iov.iov_base, rdata->iov.iov_len); /* how much data is in the response? */ data_len = server->ops->read_data_length(buf); @@ -1532,8 +1531,8 @@ cifs_readv_callback(struct mid_q_entry *mid) struct cifs_readdata *rdata = mid->callback_data; 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, + struct smb_rqst rqst = { .rq_iov = &rdata->iov, + .rq_nvec = 1, .rq_pages = rdata->pages, .rq_npages = rdata->nr_pages, .rq_pagesz = rdata->pagesz, @@ -1580,7 +1579,7 @@ 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, + struct smb_rqst rqst = { .rq_iov = &rdata->iov, .rq_nvec = 1 }; cFYI(1, "%s: offset=%llu bytes=%u", __func__, @@ -1621,8 +1620,8 @@ cifs_async_readv(struct cifs_readdata *rdata) } /* 4 for RFC1001 length + 1 for BCC */ - rdata->iov[0].iov_base = smb; - rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; + rdata->iov.iov_base = smb; + rdata->iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; kref_get(&rdata->refcount); rc = cifs_call_async(tcon->ses->server, &rqst, cifs_readv_receive, diff --git a/fs/cifs/file.c b/fs/cifs/file.c index f3f1b1098a6..2421ec28df1 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2413,11 +2413,6 @@ static struct cifs_readdata * cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) { struct cifs_readdata *rdata; - struct kvec *iov; - - iov = kzalloc(sizeof(*iov) * (nr_pages + 1), GFP_KERNEL); - if (!iov) - return (struct cifs_readdata *)iov; rdata = kzalloc(sizeof(*rdata) + (sizeof(struct page *) * nr_pages), GFP_KERNEL); @@ -2426,9 +2421,6 @@ cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) INIT_LIST_HEAD(&rdata->list); init_completion(&rdata->done); INIT_WORK(&rdata->work, complete); - rdata->iov = iov; - } else { - kfree(iov); } return rdata; @@ -2443,7 +2435,6 @@ cifs_readdata_release(struct kref *refcount) if (rdata->cfile) cifsFileInfo_put(rdata->cfile); - kfree(rdata->iov); kfree(rdata); } diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e3efa47cd6e..1b447612200 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c @@ -1297,9 +1297,9 @@ smb2_readv_callback(struct mid_q_entry *mid) struct cifs_readdata *rdata = mid->callback_data; struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); struct TCP_Server_Info *server = tcon->ses->server; - struct smb2_hdr *buf = (struct smb2_hdr *)rdata->iov[0].iov_base; + struct smb2_hdr *buf = (struct smb2_hdr *)rdata->iov.iov_base; unsigned int credits_received = 1; - struct smb_rqst rqst = { .rq_iov = rdata->iov, + struct smb_rqst rqst = { .rq_iov = &rdata->iov, .rq_nvec = 1, .rq_pages = rdata->pages, .rq_npages = rdata->nr_pages, @@ -1350,7 +1350,7 @@ smb2_async_readv(struct cifs_readdata *rdata) int rc; struct smb2_hdr *buf; struct cifs_io_parms io_parms; - struct smb_rqst rqst = { .rq_iov = rdata->iov, + struct smb_rqst rqst = { .rq_iov = &rdata->iov, .rq_nvec = 1 }; cFYI(1, "%s: offset=%llu bytes=%u", __func__, @@ -1362,13 +1362,13 @@ smb2_async_readv(struct cifs_readdata *rdata) io_parms.persistent_fid = rdata->cfile->fid.persistent_fid; io_parms.volatile_fid = rdata->cfile->fid.volatile_fid; io_parms.pid = rdata->pid; - rc = smb2_new_read_req(&rdata->iov[0], &io_parms, 0, 0); + rc = smb2_new_read_req(&rdata->iov, &io_parms, 0, 0); if (rc) return rc; - buf = (struct smb2_hdr *)rdata->iov[0].iov_base; + buf = (struct smb2_hdr *)rdata->iov.iov_base; /* 4 for rfc1002 length field */ - rdata->iov[0].iov_len = get_rfc1002_length(rdata->iov[0].iov_base) + 4; + rdata->iov.iov_len = get_rfc1002_length(rdata->iov.iov_base) + 4; kref_get(&rdata->refcount); rc = cifs_call_async(io_parms.tcon->ses->server, &rqst, |