Perform i/o on a page, possibly waiting for completion.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/suspend_block_io.c | 44 +++++++++++++++++++++++++++++++++++++++
1 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend_block_io.c b/kernel/power/suspend_block_io.c
index 0d01483..555d4fa 100644
--- a/kernel/power/suspend_block_io.c
+++ b/kernel/power/suspend_block_io.c
@@ -722,3 +722,47 @@ static struct io_info *start_one(int rw,
return io_info;
}
+static int suspend_do_io(int rw,
+ struct submit_params *submit_info, int syncio)
+{
+ struct io_info *io_info;
+
+ if(!submit_info->dev) {
+ printk("Suspend_do_io: submit_info->dev is NULL!\n");
+ return 1;
+ }
+
+ io_info = start_one(rw, submit_info);
+
+ if (!io_info) {
+ printk("Unable to allocate an io_info struct.\n");
+ return 1;
+ } else if (syncio)
+ wait_on_one_page(io_info);
+
+ /* If we were the only one, clean everything up */
+ if (!atomic_read(&outstanding_io))
+ suspend_finish_all_io();
+ return 0;
+}
+
+/* We used to use bread here, but it doesn't correctly handle
+ * blocksize != PAGE_SIZE. Now we create a submit_info to get the data we
+ * want and use our normal routines (synchronously).
+ */
+
+static int suspend_bdev_page_io(int rw, struct block_device *bdev, long pos,
+ struct page *page)
+{
+ struct submit_params submit_info;
+
+ if (!bdev)
+ return 0;
+
+ submit_info.page = page;
+ submit_info.dev = bdev;
+ submit_info.block[0] = pos;
+ submit_info.readahead_index = -1;
+ return suspend_do_io(rw, &submit_info, 1);
+}
+
--
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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]