add AIO patch to queue-2.6.22.y
[linux-2.6.22.y-op-patches.git] / queue-2.6.22.y / KAIO-aio-account_IO-wait-time-properly.patch
blob6b1b85bd5d1eb7ec87de4cb5348f9ecb81267756
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>
25 diff --git a/fs/aio.c b/fs/aio.c
26 index ea2e198..d02f43b 100644
27 --- a/fs/aio.c
28 +++ b/fs/aio.c
29 @@ -303,7 +303,7 @@ static void wait_for_all_aios(struct kioctx *ctx)
30 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
31 while (ctx->reqs_active) {
32 spin_unlock_irq(&ctx->ctx_lock);
33 - schedule();
34 + io_schedule();
35 set_task_state(tsk, TASK_UNINTERRUPTIBLE);
36 spin_lock_irq(&ctx->ctx_lock);
38 @@ -323,7 +323,7 @@ ssize_t fastcall wait_on_sync_kiocb(struct kiocb *iocb)
39 set_current_state(TASK_UNINTERRUPTIBLE);
40 if (!iocb->ki_users)
41 break;
42 - schedule();
43 + io_schedule();
45 __set_current_state(TASK_RUNNING);
46 return iocb->ki_user_data;
47 @@ -1170,7 +1170,7 @@ retry:
48 ret = 0;
49 if (to.timed_out) /* Only check after read evt */
50 break;
51 - schedule();
52 + io_schedule();
53 if (signal_pending(tsk)) {
54 ret = -EINTR;
55 break;