lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 13/32] [Suspend2] Suspend bio completion.
Date
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@suspend2.net>

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

\
 
 \ /
  Last update: 2006-06-27 01:17    [W:0.084 / U:4.708 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site