forked from torvalds/linux
Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MM: create new mm/swap.h header file.
Many functions declared in include/linux/swap.h are only used within mm/ Create a new "mm/swap.h" and move some of these declarations there. Remove the redundant 'extern' from the function declarations. Signed-off-by: NeilBrown <neilb@suse.de>
- Loading branch information
1 parent
6443c9d
commit 3dd9e64650d0340fd6469ba4f8abc183bb2eea15
Showing
12 changed files
with
139 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -33,6 +33,7 @@ | ||
| #include <asm/tlb.h> | ||
|
|
||
| #include "internal.h" | ||
| #include "swap.h" | ||
|
|
||
| struct madvise_walk_private { | ||
| struct mmu_gather *tlb; | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
|
|
||
| #ifdef CONFIG_SWAP | ||
| #include <linux/blk_types.h> /* for bio_end_io_t */ | ||
|
|
||
| /* linux/mm/page_io.c */ | ||
| int swap_readpage(struct page *page, bool do_poll); | ||
| int swap_writepage(struct page *page, struct writeback_control *wbc); | ||
| void end_swap_bio_write(struct bio *bio); | ||
| int __swap_writepage(struct page *page, struct writeback_control *wbc, | ||
| bio_end_io_t end_write_func); | ||
|
|
||
| /* linux/mm/swap_state.c */ | ||
| /* One swap address space for each 64M swap space */ | ||
| #define SWAP_ADDRESS_SPACE_SHIFT 14 | ||
| #define SWAP_ADDRESS_SPACE_PAGES (1 << SWAP_ADDRESS_SPACE_SHIFT) | ||
| extern struct address_space *swapper_spaces[]; | ||
| #define swap_address_space(entry) \ | ||
| (&swapper_spaces[swp_type(entry)][swp_offset(entry) \ | ||
| >> SWAP_ADDRESS_SPACE_SHIFT]) | ||
|
|
||
| void show_swap_cache_info(void); | ||
| int add_to_swap(struct page *page); | ||
| void *get_shadow_from_swap_cache(swp_entry_t entry); | ||
| int add_to_swap_cache(struct page *page, swp_entry_t entry, | ||
| gfp_t gfp, void **shadowp); | ||
| void __delete_from_swap_cache(struct page *page, | ||
| swp_entry_t entry, void *shadow); | ||
| void delete_from_swap_cache(struct page *); | ||
| void clear_shadow_from_swap_cache(int type, unsigned long begin, | ||
| unsigned long end); | ||
| void free_swap_cache(struct page *); | ||
| struct page *lookup_swap_cache(swp_entry_t entry, | ||
| struct vm_area_struct *vma, | ||
| unsigned long addr); | ||
| struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index); | ||
|
|
||
| struct page *read_swap_cache_async(swp_entry_t, gfp_t, | ||
| struct vm_area_struct *vma, | ||
| unsigned long addr, | ||
| bool do_poll); | ||
| struct page *__read_swap_cache_async(swp_entry_t, gfp_t, | ||
| struct vm_area_struct *vma, | ||
| unsigned long addr, | ||
| bool *new_page_allocated); | ||
| struct page *swap_cluster_readahead(swp_entry_t entry, gfp_t flag, | ||
| struct vm_fault *vmf); | ||
| struct page *swapin_readahead(swp_entry_t entry, gfp_t flag, | ||
| struct vm_fault *vmf); | ||
|
|
||
| #else /* CONFIG_SWAP */ | ||
| static inline int swap_readpage(struct page *page, bool do_poll) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| static inline struct address_space *swap_address_space(swp_entry_t entry) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static inline void free_swap_cache(struct page *page) | ||
| { | ||
| } | ||
|
|
||
| static inline void show_swap_cache_info(void) | ||
| { | ||
| } | ||
|
|
||
| static inline struct page *swap_cluster_readahead(swp_entry_t entry, | ||
| gfp_t gfp_mask, struct vm_fault *vmf) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static inline struct page *swapin_readahead(swp_entry_t swp, gfp_t gfp_mask, | ||
| struct vm_fault *vmf) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static inline int swap_writepage(struct page *p, struct writeback_control *wbc) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| static inline struct page *lookup_swap_cache(swp_entry_t swp, | ||
| struct vm_area_struct *vma, | ||
| unsigned long addr) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static inline | ||
| struct page *find_get_incore_page(struct address_space *mapping, pgoff_t index) | ||
| { | ||
| return find_get_page(mapping, index); | ||
| } | ||
|
|
||
| static inline int add_to_swap(struct page *page) | ||
| { | ||
| return 0; | ||
| } | ||
|
|
||
| static inline void *get_shadow_from_swap_cache(swp_entry_t entry) | ||
| { | ||
| return NULL; | ||
| } | ||
|
|
||
| static inline int add_to_swap_cache(struct page *page, swp_entry_t entry, | ||
| gfp_t gfp_mask, void **shadowp) | ||
| { | ||
| return -1; | ||
| } | ||
|
|
||
| static inline void __delete_from_swap_cache(struct page *page, | ||
| swp_entry_t entry, void *shadow) | ||
| { | ||
| } | ||
|
|
||
| static inline void delete_from_swap_cache(struct page *page) | ||
| { | ||
| } | ||
|
|
||
| static inline void clear_shadow_from_swap_cache(int type, unsigned long begin, | ||
| unsigned long end) | ||
| { | ||
| } | ||
|
|
||
| #endif /* CONFIG_SWAP */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -27,6 +27,7 @@ | ||
| #include <linux/uaccess.h> | ||
|
|
||
| #include "internal.h" | ||
| #include "swap.h" | ||
|
|
||
| /** | ||
| * kfree_const - conditionally free memory | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters