Add support for remembering a position and restoring it later. This is used
to divide the storage into streams (the header, and two parts to the data
proper).
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/extent.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/kernel/power/extent.c b/kernel/power/extent.c
index 248e4de..a3b9569 100644
--- a/kernel/power/extent.c
+++ b/kernel/power/extent.c
@@ -260,3 +260,50 @@ void suspend_extent_state_goto_start(str
state->current_offset = 0;
}
+/* suspend_extent_start_save
+ *
+ * Given a state and a struct extent_state_store, save the crreutn
+ * position in a format that can be used with relocated chains (at
+ * resume time).
+ */
+void suspend_extent_state_save(struct extent_iterate_state *state,
+ struct extent_iterate_saved_state *saved_state)
+{
+ struct extent *extent;
+
+ saved_state->chain_num = state->current_chain;
+ saved_state->extent_num = 0;
+ saved_state->offset = state->current_offset;
+
+ if (saved_state->chain_num == -1)
+ return;
+
+ extent = (state->chains + state->current_chain)->first;
+
+ while (extent != state->current_extent) {
+ saved_state->extent_num++;
+ extent = extent->next;
+ }
+}
+
+/* suspend_extent_start_restore
+ *
+ * Restore the position saved by extent_state_save.
+ */
+void suspend_extent_state_restore(struct extent_iterate_state *state,
+ struct extent_iterate_saved_state *saved_state)
+{
+ int posn = saved_state->extent_num;
+
+ if (saved_state->chain_num == -1) {
+ suspend_extent_state_goto_start(state);
+ return;
+ }
+
+ state->current_chain = saved_state->chain_num;
+ state->current_extent = (state->chains + state->current_chain)->first;
+ state->current_offset = saved_state->offset;
+
+ while (posn--)
+ state->current_extent = state->current_extent->next;
+}
--
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]