[Suspend2][ 07/19] [Suspend2] Cleanup modules after doing I/O on a portion of the image.

[Suspend2][ 07/19] [Suspend2] Cleanup modules after doing I/O on a portion of the image.

Post by Nigel Cunn » Wed, 28 Jun 2006 08:30:20

Flush any pending I/O (writes only), and cleanup modules using in doing the
I/O.

Signed-off-by: Nigel Cunningham < XXXX@XXXXX.COM >

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

diff --git a/kernel/power/io.c b/kernel/power/io.c
index 401789d..be13f42 100644
--- a/kernel/power/io.c
+++ b/kernel/power/io.c
@@ -206,3 +206,38 @@ static int rw_init_modules(int rw, int w
return 0;
}

+/*
+ * rw_cleanup_modules
+ *
+ * Cleanup components after reading or writing a set of pages.
+ * Only the writer may fail.
+ */
+static int rw_cleanup_modules(int rw)
+{
+ struct suspend_module_ops *this_module;
+ int result = 0;
+
+ /* Cleanup other modules */
+ list_for_each_entry(this_module, &suspend_modules, module_list) {
+ if (this_module->disabled)
+ continue;
+ if ((this_module->type == FILTER_MODULE) ||
+ (this_module->type == WRITER_MODULE))
+ continue;
+ if (this_module->rw_cleanup)
+ result |= this_module->rw_cleanup(rw);
+ }
+
+ /* Flush data and cleanup */
+ list_for_each_entry(this_module, &suspend_filters, type_list) {
+ if (this_module->disabled)
+ continue;
+ if (this_module->rw_cleanup)
+ result |= this_module->rw_cleanup(rw);
+ }
+
+ result |= suspend_active_writer->rw_cleanup(rw);
+
+ return result;
+}
+

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 XXXX@XXXXX.COM
More majordomo info at http://www.yqcomputer.com/
Please read the FAQ at http://www.yqcomputer.com/