diff options
author | Gu Zheng <guz.fnst@cn.fujitsu.com> | 2014-07-23 06:03:54 -0400 |
---|---|---|
committer | Benjamin LaHaise <bcrl@kvack.org> | 2014-07-24 10:59:40 -0400 |
commit | 00fefb9cf2b5493a86912de55ba912bdfae4a207 (patch) | |
tree | 27ffb37b15e486de6031c7179eea3ba6bcee3e2b /fs | |
parent | 2be4e7deec2d4398a0eb2165cc04086ebfc831d2 (diff) |
aio: use iovec array rather than the single one
Previously, we only offer a single iovec to handle all the read/write cases, so
the PREADV/PWRITEV request always need to alloc more iovec buffer when copying
user vectors.
If we use a tmp iovec array rather than the single one, some small PREADV/PWRITEV
workloads(vector size small than the tmp buffer) will not need to alloc more
iovec buffer when copying user vectors.
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Gu Zheng <guz.fnst@cn.fujitsu.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1243,12 +1243,12 @@ static ssize_t aio_setup_vectored_rw(struct kiocb *kiocb, | |||
1243 | if (compat) | 1243 | if (compat) |
1244 | ret = compat_rw_copy_check_uvector(rw, | 1244 | ret = compat_rw_copy_check_uvector(rw, |
1245 | (struct compat_iovec __user *)buf, | 1245 | (struct compat_iovec __user *)buf, |
1246 | *nr_segs, 1, *iovec, iovec); | 1246 | *nr_segs, UIO_FASTIOV, *iovec, iovec); |
1247 | else | 1247 | else |
1248 | #endif | 1248 | #endif |
1249 | ret = rw_copy_check_uvector(rw, | 1249 | ret = rw_copy_check_uvector(rw, |
1250 | (struct iovec __user *)buf, | 1250 | (struct iovec __user *)buf, |
1251 | *nr_segs, 1, *iovec, iovec); | 1251 | *nr_segs, UIO_FASTIOV, *iovec, iovec); |
1252 | if (ret < 0) | 1252 | if (ret < 0) |
1253 | return ret; | 1253 | return ret; |
1254 | 1254 | ||
@@ -1285,7 +1285,7 @@ static ssize_t aio_run_iocb(struct kiocb *req, unsigned opcode, | |||
1285 | fmode_t mode; | 1285 | fmode_t mode; |
1286 | aio_rw_op *rw_op; | 1286 | aio_rw_op *rw_op; |
1287 | rw_iter_op *iter_op; | 1287 | rw_iter_op *iter_op; |
1288 | struct iovec inline_vec, *iovec = &inline_vec; | 1288 | struct iovec inline_vecs[UIO_FASTIOV], *iovec = inline_vecs; |
1289 | struct iov_iter iter; | 1289 | struct iov_iter iter; |
1290 | 1290 | ||
1291 | switch (opcode) { | 1291 | switch (opcode) { |
@@ -1320,7 +1320,7 @@ rw_common: | |||
1320 | if (!ret) | 1320 | if (!ret) |
1321 | ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); | 1321 | ret = rw_verify_area(rw, file, &req->ki_pos, req->ki_nbytes); |
1322 | if (ret < 0) { | 1322 | if (ret < 0) { |
1323 | if (iovec != &inline_vec) | 1323 | if (iovec != inline_vecs) |
1324 | kfree(iovec); | 1324 | kfree(iovec); |
1325 | return ret; | 1325 | return ret; |
1326 | } | 1326 | } |
@@ -1367,7 +1367,7 @@ rw_common: | |||
1367 | return -EINVAL; | 1367 | return -EINVAL; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | if (iovec != &inline_vec) | 1370 | if (iovec != inline_vecs) |
1371 | kfree(iovec); | 1371 | kfree(iovec); |
1372 | 1372 | ||
1373 | if (ret != -EIOCBQUEUED) { | 1373 | if (ret != -EIOCBQUEUED) { |