v2.6.22.22-op2-rc1
[linux-2.6.22.y-op-patches.git] / release-2.6.22.y / 2.6.22.22-op1 / KAIO-aio-account_IO-wait-time-properly.patch
blobfcc735b41fa3c5e8392b82e67e17851c9b08f848
1 From 41d10da3717409de33d5441f2f6d8f072ab3fbb6 Mon Sep 17 00:00:00 2001
2 From: Jeff Moyer <jmoyer@redhat.com>
3 Date: Tue, 16 Oct 2007 23:27:20 -0700
4 Subject: [PATCH] aio: account I/O wait time properly
6 Some months back I proposed changing the schedule() call in
7 read_events to an io_schedule():
8 http://osdir.com/ml/linux.kernel.aio.general/2006-10/msg00024.html
9 This was rejected as there are AIO operations that do not initiate
10 disk I/O. I've had another look at the problem, and the only AIO
11 operation that will not initiate disk I/O is IOCB_CMD_NOOP. However,
12 this command isn't even wired up!
14 Given that it doesn't work, and hasn't for *years*, I'm going to
15 suggest again that we do proper I/O accounting when using AIO.
17 Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
18 Acked-by: Zach Brown <zach.brown@oracle.com>
19 Cc: Benjamin LaHaise <bcrl@kvack.org>
20 Cc: Suparna Bhattacharya <suparna@in.ibm.com>
21 Cc: Badari Pulavarty <pbadari@us.ibm.com>
22 Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
23 Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24 Signed-off-by: Oliver Pinter <oliver.pntr@gmail.com>
26 diff --git a/fs/aio.c b/fs/aio.c
27 index ea2e198..d02f43b 100644
28 --- a/fs/aio.c
29 +++ b/fs/aio.c
30 @@ -303,7 +303,7 @@ static void wait_for_all_aios(struct kioctx *ctx)
31 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
32 while (ctx->reqs_active) {
33 spin_unlock_irq(&ctx->ctx_lock);
34 - schedule();
35 + io_schedule();
36 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
37 spin_lock_irq(&ctx->ctx_lock);
39 @@ -323,7 +323,7 @@ ssize_t fastcall wait_on_sync_kiocb(struct kiocb *iocb)
40 set_current_state(TASK_UNINTERRUPTIBLE);
41 if (!iocb->ki_users)
42 break;
43 - schedule();
44 + io_schedule();
46 __set_current_state(TASK_RUNNING);
47 return iocb->ki_user_data;
48 @@ -1170,7 +1170,7 @@ retry:
49 ret = 0;
50 if (to.timed_out) /* Only check after read evt */
51 break;
52 - schedule();
53 + io_schedule();
54 if (signal_pending(tsk)) {
55 ret = -EINTR;
56 break;