* [PATCH] Move swap allocation routines to swap.c
@ 2006-10-23 4:16 Nigel Cunningham
2006-10-23 10:47 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Nigel Cunningham @ 2006-10-23 4:16 UTC (permalink / raw)
To: Andrew Morton, Rafael J. Wysocki, LKML
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
*
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Move swap allocation routines to swap.c
2006-10-23 4:16 [PATCH] Move swap allocation routines to swap.c Nigel Cunningham
@ 2006-10-23 10:47 ` Rafael J. Wysocki
2006-10-23 11:49 ` Nigel Cunningham
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2006-10-23 10:47 UTC (permalink / raw)
To: Nigel Cunningham; +Cc: Andrew Morton, LKML, Pavel Machek
On Monday, 23 October 2006 06:16, Nigel Cunningham wrote:
> Move swap allocation routines from swsusp.c to swap.c, so that all of
> the swap related stuff really is in swap.c.
The original idea was to keep that in swsusp.c because it was also used by
some code in user.c.
I'd like it to stay as is.
Greetings,
Rafael
--
You never change things by fighting the existing reality.
R. Buckminster Fuller
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Move swap allocation routines to swap.c
2006-10-23 10:47 ` Rafael J. Wysocki
@ 2006-10-23 11:49 ` Nigel Cunningham
2006-10-23 14:07 ` Rafael J. Wysocki
0 siblings, 1 reply; 5+ messages in thread
From: Nigel Cunningham @ 2006-10-23 11:49 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andrew Morton, LKML, Pavel Machek
Hi.
On Mon, 2006-10-23 at 12:47 +0200, Rafael J. Wysocki wrote:
> On Monday, 23 October 2006 06:16, Nigel Cunningham wrote:
> > Move swap allocation routines from swsusp.c to swap.c, so that all of
> > the swap related stuff really is in swap.c.
>
> The original idea was to keep that in swsusp.c because it was also used by
> some code in user.c.
>
> I'd like it to stay as is.
The other code in swap.c is also used by user.c.
Regards,
Nigel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Move swap allocation routines to swap.c
2006-10-23 11:49 ` Nigel Cunningham
@ 2006-10-23 14:07 ` Rafael J. Wysocki
2006-10-23 23:11 ` Nigel Cunningham
0 siblings, 1 reply; 5+ messages in thread
From: Rafael J. Wysocki @ 2006-10-23 14:07 UTC (permalink / raw)
To: Nigel Cunningham; +Cc: Andrew Morton, LKML, Pavel Machek
On Monday, 23 October 2006 13:49, Nigel Cunningham wrote:
> Hi.
>
> On Mon, 2006-10-23 at 12:47 +0200, Rafael J. Wysocki wrote:
> > On Monday, 23 October 2006 06:16, Nigel Cunningham wrote:
> > > Move swap allocation routines from swsusp.c to swap.c, so that all of
> > > the swap related stuff really is in swap.c.
> >
> > The original idea was to keep that in swsusp.c because it was also used by
> > some code in user.c.
> >
> > I'd like it to stay as is.
>
> The other code in swap.c is also used by user.c.
Er, which one?
Rafael
--
You never change things by fighting the existing reality.
R. Buckminster Fuller
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Move swap allocation routines to swap.c
2006-10-23 14:07 ` Rafael J. Wysocki
@ 2006-10-23 23:11 ` Nigel Cunningham
0 siblings, 0 replies; 5+ messages in thread
From: Nigel Cunningham @ 2006-10-23 23:11 UTC (permalink / raw)
To: Rafael J. Wysocki; +Cc: Andrew Morton, LKML, Pavel Machek
Hi.
On Mon, 2006-10-23 at 16:07 +0200, Rafael J. Wysocki wrote:
> On Monday, 23 October 2006 13:49, Nigel Cunningham wrote:
> > Hi.
> >
> > On Mon, 2006-10-23 at 12:47 +0200, Rafael J. Wysocki wrote:
> > > On Monday, 23 October 2006 06:16, Nigel Cunningham wrote:
> > > > Move swap allocation routines from swsusp.c to swap.c, so that all of
> > > > the swap related stuff really is in swap.c.
> > >
> > > The original idea was to keep that in swsusp.c because it was also used by
> > > some code in user.c.
> > >
> > > I'd like it to stay as is.
> >
> > The other code in swap.c is also used by user.c.
>
> Er, which one?
(Looks more)... ah. Maybe I'm confused. I'm still getting to grips with
your code and it's complicated :)
Regards,
Nigel
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-10-23 23:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-23 4:16 [PATCH] Move swap allocation routines to swap.c Nigel Cunningham
2006-10-23 10:47 ` 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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox