[Suspend2][ 13/32] [Suspend2] Suspend bio completion.

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 19:12:58 EST


Routine called in an interrupt context when block io completes. We move the
io_info struct from the busy list to the ready-for-cleanup list.

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

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

diff --git a/kernel/power/suspend_block_io.c b/kernel/power/suspend_block_io.c
index a1fcacb..288718c 100644
--- a/kernel/power/suspend_block_io.c
+++ b/kernel/power/suspend_block_io.c
@@ -436,3 +436,30 @@ static void suspend_cleanup_readahead(in
return;
}

+/*
+ * suspend_end_bio
+ *
+ * Description: Function called by block driver from interrupt context when I/O
+ * is completed. This is the reason we use spinlocks in
+ * manipulating the io_info lists.
+ * Nearly the fs/buffer.c version, but we want to mark the page as
+ * done in our own structures too.
+ */
+
+static int suspend_end_bio(struct bio *bio, unsigned int num, int err)
+{
+ struct io_info *io_info = bio->bi_private;
+ unsigned long flags;
+
+ spin_lock_irqsave(&ioinfo_busy_lock, flags);
+ list_del_init(&io_info->list);
+ spin_unlock_irqrestore(&ioinfo_busy_lock, flags);
+
+ set_bit(IO_AWAITING_CLEANUP, &io_info->flags);
+
+ spin_lock_irqsave(&ioinfo_ready_lock, flags);
+ list_add_tail(&io_info->list, &ioinfo_ready_for_cleanup);
+ spin_unlock_irqrestore(&ioinfo_ready_lock, flags);
+ return 0;
+}
+

--
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/