From: Nigel Cunningham <ncunningham@linuxmail.org>
To: Andrew Morton <akpm@osdl.org>, "Rafael J. Wysocki" <rjw@sisk.pl>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] Move swap allocation routines to swap.c
Date: Mon, 23 Oct 2006 14:16:04 +1000 [thread overview]
Message-ID: <1161576964.3466.12.camel@nigel.suspend2.net> (raw)
Move swap allocation routines from swsusp.c to swap.c, so that all of
the swap related stuff really is in swap.c.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index fc713d5..89b3d14 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -46,6 +46,33 @@ static struct swsusp_header {
static unsigned short root_swap = 0xffff;
+unsigned long alloc_swap_page(int swap, struct extent_chain *extents)
+{
+ swp_entry_t entry = get_swap_page_of_type(swap);
+ if (entry.val) {
+ unsigned long new_value = swap_entry_to_extent_val(entry);
+ suspend_add_to_extent_chain(extents, new_value, new_value);
+ }
+ return swp_offset(entry);
+}
+
+void free_all_swap_pages(int swap, struct extent_chain *extents)
+{
+ if (extents->first) {
+ /* Free swap entries */
+ struct extent *extentpointer;
+ unsigned long extentvalue;
+ swp_entry_t entry;
+ suspend_extent_for_each(extents, extentpointer,
+ extentvalue) {
+ entry = extent_val_to_swap_entry(extentvalue);
+ swap_free(entry);
+ }
+
+ suspend_put_extent_chain(extents);
+ }
+}
+
static int mark_swapfiles(swp_entry_t start)
{
int error;
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index aa8205c..7bed461 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -73,33 +73,6 @@ static inline int restore_highmem(void)
static inline unsigned int count_highmem_pages(void) { return 0; }
#endif
-unsigned long alloc_swap_page(int swap, struct extent_chain *extents)
-{
- swp_entry_t entry = get_swap_page_of_type(swap);
- if (entry.val) {
- unsigned long new_value = swap_entry_to_extent_val(entry);
- suspend_add_to_extent_chain(extents, new_value, new_value);
- }
- return swp_offset(entry);
-}
-
-void free_all_swap_pages(int swap, struct extent_chain *extents)
-{
- if (extents->first) {
- /* Free swap entries */
- struct extent *extentpointer;
- unsigned long extentvalue;
- swp_entry_t entry;
- suspend_extent_for_each(extents, extentpointer,
- extentvalue) {
- entry = extent_val_to_swap_entry(extentvalue);
- swap_free(entry);
- }
-
- suspend_put_extent_chain(extents);
- }
-}
-
/**
* swsusp_shrink_memory - Try to free as much memory as needed
*
next reply other threads:[~2006-10-23 4:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-23 4:16 Nigel Cunningham [this message]
2006-10-23 10:47 ` [PATCH] Move swap allocation routines to swap.c Rafael J. Wysocki
2006-10-23 11:49 ` Nigel Cunningham
2006-10-23 14:07 ` Rafael J. Wysocki
2006-10-23 23:11 ` 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=1161576964.3466.12.camel@nigel.suspend2.net \
--to=ncunningham@linuxmail.org \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@sisk.pl \
/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