diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-09-19 09:22:34 -0400 |
---|---|---|
committer | Steve French <smfrench@gmail.com> | 2012-09-24 22:46:32 -0400 |
commit | 5819575ec6b82345e1a21a960d381c699a91c700 (patch) | |
tree | 9ffe9d41ddbc8009c7ecbf132533d5d1315f0f13 /fs/cifs | |
parent | 8321fec436050b586cee448f2da0a6999e5172dd (diff) |
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/cifs')
-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 93e16200b2e8..79e8b6f06021 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -981,10 +981,9 @@ struct cifs_readdata { | |||
981 | int (*read_into_pages)(struct TCP_Server_Info *server, | 981 | int (*read_into_pages)(struct TCP_Server_Info *server, |
982 | struct cifs_readdata *rdata, | 982 | struct cifs_readdata *rdata, |
983 | unsigned int len); | 983 | unsigned int len); |
984 | struct kvec iov; | ||
984 | unsigned int pagesz; | 985 | unsigned int pagesz; |
985 | unsigned int tailsz; | 986 | unsigned int tailsz; |
986 | unsigned int nr_iov; | ||
987 | struct kvec *iov; | ||
988 | unsigned int nr_pages; | 987 | unsigned int nr_pages; |
989 | struct page *pages[]; | 988 | struct page *pages[]; |
990 | }; | 989 | }; |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 5d7bd757dcf1..88bbb3ef95b3 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) | |||
1436 | len = min_t(unsigned int, buflen, server->vals->read_rsp_size) - | 1436 | len = min_t(unsigned int, buflen, server->vals->read_rsp_size) - |
1437 | HEADER_SIZE(server) + 1; | 1437 | HEADER_SIZE(server) + 1; |
1438 | 1438 | ||
1439 | rdata->iov[0].iov_base = buf + HEADER_SIZE(server) - 1; | 1439 | rdata->iov.iov_base = buf + HEADER_SIZE(server) - 1; |
1440 | rdata->iov[0].iov_len = len; | 1440 | rdata->iov.iov_len = len; |
1441 | 1441 | ||
1442 | length = cifs_readv_from_socket(server, rdata->iov, 1, len); | 1442 | length = cifs_readv_from_socket(server, &rdata->iov, 1, len); |
1443 | if (length < 0) | 1443 | if (length < 0) |
1444 | return length; | 1444 | return length; |
1445 | server->total_read += length; | 1445 | server->total_read += length; |
@@ -1485,20 +1485,19 @@ cifs_readv_receive(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |||
1485 | len = data_offset - server->total_read; | 1485 | len = data_offset - server->total_read; |
1486 | if (len > 0) { | 1486 | if (len > 0) { |
1487 | /* read any junk before data into the rest of smallbuf */ | 1487 | /* read any junk before data into the rest of smallbuf */ |
1488 | rdata->iov[0].iov_base = buf + server->total_read; | 1488 | rdata->iov.iov_base = buf + server->total_read; |
1489 | rdata->iov[0].iov_len = len; | 1489 | rdata->iov.iov_len = len; |
1490 | length = cifs_readv_from_socket(server, rdata->iov, 1, len); | 1490 | length = cifs_readv_from_socket(server, &rdata->iov, 1, len); |
1491 | if (length < 0) | 1491 | if (length < 0) |
1492 | return length; | 1492 | return length; |
1493 | server->total_read += length; | 1493 | server->total_read += length; |
1494 | } | 1494 | } |
1495 | 1495 | ||
1496 | /* set up first iov for signature check */ | 1496 | /* set up first iov for signature check */ |
1497 | rdata->iov[0].iov_base = buf; | 1497 | rdata->iov.iov_base = buf; |
1498 | rdata->iov[0].iov_len = server->total_read; | 1498 | rdata->iov.iov_len = server->total_read; |
1499 | rdata->nr_iov = 1; | ||
1500 | cFYI(1, "0: iov_base=%p iov_len=%zu", | 1499 | cFYI(1, "0: iov_base=%p iov_len=%zu", |
1501 | rdata->iov[0].iov_base, rdata->iov[0].iov_len); | 1500 | rdata->iov.iov_base, rdata->iov.iov_len); |
1502 | 1501 | ||
1503 | /* how much data is in the response? */ | 1502 | /* how much data is in the response? */ |
1504 | data_len = server->ops->read_data_length(buf); | 1503 | data_len = server->ops->read_data_length(buf); |
@@ -1532,8 +1531,8 @@ cifs_readv_callback(struct mid_q_entry *mid) | |||
1532 | struct cifs_readdata *rdata = mid->callback_data; | 1531 | struct cifs_readdata *rdata = mid->callback_data; |
1533 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); | 1532 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); |
1534 | struct TCP_Server_Info *server = tcon->ses->server; | 1533 | struct TCP_Server_Info *server = tcon->ses->server; |
1535 | struct smb_rqst rqst = { .rq_iov = rdata->iov, | 1534 | struct smb_rqst rqst = { .rq_iov = &rdata->iov, |
1536 | .rq_nvec = rdata->nr_iov, | 1535 | .rq_nvec = 1, |
1537 | .rq_pages = rdata->pages, | 1536 | .rq_pages = rdata->pages, |
1538 | .rq_npages = rdata->nr_pages, | 1537 | .rq_npages = rdata->nr_pages, |
1539 | .rq_pagesz = rdata->pagesz, | 1538 | .rq_pagesz = rdata->pagesz, |
@@ -1580,7 +1579,7 @@ cifs_async_readv(struct cifs_readdata *rdata) | |||
1580 | READ_REQ *smb = NULL; | 1579 | READ_REQ *smb = NULL; |
1581 | int wct; | 1580 | int wct; |
1582 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); | 1581 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); |
1583 | struct smb_rqst rqst = { .rq_iov = rdata->iov, | 1582 | struct smb_rqst rqst = { .rq_iov = &rdata->iov, |
1584 | .rq_nvec = 1 }; | 1583 | .rq_nvec = 1 }; |
1585 | 1584 | ||
1586 | cFYI(1, "%s: offset=%llu bytes=%u", __func__, | 1585 | cFYI(1, "%s: offset=%llu bytes=%u", __func__, |
@@ -1621,8 +1620,8 @@ cifs_async_readv(struct cifs_readdata *rdata) | |||
1621 | } | 1620 | } |
1622 | 1621 | ||
1623 | /* 4 for RFC1001 length + 1 for BCC */ | 1622 | /* 4 for RFC1001 length + 1 for BCC */ |
1624 | rdata->iov[0].iov_base = smb; | 1623 | rdata->iov.iov_base = smb; |
1625 | rdata->iov[0].iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; | 1624 | rdata->iov.iov_len = be32_to_cpu(smb->hdr.smb_buf_length) + 4; |
1626 | 1625 | ||
1627 | kref_get(&rdata->refcount); | 1626 | kref_get(&rdata->refcount); |
1628 | rc = cifs_call_async(tcon->ses->server, &rqst, cifs_readv_receive, | 1627 | rc = cifs_call_async(tcon->ses->server, &rqst, cifs_readv_receive, |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index f3f1b1098a6c..2421ec28df14 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -2413,11 +2413,6 @@ static struct cifs_readdata * | |||
2413 | cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) | 2413 | cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) |
2414 | { | 2414 | { |
2415 | struct cifs_readdata *rdata; | 2415 | struct cifs_readdata *rdata; |
2416 | struct kvec *iov; | ||
2417 | |||
2418 | iov = kzalloc(sizeof(*iov) * (nr_pages + 1), GFP_KERNEL); | ||
2419 | if (!iov) | ||
2420 | return (struct cifs_readdata *)iov; | ||
2421 | 2416 | ||
2422 | rdata = kzalloc(sizeof(*rdata) + (sizeof(struct page *) * nr_pages), | 2417 | rdata = kzalloc(sizeof(*rdata) + (sizeof(struct page *) * nr_pages), |
2423 | GFP_KERNEL); | 2418 | GFP_KERNEL); |
@@ -2426,9 +2421,6 @@ cifs_readdata_alloc(unsigned int nr_pages, work_func_t complete) | |||
2426 | INIT_LIST_HEAD(&rdata->list); | 2421 | INIT_LIST_HEAD(&rdata->list); |
2427 | init_completion(&rdata->done); | 2422 | init_completion(&rdata->done); |
2428 | INIT_WORK(&rdata->work, complete); | 2423 | INIT_WORK(&rdata->work, complete); |
2429 | rdata->iov = iov; | ||
2430 | } else { | ||
2431 | kfree(iov); | ||
2432 | } | 2424 | } |
2433 | 2425 | ||
2434 | return rdata; | 2426 | return rdata; |
@@ -2443,7 +2435,6 @@ cifs_readdata_release(struct kref *refcount) | |||
2443 | if (rdata->cfile) | 2435 | if (rdata->cfile) |
2444 | cifsFileInfo_put(rdata->cfile); | 2436 | cifsFileInfo_put(rdata->cfile); |
2445 | 2437 | ||
2446 | kfree(rdata->iov); | ||
2447 | kfree(rdata); | 2438 | kfree(rdata); |
2448 | } | 2439 | } |
2449 | 2440 | ||
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c index e3efa47cd6ec..1b447612200e 100644 --- a/fs/cifs/smb2pdu.c +++ b/fs/cifs/smb2pdu.c | |||
@@ -1297,9 +1297,9 @@ smb2_readv_callback(struct mid_q_entry *mid) | |||
1297 | struct cifs_readdata *rdata = mid->callback_data; | 1297 | struct cifs_readdata *rdata = mid->callback_data; |
1298 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); | 1298 | struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); |
1299 | struct TCP_Server_Info *server = tcon->ses->server; | 1299 | struct TCP_Server_Info *server = tcon->ses->server; |
1300 | struct smb2_hdr *buf = (struct smb2_hdr *)rdata->iov[0].iov_base; | 1300 | struct smb2_hdr *buf = (struct smb2_hdr *)rdata->iov.iov_base; |
1301 | unsigned int credits_received = 1; | 1301 | unsigned int credits_received = 1; |
1302 | struct smb_rqst rqst = { .rq_iov = rdata->iov, | 1302 | struct smb_rqst rqst = { .rq_iov = &rdata->iov, |
1303 | .rq_nvec = 1, | 1303 | .rq_nvec = 1, |
1304 | .rq_pages = rdata->pages, | 1304 | .rq_pages = rdata->pages, |
1305 | .rq_npages = rdata->nr_pages, | 1305 | .rq_npages = rdata->nr_pages, |
@@ -1350,7 +1350,7 @@ smb2_async_readv(struct cifs_readdata *rdata) | |||
1350 | int rc; | 1350 | int rc; |
1351 | struct smb2_hdr *buf; | 1351 | struct smb2_hdr *buf; |
1352 | struct cifs_io_parms io_parms; | 1352 | struct cifs_io_parms io_parms; |
1353 | struct smb_rqst rqst = { .rq_iov = rdata->iov, | 1353 | struct smb_rqst rqst = { .rq_iov = &rdata->iov, |
1354 | .rq_nvec = 1 }; | 1354 | .rq_nvec = 1 }; |
1355 | 1355 | ||
1356 | cFYI(1, "%s: offset=%llu bytes=%u", __func__, | 1356 | cFYI(1, "%s: offset=%llu bytes=%u", __func__, |
@@ -1362,13 +1362,13 @@ smb2_async_readv(struct cifs_readdata *rdata) | |||
1362 | io_parms.persistent_fid = rdata->cfile->fid.persistent_fid; | 1362 | io_parms.persistent_fid = rdata->cfile->fid.persistent_fid; |
1363 | io_parms.volatile_fid = rdata->cfile->fid.volatile_fid; | 1363 | io_parms.volatile_fid = rdata->cfile->fid.volatile_fid; |
1364 | io_parms.pid = rdata->pid; | 1364 | io_parms.pid = rdata->pid; |
1365 | rc = smb2_new_read_req(&rdata->iov[0], &io_parms, 0, 0); | 1365 | rc = smb2_new_read_req(&rdata->iov, &io_parms, 0, 0); |
1366 | if (rc) | 1366 | if (rc) |
1367 | return rc; | 1367 | return rc; |
1368 | 1368 | ||
1369 | buf = (struct smb2_hdr *)rdata->iov[0].iov_base; | 1369 | buf = (struct smb2_hdr *)rdata->iov.iov_base; |
1370 | /* 4 for rfc1002 length field */ | 1370 | /* 4 for rfc1002 length field */ |
1371 | rdata->iov[0].iov_len = get_rfc1002_length(rdata->iov[0].iov_base) + 4; | 1371 | rdata->iov.iov_len = get_rfc1002_length(rdata->iov.iov_base) + 4; |
1372 | 1372 | ||
1373 | kref_get(&rdata->refcount); | 1373 | kref_get(&rdata->refcount); |
1374 | rc = cifs_call_async(io_parms.tcon->ses->server, &rqst, | 1374 | rc = cifs_call_async(io_parms.tcon->ses->server, &rqst, |