Move swap allocation routines to swap.c
Subsystems (2)
PATCH 1/1 Move swap allocation routines to swap.c
Move swap allocation routines from swsusp.c to swap.c, so that all of the swap related stuff really is in swap.c.
kernel/power/swap.c +27 -0
@@ -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;
kernel/power/swsusp.c +0 -27
@@ -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 *
Quoted 2 lines · Nigel Cunningham
Move swap allocation routines from
swsusp.ctoswap.c, so that all of the swap related stuff really is inswap.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
Signature · 2 lines
You never change things by fighting the existing reality. R. Buckminster Fuller
Hi.
Quoted 8 lines · Rafael J. Wysocki
Quoted 2 lines · Nigel Cunningham
Move swap allocation routines from
swsusp.ctoswap.c, so that all of the swap related stuff really is inswap.c.The original idea was to keep that in
swsusp.cbecause it was also used by some code inuser.c.I'd like it to stay as is.
The other code in swap.c is also used by user.c.
Regards,
Nigel
Quoted 7 lines · Nigel Cunningham
Hi.
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Nigel Cunningham
Move swap allocation routines from
swsusp.ctoswap.c, so that all of the swap related stuff really is inswap.c.
Quoted 6 lines
Quoted 4 lines
The original idea was to keep that in
swsusp.cbecause it was also used by some code inuser.c.I'd like it to stay as is.
The other code in
swap.cis also used byuser.c.
Er, which one?
Rafael
Signature · 2 lines
You never change things by fighting the existing reality. R. Buckminster Fuller
Hi.
Quoted 8 lines · Rafael J. Wysocki
Quoted 7 lines · Nigel Cunningham
Hi.
Quoted 4 lines · Rafael J. Wysocki
Quoted 2 lines · Nigel Cunningham
Move swap allocation routines from
swsusp.ctoswap.c, so that all of the swap related stuff really is inswap.c.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
The original idea was to keep that in
swsusp.cbecause it was also used by some code inuser.c.I'd like it to stay as is.
The other code in
swap.cis also used byuser.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