Messages in this thread Patch in this message | | | From | Nigel Cunningham <> | Subject | [Suspend2][ 15/32] [Suspend2] Submit batched i/o. | Date | Tue, 27 Jun 2006 08:38:00 +1000 |
| |
Submit a group of pages that have been batched up.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
kernel/power/suspend_block_io.c | 42 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_block_io.c b/kernel/power/suspend_block_io.c index 4d489f4..07db518 100644 --- a/kernel/power/suspend_block_io.c +++ b/kernel/power/suspend_block_io.c @@ -514,3 +514,45 @@ static int submit(int rw, struct io_info return error; } +/* + * submit a batch. The submit function can wait on I/O, so we have + * simple locking to avoid infinite recursion. + */ +static int submit_batched(void) +{ + static int running_already = 0; + struct io_info *first; + unsigned long flags; + int num_submitted = 0; + + running_already = 1; + spin_lock_irqsave(&ioinfo_submit_lock, flags); + while(!list_empty(&ioinfo_submit_batch)) { + first = list_entry(ioinfo_submit_batch.next, struct io_info, + list); + + BUG_ON(!test_and_clear_bit(IO_AWAITING_SUBMIT, &first->flags)); + + list_del_init(&first->list); + + atomic_dec(&submit_batch); + + spin_unlock_irqrestore(&ioinfo_submit_lock, flags); + + if (test_bit(IO_AWAITING_READ, &first->flags)) + submit(READ, first); + else + submit(WRITE, first); + + spin_lock_irqsave(&ioinfo_submit_lock, flags); + + num_submitted++; + if (num_submitted == submit_batch_size) + break; + } + spin_unlock_irqrestore(&ioinfo_submit_lock, flags); + running_already = 0; + + return num_submitted; +} + -- Nigel Cunningham nigel at suspend2 dot net - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |