[lc-checkins] CVS: linux/include/linux comp_cache.h,1.30,1.31 swap.h,1.12,1.13 sysctl.h,1.2,1.3
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2001-12-13 19:13:00
|
Update of /cvsroot/linuxcompressed/linux/include/linux In directory usw-pr-cvs1:/tmp/cvs-serv23494/include/linux Modified Files: comp_cache.h swap.h sysctl.h Log Message: First batch of changes to remove #ifdefs and make code cleaner. It follows Documentation/SubmittingPatches document. Index: comp_cache.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -r1.30 -r1.31 *** comp_cache.h 2001/12/12 20:45:46 1.30 --- comp_cache.h 2001/12/13 19:12:57 1.31 *************** *** 2,6 **** * linux/mm/comp_cache.h * ! * Time-stamp: <2001-12-11 12:56:38 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache.h * ! * Time-stamp: <2001-12-13 15:02:58 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 19,22 **** --- 19,23 ---- #include <linux/fs.h> #include <linux/swapctl.h> + #include <linux/pagemap.h> #include <asm/atomic.h> *************** *** 321,330 **** --- 322,361 ---- /* swapin.c */ + #ifdef CONFIG_COMP_CACHE + struct page * lookup_comp_cache(swp_entry_t); struct page * shmem_lookup_comp_cache(swp_entry_t *, struct address_space *, unsigned long); + #else + + static inline struct page * lookup_comp_cache(swp_entry_t entry) + { + return lookup_swap_cache(entry); + } + + static inline struct page * shmem_lookup_comp_cache(swp_entry_t * entry, struct address_space * mapping, unsigned long idx) + { + return find_get_page(&swapper_space, entry->val); + } + + #endif /* CONFIG_COMP_CACHE */ + /* main.c */ + #ifdef CONFIG_COMP_CACHE + int compress_page(struct page *); + void comp_cache_init(void); + + #else + + extern int swap_writepage(struct page*); + + static inline int compress_page(struct page * page) { + return swap_writepage(page); + } + static inline void comp_cache_init(void) {}; + #endif /* CONFIG_COMP_CACHE */ + /* vswap.c */ struct vswap_address { *************** *** 344,349 **** --- 375,386 ---- }; + extern struct list_head vswap_address_free_head, vswap_address_used_head; + extern struct vswap_address ** vswap_address; + extern unsigned long long estimated_free_space; #define COMP_CACHE_SWP_TYPE MAX_SWAPFILES + + #ifdef CONFIG_COMP_CACHE + #define VSWAP_RESERVED ((comp_cache_fragment_t *) 0xffffffff) *************** *** 357,364 **** #define comp_cache_swp_free(swp_entry) comp_cache_swp_free_generic(swp_entry, 1) - extern struct list_head vswap_address_free_head, vswap_address_used_head; - extern struct vswap_address ** vswap_address; - extern unsigned long long estimated_free_space; - void comp_cache_swp_duplicate(swp_entry_t); int comp_cache_swp_free_generic(swp_entry_t, int); --- 394,397 ---- *************** *** 377,384 **** inline void unlock_vswap(swp_entry_t); /* free.c */ - int comp_cache_release(swp_entry_t); inline void comp_cache_free(comp_cache_fragment_t *); /* aux.c */ unsigned long long big_division(unsigned long long, unsigned long long); --- 410,458 ---- inline void unlock_vswap(swp_entry_t); + #else + + #define vswap_address_available() (0) + #define vswap_info_struct(p) (0) + #define vswap_address(entry) (0) + + #define comp_cache_swp_free(swp_entry) comp_cache_swp_free_generic(swp_entry, 1) + + static inline void comp_cache_swp_duplicate(swp_entry_t entry) {}; + static inline int comp_cache_swp_free_generic(swp_entry_t entry, int free_fragment) + { + return 0; + } + static inline int comp_cache_swp_count(swp_entry_t entry) + { + return 0; + } + + static inline int comp_cache_available_space(void) + { + return 0; + } + static inline swp_entry_t get_virtual_swap_page(struct page * page, unsigned short count) + { + return ((swp_entry_t) { 0 }); + } + static inline void add_pte_vswap(pte_t * ptep, swp_entry_t entry) {}; + static inline void remove_pte_vswap(pte_t * ptep) {}; + static inline void add_swap_cache_page_vswap(struct page * page, swp_entry_t entry) {}; + static inline void del_swap_cache_page_vswap(struct page * page) {}; + + static inline void lock_vswap(swp_entry_t entry) {}; + static inline void unlock_vswap(swp_entry_t entry) {}; + + #endif + /* free.c */ inline void comp_cache_free(comp_cache_fragment_t *); + #ifdef CONFIG_COMP_CACHE + int comp_cache_release(swp_entry_t); + #else + static inline int comp_cache_release(swp_entry_t entry) { return 0; } + #endif + /* aux.c */ unsigned long long big_division(unsigned long long, unsigned long long); *************** *** 394,397 **** --- 468,501 ---- inline void remove_fragment_from_hash_table(comp_cache_fragment_t *); + /* proc.c */ + void print_comp_cache_stats(unsigned short, char *, int *); + int comp_cache_stat_read_proc(char *, char **, off_t, int, int *, void *); + + /* compswap.c */ + #ifdef CONFIG_COMP_SWAP + + void set_comp_swp_entry(swp_entry_t, int, int); + int swap_compressed(swp_entry_t); + unsigned short swap_algorithm(swp_entry_t); + + #define CS_WKdm 0 + #define CS_WK4x4 1 + + #define CS_compressed 15 + + #define SetEntryWK4x4(p, offset) set_bit(CS_WK4x4, &(p)->swap_comp[offset]) + #define ClearEntryWK4x4(p, offset) clear_bit(CS_WK4x4, &(p)->swap_comp[offset]) + #define EntryWK4x4(p, offset) test_bit(CS_WK4x4, &(p)->swap_comp[offset]) + + #define SetEntryWKdm(p, offset) set_bit(CS_WKdm, &(p)->swap_comp[offset]) + #define ClearEntryWKdm(p, offset) clear_bit(CS_WKdm, &(p)->swap_comp[offset]) + #define EntryWKdm(p, offset) test_bit(CS_WKdm, &(p)->swap_comp[offset]) + + #define SetEntryCompressed(p, offset) set_bit(CS_compressed, &(p)->swap_comp[offset]) + #define ClearEntryCompressed(p, offset) clear_bit(CS_compressed, &(p)->swap_comp[offset]) + #define EntryCompressed(p, offset) test_bit(CS_compressed, &(p)->swap_comp[offset]) #endif + + #endif + Index: swap.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/swap.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -r1.12 -r1.13 *** swap.h 2001/12/12 20:45:46 1.12 --- swap.h 2001/12/13 19:12:57 1.13 *************** *** 223,250 **** extern void shmem_unuse(swp_entry_t entry, struct page *page); - #ifdef CONFIG_COMP_SWAP - void set_comp_swp_entry(swp_entry_t, int, int); - int swap_compressed(swp_entry_t); - unsigned short swap_algorithm(swp_entry_t); - - - #define CS_WKdm 0 - #define CS_WK4x4 1 - - #define CS_compressed 15 - - #define SetEntryWK4x4(p, offset) set_bit(CS_WK4x4, &(p)->swap_comp[offset]) - #define ClearEntryWK4x4(p, offset) clear_bit(CS_WK4x4, &(p)->swap_comp[offset]) - #define EntryWK4x4(p, offset) test_bit(CS_WK4x4, &(p)->swap_comp[offset]) - - #define SetEntryWKdm(p, offset) set_bit(CS_WKdm, &(p)->swap_comp[offset]) - #define ClearEntryWKdm(p, offset) clear_bit(CS_WKdm, &(p)->swap_comp[offset]) - #define EntryWKdm(p, offset) test_bit(CS_WKdm, &(p)->swap_comp[offset]) - - #define SetEntryCompressed(p, offset) set_bit(CS_compressed, &(p)->swap_comp[offset]) - #define ClearEntryCompressed(p, offset) clear_bit(CS_compressed, &(p)->swap_comp[offset]) - #define EntryCompressed(p, offset) test_bit(CS_compressed, &(p)->swap_comp[offset]) - #endif - #endif /* __KERNEL__*/ --- 223,226 ---- Index: sysctl.h =================================================================== RCS file: /cvsroot/linuxcompressed/linux/include/linux/sysctl.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** sysctl.h 2001/12/12 20:45:46 1.2 --- sysctl.h 2001/12/13 19:12:57 1.3 *************** *** 142,160 **** VM_PAGE_CLUSTER=10, /* int: set number of pages to swap together */ VM_MIN_READAHEAD=12, /* Min file readahead */ - #ifdef CONFIG_COMP_CACHE VM_MAX_READAHEAD=13, /* Max file readahead */ VM_CTL_COMP_CACHE=14 - #else - VM_MAX_READAHEAD=13 /* Max file readahead */ - #endif }; - - #ifdef CONFIG_COMP_CACHE - enum - { - CC_SIZE=1, - CC_ALGORITHM=2 - }; - #endif /* CTL_NET names: */ --- 142,148 ---- |