diff options
author | Ken Chen <kenneth.w.chen@intel.com> | 2005-05-01 11:59:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-05-01 11:59:15 -0400 |
commit | 212079cf4ee99e492a57b817e796825d423a30bb (patch) | |
tree | 58f54e75ec697f89ba12b39614e937bb374a451d | |
parent | efcd5e3ab089496865571d22443dd3f514dae60c (diff) |
[PATCH] aio: remove superfluous kiocb member initialization
This patch removes superfluous kiocb member initialization in the AIO
allocation and deallocation path. For example, in really_put_req(),
right before kiocb is returned to slab, 5 variables are reset to NULL.
The same variables will be initialized at the kiocb allocation time,
so why bother reset them knowing that they will be set to valid data
at alloc time? Another example: ki_retry is initialized in __aio_get_req,
but is initialized again in io_submit_one.
Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>
Cc: Benjamin LaHaise <bcrl@kvack.org>
Cc: Suparna Bhattacharya <suparna@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/aio.c | 11 |
1 files changed, 1 insertions, 10 deletions
@@ -405,7 +405,6 @@ static struct kiocb fastcall *__aio_get_req(struct kioctx *ctx) | |||
405 | req->ki_ctx = ctx; | 405 | req->ki_ctx = ctx; |
406 | req->ki_cancel = NULL; | 406 | req->ki_cancel = NULL; |
407 | req->ki_retry = NULL; | 407 | req->ki_retry = NULL; |
408 | req->ki_obj.user = NULL; | ||
409 | req->ki_dtor = NULL; | 408 | req->ki_dtor = NULL; |
410 | req->private = NULL; | 409 | req->private = NULL; |
411 | INIT_LIST_HEAD(&req->ki_run_list); | 410 | INIT_LIST_HEAD(&req->ki_run_list); |
@@ -451,11 +450,6 @@ static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) | |||
451 | { | 450 | { |
452 | if (req->ki_dtor) | 451 | if (req->ki_dtor) |
453 | req->ki_dtor(req); | 452 | req->ki_dtor(req); |
454 | req->ki_ctx = NULL; | ||
455 | req->ki_filp = NULL; | ||
456 | req->ki_obj.user = NULL; | ||
457 | req->ki_dtor = NULL; | ||
458 | req->private = NULL; | ||
459 | kmem_cache_free(kiocb_cachep, req); | 453 | kmem_cache_free(kiocb_cachep, req); |
460 | ctx->reqs_active--; | 454 | ctx->reqs_active--; |
461 | 455 | ||
@@ -1515,8 +1509,7 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1515 | } | 1509 | } |
1516 | 1510 | ||
1517 | req->ki_filp = file; | 1511 | req->ki_filp = file; |
1518 | iocb->aio_key = req->ki_key; | 1512 | ret = put_user(req->ki_key, &user_iocb->aio_key); |
1519 | ret = put_user(iocb->aio_key, &user_iocb->aio_key); | ||
1520 | if (unlikely(ret)) { | 1513 | if (unlikely(ret)) { |
1521 | dprintk("EFAULT: aio_key\n"); | 1514 | dprintk("EFAULT: aio_key\n"); |
1522 | goto out_put_req; | 1515 | goto out_put_req; |
@@ -1531,8 +1524,6 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, | |||
1531 | req->ki_opcode = iocb->aio_lio_opcode; | 1524 | req->ki_opcode = iocb->aio_lio_opcode; |
1532 | init_waitqueue_func_entry(&req->ki_wait, aio_wake_function); | 1525 | init_waitqueue_func_entry(&req->ki_wait, aio_wake_function); |
1533 | INIT_LIST_HEAD(&req->ki_wait.task_list); | 1526 | INIT_LIST_HEAD(&req->ki_wait.task_list); |
1534 | req->ki_run_list.next = req->ki_run_list.prev = NULL; | ||
1535 | req->ki_retry = NULL; | ||
1536 | req->ki_retried = 0; | 1527 | req->ki_retried = 0; |
1537 | req->ki_kicked = 0; | 1528 | req->ki_kicked = 0; |
1538 | req->ki_queued = 0; | 1529 | req->ki_queued = 0; |