[Suspend2][ 06/32] [Suspend2] Cleanup some completed I/O

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 19:14:48 EST


Iterate through the read_for_cleanup list, cleaning up a maximum of
submit_batch_size completed pages.

Signed-off-by: Nigel Cunningham <nigel@xxxxxxxxxxxx>

kernel/power/suspend_block_io.c | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/kernel/power/suspend_block_io.c b/kernel/power/suspend_block_io.c
index 037535b..cfff687 100644
--- a/kernel/power/suspend_block_io.c
+++ b/kernel/power/suspend_block_io.c
@@ -229,7 +229,7 @@ static void __suspend_bio_cleanup_one(st
io_info->flags = 0;
}

-/* suspend_bio_cleanup_one
+/* __suspend_io_cleanup
*/

static int suspend_bio_cleanup_one(void *data)
@@ -275,3 +275,38 @@ static int suspend_bio_cleanup_one(void
return 0;
}

+/* suspend_cleanup_some_completed_io
+ *
+ * NB: This is designed so that multiple callers can be in here simultaneously.
+ */
+
+static void suspend_cleanup_some_completed_io(void)
+{
+ int num_cleaned = 0;
+ struct io_info *first;
+ unsigned long flags;
+
+ spin_lock_irqsave(&ioinfo_ready_lock, flags);
+ while(!list_empty(&ioinfo_ready_for_cleanup)) {
+ int result;
+ first = list_entry(ioinfo_ready_for_cleanup.next,
+ struct io_info, list);
+
+ BUG_ON(!test_and_clear_bit(IO_AWAITING_CLEANUP, &first->flags));
+
+ list_del_init(&first->list);
+
+ spin_unlock_irqrestore(&ioinfo_ready_lock, flags);
+
+ result = suspend_bio_cleanup_one((void *) first);
+
+ spin_lock_irqsave(&ioinfo_ready_lock, flags);
+ if (result)
+ continue;
+ num_cleaned++;
+ if (num_cleaned == submit_batch_size)
+ break;
+ }
+ spin_unlock_irqrestore(&ioinfo_ready_lock, flags);
+}
+

--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/