[Suspend2][ 20/32] [Suspend2] Return memory needed for block io.

From: Nigel Cunningham
Date: Mon Jun 26 2006 - 19:11:30 EST


Return the maximum amount of memory needed for block io.

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

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

diff --git a/kernel/power/suspend_block_io.c b/kernel/power/suspend_block_io.c
index 555d4fa..6e0f22c 100644
--- a/kernel/power/suspend_block_io.c
+++ b/kernel/power/suspend_block_io.c
@@ -766,3 +766,12 @@ static int suspend_bdev_page_io(int rw,
return suspend_do_io(rw, &submit_info, 1);
}

+static unsigned long suspend_bio_memory_needed(void)
+{
+ /* We want to have at least enough memory so as to have
+ * MAX_OUTSTANDING_IO transactions on the fly at once. If we
+ * can to more, fine. */
+ return (MAX_OUTSTANDING_IO * (PAGE_SIZE + sizeof(struct request) +
+ sizeof(struct bio) + sizeof(struct io_info)));
+}
+

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