From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 8/9] [Suspend2] Extent state save and restore.
Date: Tue, 27 Jun 2006 02:54:32 +1000 [thread overview]
Message-ID: <20060626165431.11065.18807.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626165404.11065.91833.stgit@nigel.suspend2.net>
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 <nigel@suspend2.net>
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
next prev parent reply other threads:[~2006-06-26 16:58 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-26 16:54 [Suspend2][ 0/9] Extents support Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 1/9] [Suspend2] Extents header Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 2/9] [Suspend2] Extent allocation routines Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 3/9] [Suspend2] Free a whole extent chain Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 4/9] [Suspend2] Add extent to " Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 5/9] [Suspend2] Serialise extent chains Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 6/9] [Suspend2] Get next extent in an extent state Nigel Cunningham
2006-06-26 16:54 ` [Suspend2][ 7/9] [Suspend2] Extent state to the start Nigel Cunningham
2006-06-26 16:54 ` Nigel Cunningham [this message]
2006-06-26 16:54 ` [Suspend2][ 9/9] [Suspend2] Extent header Nigel Cunningham
2006-06-26 21:20 ` [Suspend2][ 0/9] Extents support Rafael J. Wysocki
2006-06-27 4:28 ` Nigel Cunningham
2006-06-27 5:36 ` Jens Axboe
2006-06-27 5:39 ` Nigel Cunningham
2006-06-27 7:05 ` Jens Axboe
2006-06-27 7:39 ` Nigel Cunningham
2006-06-27 7:59 ` Jens Axboe
2006-06-27 8:12 ` Greg KH
2006-06-27 8:22 ` Jens Axboe
2006-06-27 8:58 ` Nigel Cunningham
2006-06-28 21:11 ` Pavel Machek
2006-06-28 22:25 ` Nigel Cunningham
2006-06-28 22:44 ` Pavel Machek
2006-06-28 23:14 ` Nigel Cunningham
2006-06-30 17:36 ` Pavel Machek
2006-06-29 3:11 ` Martin J. Bligh
2006-06-27 9:07 ` Nigel Cunningham
2006-06-27 9:26 ` Rafael J. Wysocki
2006-06-27 9:35 ` Nigel Cunningham
2006-06-27 22:19 ` Rafael J. Wysocki
2006-06-27 23:47 ` Nigel Cunningham
2006-06-28 22:35 ` Rafael J. Wysocki
2006-06-28 23:26 ` Nigel Cunningham
2006-06-29 20:52 ` Rafael J. Wysocki
2006-06-30 17:58 ` Pavel Machek
2006-06-28 11:28 ` Rahul Karnik
2006-06-28 12:42 ` Nigel Cunningham
2006-06-28 14:42 ` Pekka Enberg
2006-06-28 23:37 ` Nigel Cunningham
2006-06-29 5:19 ` Pekka Enberg
2006-06-29 5:44 ` Nigel Cunningham
2006-06-29 21:11 ` Rafael J. Wysocki
2006-06-30 17:55 ` suspend2 merge [was Re: [Suspend2][ 0/9] Extents support.] Pavel Machek
2006-07-01 9:31 ` Dumitru Ciobarcianu
2006-06-28 22:41 ` [Suspend2][ 0/9] Extents support Rafael J. Wysocki
2006-06-28 14:37 ` Olivier Galibert
2006-06-28 21:05 ` Pavel Machek
2006-06-27 7:06 ` Greg KH
2006-06-27 7:27 ` Nigel Cunningham
2006-06-27 7:53 ` Greg KH
2006-06-27 9:08 ` Nigel Cunningham
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060626165431.11065.18807.stgit@nigel.suspend2.net \
--to=nigel@suspend2.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome