[lc-checkins] CVS: linux/mm/comp_cache WK4x4.c,1.2,1.3 WKdm.c,1.2,1.3 adaptivity.c,1.24,1.25 aux.c,1
Status: Beta
Brought to you by:
nitin_sf
From: Rodrigo S. de C. <rc...@us...> - 2002-06-19 12:18:49
|
Update of /cvsroot/linuxcompressed/linux/mm/comp_cache In directory usw-pr-cvs1:/tmp/cvs-serv15026/mm/comp_cache Modified Files: WK4x4.c WKdm.c adaptivity.c aux.c free.c main.c proc.c swapin.c swapout.c vswap.c Log Message: Cleanups o Most of typedefs removed: - comp_cache_t -> struct comp_cache_page - comp_cache_fragment_t -> struct comp_cache_fragment - stats_summary_t -> struct stats_summary - stats_page_t -> struct stats_page - compression_algorithm_t -> struct comp_alg - comp_data_t -> struct comp_alg_data Index: WK4x4.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/WK4x4.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** WK4x4.c 19 Dec 2001 20:02:53 -0000 1.2 --- WK4x4.c 19 Jun 2002 12:18:44 -0000 1.3 *************** *** 260,265 **** void *page) { ! DictionaryElement *dictionary = ((comp_data_t *)page)->dictionary; ! unsigned int *hashTable = ((comp_data_t *)page)->hashLookupTable_WK4x4; /*DictionaryElement dictionary[DICTIONARY_SIZE]; --- 260,265 ---- void *page) { ! DictionaryElement *dictionary = ((struct comp_alg_data *)page)->dictionary; ! unsigned int *hashTable = ((struct comp_alg_data *)page)->hashLookupTable_WK4x4; /*DictionaryElement dictionary[DICTIONARY_SIZE]; *************** *** 428,433 **** /*DictionaryElement dictionary[DICTIONARY_SIZE]; unsigned int hashTable [] = HASH_LOOKUP_TABLE_CONTENTS_WK4x4;*/ ! DictionaryElement *dictionary = ((comp_data_t *)page)->dictionary; ! unsigned int *hashTable = ((comp_data_t *)page)->hashLookupTable_WK4x4; unsigned int initialIndexTable [] = INITIAL_INDEX_TABLE_CONTENTS; --- 428,433 ---- /*DictionaryElement dictionary[DICTIONARY_SIZE]; unsigned int hashTable [] = HASH_LOOKUP_TABLE_CONTENTS_WK4x4;*/ ! DictionaryElement *dictionary = ((struct comp_alg_data *)page)->dictionary; ! unsigned int *hashTable = ((struct comp_alg_data *)page)->hashLookupTable_WK4x4; unsigned int initialIndexTable [] = INITIAL_INDEX_TABLE_CONTENTS; Index: WKdm.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/WKdm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** WKdm.c 19 Dec 2001 20:02:53 -0000 1.2 --- WKdm.c 19 Jun 2002 12:18:44 -0000 1.3 *************** *** 387,392 **** /* DictionaryElement dictionary[DICTIONARY_SIZE]; char hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS; */ ! DictionaryElement *dictionary = ((comp_data_t *)page)->dictionary; ! char *hashLookupTable = ((comp_data_t *)page)->hashLookupTable_WKdm; /* arrays that hold output data in intermediate form during modeling */ --- 387,392 ---- /* DictionaryElement dictionary[DICTIONARY_SIZE]; char hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS; */ ! DictionaryElement *dictionary = ((struct comp_alg_data *)page)->dictionary; ! char *hashLookupTable = ((struct comp_alg_data *)page)->hashLookupTable_WKdm; /* arrays that hold output data in intermediate form during modeling */ *************** *** 400,406 **** /* WK_word tempQPosArray[300]; queue positions for matches */ /* WK_word tempLowBitsArray[1200]; low bits for partial matches */ ! WK_word *tempTagsArray = ((comp_data_t *)page)->tempTagsArray; ! WK_word *tempQPosArray = ((comp_data_t *)page)->tempQPosArray; ! WK_word *tempLowBitsArray = ((comp_data_t *)page)->tempLowBitsArray; /* boundary_tmp will be used for keeping track of what's where in --- 400,406 ---- /* WK_word tempQPosArray[300]; queue positions for matches */ /* WK_word tempLowBitsArray[1200]; low bits for partial matches */ ! WK_word *tempTagsArray = ((struct comp_alg_data *)page)->tempTagsArray; ! WK_word *tempQPosArray = ((struct comp_alg_data *)page)->tempQPosArray; ! WK_word *tempLowBitsArray = ((struct comp_alg_data *)page)->tempLowBitsArray; /* boundary_tmp will be used for keeping track of what's where in *************** *** 642,647 **** /*DictionaryElement dictionary[DICTIONARY_SIZE]; unsigned int hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS_WKDM;*/ ! DictionaryElement *dictionary = ((comp_data_t *)page)->dictionary; ! char *hashLookupTable = ((comp_data_t *)page)->hashLookupTable_WKdm; --- 642,647 ---- /*DictionaryElement dictionary[DICTIONARY_SIZE]; unsigned int hashLookupTable [] = HASH_LOOKUP_TABLE_CONTENTS_WKDM;*/ ! DictionaryElement *dictionary = ((struct comp_alg_data *)page)->dictionary; ! char *hashLookupTable = ((struct comp_alg_data *)page)->hashLookupTable_WKdm; *************** *** 655,661 **** //WK_word tempQPosArray[300]; /* queue positions for matches */ //WK_word tempLowBitsArray[1200]; /* low bits for partial matches */ ! WK_word *tempTagsArray = ((comp_data_t *)page)->tempTagsArray; ! WK_word *tempQPosArray = ((comp_data_t *)page)->tempQPosArray; ! WK_word *tempLowBitsArray = ((comp_data_t *)page)->tempLowBitsArray; --- 655,661 ---- //WK_word tempQPosArray[300]; /* queue positions for matches */ //WK_word tempLowBitsArray[1200]; /* low bits for partial matches */ ! WK_word *tempTagsArray = ((struct comp_alg_data *)page)->tempTagsArray; ! WK_word *tempQPosArray = ((struct comp_alg_data *)page)->tempQPosArray; ! WK_word *tempLowBitsArray = ((struct comp_alg_data *)page)->tempLowBitsArray; Index: adaptivity.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/adaptivity.c,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -r1.24 -r1.25 *** adaptivity.c 18 Jun 2002 18:04:31 -0000 1.24 --- adaptivity.c 19 Jun 2002 12:18:44 -0000 1.25 *************** *** 2,6 **** * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-06-18 13:28:03 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/adaptivity.c * ! * Time-stamp: <2002-06-19 08:45:29 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 168,176 **** void resize_fragment_hash_table(void) { ! comp_cache_fragment_t ** new_fragment_hash, * fragment, * next_fragment; unsigned long new_fragment_hash_size; unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index; ! new_fragment_hash_size = 3 * num_comp_pages * sizeof(comp_cache_fragment_t *); new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order); --- 168,176 ---- void resize_fragment_hash_table(void) { ! struct comp_cache_fragment ** new_fragment_hash, * fragment, * next_fragment; unsigned long new_fragment_hash_size; unsigned int i, new_fragment_hash_bits, new_fragment_hash_order, hash_index; ! new_fragment_hash_size = 3 * num_comp_pages * sizeof(struct comp_cache_fragment *); new_fragment_hash = create_fragment_hash(&new_fragment_hash_size, &new_fragment_hash_bits, &new_fragment_hash_order); *************** *** 256,260 **** shrink_vswap(unsigned long vswap_new_num_entries) { struct page * swap_cache_page; ! comp_cache_fragment_t * fragment; struct vswap_address ** new_vswap_address; unsigned int total_scan = 0, failed_scan = 0; --- 256,260 ---- shrink_vswap(unsigned long vswap_new_num_entries) { struct page * swap_cache_page; ! struct comp_cache_fragment * fragment; struct vswap_address ** new_vswap_address; unsigned int total_scan = 0, failed_scan = 0; *************** *** 502,506 **** static inline int fragment_hash_needs_to_shrink(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(comp_cache_fragment_t *); /* if we shrink the hash table an order, will the data fit in --- 502,506 ---- static inline int fragment_hash_needs_to_shrink(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(struct comp_cache_fragment *); /* if we shrink the hash table an order, will the data fit in *************** *** 552,558 **** int ! shrink_comp_cache(comp_cache_t * comp_page) { ! comp_cache_t * empty_comp_page; int retval = 0; --- 552,558 ---- int ! shrink_comp_cache(struct comp_cache_page * comp_page) { ! struct comp_cache_page * empty_comp_page; int retval = 0; *************** *** 626,630 **** static inline int fragment_hash_needs_to_grow(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(comp_cache_fragment_t *); /* do we really need a bigger hash table? */ --- 626,630 ---- static inline int fragment_hash_needs_to_grow(void) { ! unsigned long new_fragment_hash_size = (3 * num_comp_pages) * sizeof(struct comp_cache_fragment *); /* do we really need a bigger hash table? */ *************** *** 658,662 **** grow_comp_cache(zone_t * zone, int nr_pages) { ! comp_cache_t * comp_page; struct page * page; --- 658,662 ---- grow_comp_cache(zone_t * zone, int nr_pages) { ! struct comp_cache_page * comp_page; struct page * page; Index: aux.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/aux.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** aux.c 18 Jun 2002 12:47:21 -0000 1.31 --- aux.c 19 Jun 2002 12:18:44 -0000 1.32 *************** *** 2,6 **** * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-06-17 16:14:31 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/aux.c * ! * Time-stamp: <2002-06-19 08:45:54 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 15,19 **** #include <linux/vmalloc.h> ! comp_cache_fragment_t ** fragment_hash; unsigned long fragment_hash_size; unsigned long fragment_hash_used; --- 15,19 ---- #include <linux/vmalloc.h> ! struct comp_cache_fragment ** fragment_hash; unsigned long fragment_hash_size; unsigned long fragment_hash_used; *************** *** 21,25 **** unsigned int fragment_hash_bits; ! static comp_cache_t ** free_space_hash; unsigned int free_space_hash_size; unsigned int free_space_interval; --- 21,25 ---- unsigned int fragment_hash_bits; ! static struct comp_cache_page ** free_space_hash; unsigned int free_space_hash_size; unsigned int free_space_interval; *************** *** 69,73 **** inline void ! set_comp_page(comp_cache_t * comp_page, struct page * page) { if (!comp_page) --- 69,73 ---- inline void ! set_comp_page(struct comp_cache_page * comp_page, struct page * page) { if (!comp_page) *************** *** 159,164 **** inline void ! __add_fragment_to_hash_table(comp_cache_fragment_t ** hash_table, unsigned int hash_index, comp_cache_fragment_t * new_fragment) { ! comp_cache_fragment_t ** fragment; fragment = &hash_table[hash_index]; --- 159,164 ---- inline void ! __add_fragment_to_hash_table(struct comp_cache_fragment ** hash_table, unsigned int hash_index, struct comp_cache_fragment * new_fragment) { ! struct comp_cache_fragment ** fragment; fragment = &hash_table[hash_index]; *************** *** 174,180 **** inline void ! remove_fragment_from_hash_table(comp_cache_fragment_t * fragment) { ! comp_cache_fragment_t *next = fragment->next_hash; ! comp_cache_fragment_t **pprev = fragment->pprev_hash; if (next) --- 174,180 ---- inline void ! remove_fragment_from_hash_table(struct comp_cache_fragment * fragment) { ! struct comp_cache_fragment *next = fragment->next_hash; ! struct comp_cache_fragment **pprev = fragment->pprev_hash; if (next) *************** *** 188,192 **** unsigned long free_space_count(int index, unsigned long * num_fragments) { ! comp_cache_t * comp_page; unsigned long total, total_fragments; struct list_head * fragment_lh; --- 188,192 ---- unsigned long free_space_count(int index, unsigned long * num_fragments) { ! struct comp_cache_page * comp_page; unsigned long total, total_fragments; struct list_head * fragment_lh; *************** *** 252,257 **** inline void ! add_comp_page_to_hash_table(comp_cache_t * new_comp_page) { ! comp_cache_t ** comp_page; comp_page = &free_space_hash[free_space_hashfn(new_comp_page->free_space)]; --- 252,257 ---- inline void ! add_comp_page_to_hash_table(struct comp_cache_page * new_comp_page) { ! struct comp_cache_page ** comp_page; comp_page = &free_space_hash[free_space_hashfn(new_comp_page->free_space)]; *************** *** 265,271 **** inline void ! remove_comp_page_from_hash_table(comp_cache_t * comp_page) { ! comp_cache_t *next = comp_page->next_hash; ! comp_cache_t **pprev = comp_page->pprev_hash; if (next) --- 265,271 ---- inline void ! remove_comp_page_from_hash_table(struct comp_cache_page * comp_page) { ! struct comp_cache_page *next = comp_page->next_hash; ! struct comp_cache_page **pprev = comp_page->pprev_hash; if (next) *************** *** 275,281 **** } ! comp_cache_t * search_comp_page_free_space(int free_space) { ! comp_cache_t * comp_page; int idx, i; --- 275,281 ---- } ! struct comp_cache_page * search_comp_page_free_space(int free_space) { ! struct comp_cache_page * comp_page; int idx, i; *************** *** 309,313 **** inline void ! add_fragment_to_lru_queue_tail(comp_cache_fragment_t * fragment) { swp_entry_t entry; --- 309,313 ---- inline void ! add_fragment_to_lru_queue_tail(struct comp_cache_fragment * fragment) { swp_entry_t entry; *************** *** 328,332 **** inline void ! add_fragment_to_lru_queue(comp_cache_fragment_t * fragment) { swp_entry_t entry; --- 328,332 ---- inline void ! add_fragment_to_lru_queue(struct comp_cache_fragment * fragment) { swp_entry_t entry; *************** *** 347,351 **** inline void ! remove_fragment_from_lru_queue(comp_cache_fragment_t * fragment) { swp_entry_t entry; --- 347,351 ---- inline void ! remove_fragment_from_lru_queue(struct comp_cache_fragment * fragment) { swp_entry_t entry; *************** *** 366,373 **** /* adapted version of __find_page_nolock:filemap.c */ ! int FASTCALL(find_comp_page(struct address_space *, unsigned long, comp_cache_fragment_t **)); ! int find_comp_page(struct address_space *mapping, unsigned long offset, comp_cache_fragment_t ** fragment) { ! comp_cache_fragment_t * fhash; int err = -ENOENT; --- 366,373 ---- /* adapted version of __find_page_nolock:filemap.c */ ! int FASTCALL(find_comp_page(struct address_space *, unsigned long, struct comp_cache_fragment **)); ! int find_comp_page(struct address_space *mapping, unsigned long offset, struct comp_cache_fragment ** fragment) { ! struct comp_cache_fragment * fhash; int err = -ENOENT; *************** *** 400,412 **** inline void ! print_all_fragments (comp_cache_t * comp_page) { struct list_head * fragment_lh; ! comp_cache_fragment_t * fragment; printk("DEBUG: fragment List for %08lx\n", (unsigned long) comp_page); for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, comp_cache_fragment_t, list); printk(" %08lx (entry: %08lx offset: %d compressed_size: %d\n", (unsigned long) fragment, fragment->index, fragment->offset, fragment->compressed_size); } --- 400,412 ---- inline void ! print_all_fragments (struct comp_cache_page * comp_page) { struct list_head * fragment_lh; ! struct comp_cache_fragment * fragment; printk("DEBUG: fragment List for %08lx\n", (unsigned long) comp_page); for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, struct comp_cache_fragment, list); printk(" %08lx (entry: %08lx offset: %d compressed_size: %d\n", (unsigned long) fragment, fragment->index, fragment->offset, fragment->compressed_size); } *************** *** 414,420 **** inline void ! check_all_fragments(comp_cache_t * comp_page) { ! comp_cache_fragment_t * fragment, * aux_fragment; struct list_head * fragment_lh, * aux_fragment_lh; int used_space = 0; --- 414,420 ---- inline void ! check_all_fragments(struct comp_cache_page * comp_page) { ! struct comp_cache_fragment * fragment, * aux_fragment; struct list_head * fragment_lh, * aux_fragment_lh; int used_space = 0; *************** *** 425,429 **** for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, comp_cache_fragment_t, list); if (fragment->comp_page != comp_page) --- 425,429 ---- for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, struct comp_cache_fragment, list); if (fragment->comp_page != comp_page) *************** *** 446,453 **** for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, comp_cache_fragment_t, list); for_each_fragment(aux_fragment_lh, comp_page) { ! aux_fragment = list_entry(aux_fragment_lh, comp_cache_fragment_t, list); if (aux_fragment == fragment) --- 446,453 ---- for_each_fragment(fragment_lh, comp_page) { ! fragment = list_entry(fragment_lh, struct comp_cache_fragment, list); for_each_fragment(aux_fragment_lh, comp_page) { ! aux_fragment = list_entry(aux_fragment_lh, struct comp_cache_fragment, list); if (aux_fragment == fragment) *************** *** 472,483 **** } ! comp_cache_fragment_t ** create_fragment_hash(unsigned long * fragment_hash_size, unsigned int * bits, unsigned int * order) { ! comp_cache_fragment_t ** hash_table; for (*order = 0; (PAGE_SIZE << *order) < *fragment_hash_size; (*order)++); do { ! unsigned long tmp = (PAGE_SIZE << *order)/sizeof(comp_cache_fragment_t *); *bits = 0; --- 472,483 ---- } ! struct comp_cache_fragment ** create_fragment_hash(unsigned long * fragment_hash_size, unsigned int * bits, unsigned int * order) { ! struct comp_cache_fragment ** hash_table; for (*order = 0; (PAGE_SIZE << *order) < *fragment_hash_size; (*order)++); do { ! unsigned long tmp = (PAGE_SIZE << *order)/sizeof(struct comp_cache_fragment *); *bits = 0; *************** *** 485,489 **** (*bits)++; ! hash_table = (comp_cache_fragment_t **) __get_free_pages(GFP_ATOMIC, *order); } while(hash_table == NULL && --(*order) > 0); --- 485,489 ---- (*bits)++; ! hash_table = (struct comp_cache_fragment **) __get_free_pages(GFP_ATOMIC, *order); } while(hash_table == NULL && --(*order) > 0); *************** *** 491,495 **** if (hash_table) ! memset((void *) hash_table, 0, *fragment_hash_size * sizeof(comp_cache_fragment_t *)); return hash_table; --- 491,495 ---- if (hash_table) ! memset((void *) hash_table, 0, *fragment_hash_size * sizeof(struct comp_cache_fragment *)); return hash_table; *************** *** 501,505 **** /* fragment hash table (code heavily based on * page_cache_init():filemap.c */ ! fragment_hash_size = 3 * num_comp_pages * sizeof(comp_cache_fragment_t *); fragment_hash_used = 0; fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order); --- 501,505 ---- /* fragment hash table (code heavily based on * page_cache_init():filemap.c */ ! fragment_hash_size = 3 * num_comp_pages * sizeof(struct comp_cache_fragment *); fragment_hash_used = 0; fragment_hash = create_fragment_hash(&fragment_hash_size, &fragment_hash_bits, &fragment_hash_order); *************** *** 515,526 **** free_space_hash_size = (int) (PAGE_SIZE/free_space_interval) + 2; ! free_space_hash = vmalloc(free_space_hash_size * sizeof(comp_cache_t *)); ! printk("Compressed Cache: free space (%u entries = %uB)\n", free_space_hash_size, free_space_hash_size * sizeof(comp_cache_t *)); if (!free_space_hash) panic("comp_cache_hash_init(): couldn't allocate free space hash table\n"); ! memset((void *) free_space_hash, 0, free_space_hash_size * sizeof(comp_cache_t *)); } --- 515,526 ---- free_space_hash_size = (int) (PAGE_SIZE/free_space_interval) + 2; ! free_space_hash = vmalloc(free_space_hash_size * sizeof(struct comp_cache_page *)); ! printk("Compressed Cache: free space (%u entries = %uB)\n", free_space_hash_size, free_space_hash_size * sizeof(struct comp_cache_page *)); if (!free_space_hash) panic("comp_cache_hash_init(): couldn't allocate free space hash table\n"); ! memset((void *) free_space_hash, 0, free_space_hash_size * sizeof(struct comp_cache_page *)); } Index: free.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/free.c,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -r1.31 -r1.32 *** free.c 13 Jun 2002 20:18:32 -0000 1.31 --- free.c 19 Jun 2002 12:18:44 -0000 1.32 *************** *** 2,6 **** * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-06-13 10:37:11 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/free.c * ! * Time-stamp: <2002-06-19 08:46:13 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 19,24 **** extern kmem_cache_t * fragment_cachep; ! extern void remove_fragment_vswap(comp_cache_fragment_t *); ! extern void add_fragment_vswap(comp_cache_fragment_t *); /* is fragment1 the left neighbour of fragment2? */ --- 19,24 ---- extern kmem_cache_t * fragment_cachep; ! extern void remove_fragment_vswap(struct comp_cache_fragment *); ! extern void add_fragment_vswap(struct comp_cache_fragment *); /* is fragment1 the left neighbour of fragment2? */ *************** *** 30,34 **** static inline void ! merge_right_neighbour(comp_cache_fragment_t * fragment_to_free, comp_cache_fragment_t * right_fragment) { if (!right_fragment) --- 30,34 ---- static inline void ! merge_right_neighbour(struct comp_cache_fragment * fragment_to_free, struct comp_cache_fragment * right_fragment) { if (!right_fragment) *************** *** 47,51 **** static inline void ! merge_left_neighbour(comp_cache_fragment_t * fragment_to_free, comp_cache_fragment_t * left_fragment) { if (!left_fragment) --- 47,51 ---- static inline void ! merge_left_neighbour(struct comp_cache_fragment * fragment_to_free, struct comp_cache_fragment * left_fragment) { if (!left_fragment) *************** *** 64,68 **** static inline void ! remove_fragment_from_comp_cache(comp_cache_fragment_t * fragment) { remove_fragment_vswap(fragment); --- 64,68 ---- static inline void ! remove_fragment_from_comp_cache(struct comp_cache_fragment * fragment) { remove_fragment_vswap(fragment); *************** *** 78,85 **** void ! comp_cache_free_locked(comp_cache_fragment_t * fragment) { ! comp_cache_t * comp_page; ! comp_cache_fragment_t * next_fragment, * previous_fragment; if (!fragment) --- 78,85 ---- void ! comp_cache_free_locked(struct comp_cache_fragment * fragment) { ! struct comp_cache_page * comp_page; ! struct comp_cache_fragment * next_fragment, * previous_fragment; if (!fragment) *************** *** 98,106 **** next_fragment = NULL; if (fragment->list.next != &(comp_page->fragments)) ! next_fragment = list_entry(fragment->list.next, comp_cache_fragment_t, list); previous_fragment = NULL; if (fragment->list.prev != &(comp_page->fragments)) ! previous_fragment = list_entry(fragment->list.prev, comp_cache_fragment_t, list); /* simple case - no free space --- 98,106 ---- next_fragment = NULL; if (fragment->list.next != &(comp_page->fragments)) ! next_fragment = list_entry(fragment->list.next, struct comp_cache_fragment, list); previous_fragment = NULL; if (fragment->list.prev != &(comp_page->fragments)) ! previous_fragment = list_entry(fragment->list.prev, struct comp_cache_fragment, list); /* simple case - no free space *************** *** 164,169 **** inline void ! comp_cache_free(comp_cache_fragment_t * fragment) { ! comp_cache_t * comp_page; int locked; --- 164,169 ---- inline void ! comp_cache_free(struct comp_cache_fragment * fragment) { ! struct comp_cache_page * comp_page; int locked; *************** *** 188,192 **** comp_cache_use_address(swp_entry_t entry) { ! comp_cache_fragment_t * fragment = NULL; struct vswap_address * vswap; struct list_head * vswap_lh; --- 188,192 ---- comp_cache_use_address(swp_entry_t entry) { ! struct comp_cache_fragment * fragment = NULL; struct vswap_address * vswap; struct list_head * vswap_lh; Index: main.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/main.c,v retrieving revision 1.45 retrieving revision 1.46 diff -C2 -r1.45 -r1.46 *** main.c 18 Jun 2002 12:47:21 -0000 1.45 --- main.c 19 Jun 2002 12:18:44 -0000 1.46 *************** *** 2,6 **** * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-06-17 17:47:11 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/main.c * ! * Time-stamp: <2002-06-19 08:46:38 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 44,48 **** extern unsigned long num_physpages; ! extern comp_cache_t * get_comp_cache_page(struct page *, unsigned short, comp_cache_fragment_t **, int, int, unsigned int); inline void --- 44,48 ---- extern unsigned long num_physpages; ! extern struct comp_cache_page * get_comp_cache_page(struct page *, unsigned short, struct comp_cache_fragment **, int, int, unsigned int); inline void *************** *** 94,99 **** compress_page(struct page * page, int dirty, unsigned int gfp_mask) { ! comp_cache_t * comp_page; ! comp_cache_fragment_t * fragment; unsigned short comp_size, algorithm; --- 94,99 ---- compress_page(struct page * page, int dirty, unsigned int gfp_mask) { ! struct comp_cache_page * comp_page; ! struct comp_cache_fragment * fragment; unsigned short comp_size, algorithm; *************** *** 151,156 **** steal_page_from_comp_cache(struct page * page, struct page * new_page) { ! comp_cache_fragment_t * fragment; ! comp_cache_t * comp_page; struct page * old_page; int locked; --- 151,156 ---- steal_page_from_comp_cache(struct page * page, struct page * new_page) { ! struct comp_cache_fragment * fragment; ! struct comp_cache_page * comp_page; struct page * old_page; int locked; *************** *** 195,200 **** comp_cache_try_to_release_page(struct page ** page, int gfp_mask) { ! comp_cache_fragment_t * fragment; ! comp_cache_t * comp_page; unsigned short comp_size, dirty; struct page * old_page; --- 195,200 ---- comp_cache_try_to_release_page(struct page ** page, int gfp_mask) { ! struct comp_cache_fragment * fragment; ! struct comp_cache_page * comp_page; unsigned short comp_size, dirty; struct page * old_page; *************** *** 274,278 **** LIST_HEAD(lru_queue); ! inline void init_comp_page(comp_cache_t ** comp_page,struct page * page) { *comp_page = alloc_comp_cache(); (*comp_page)->free_space = PAGE_SIZE; --- 274,278 ---- LIST_HEAD(lru_queue); ! inline void init_comp_page(struct comp_cache_page ** comp_page,struct page * page) { *comp_page = alloc_comp_cache(); (*comp_page)->free_space = PAGE_SIZE; *************** *** 288,292 **** comp_cache_init(void) { ! comp_cache_t * comp_page; struct page * page; int i; --- 288,292 ---- comp_cache_init(void) { ! struct comp_cache_page * comp_page; struct page * page; int i; *************** *** 332,337 **** /* create slab caches */ ! comp_cachep = kmem_cache_create("comp_cache_struct", sizeof(comp_cache_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); ! fragment_cachep = kmem_cache_create("comp_cache_frag", sizeof(comp_cache_fragment_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); comp_cache_hash_init(); --- 332,337 ---- /* create slab caches */ ! comp_cachep = kmem_cache_create("comp_cache_struct", sizeof(struct comp_cache_page), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); ! fragment_cachep = kmem_cache_create("comp_cache_frag", sizeof(struct comp_cache_fragment), 0, SLAB_HWCACHE_ALIGN, NULL, NULL); comp_cache_hash_init(); Index: proc.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/proc.c,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -r1.15 -r1.16 *** proc.c 13 Jun 2002 20:18:33 -0000 1.15 --- proc.c 19 Jun 2002 12:18:44 -0000 1.16 *************** *** 2,6 **** * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-06-13 17:04:41 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/proc.c * ! * Time-stamp: <2002-06-19 08:59:17 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 27,31 **** extern unsigned long new_num_comp_pages, max_num_comp_pages, min_num_comp_pages; ! static compression_algorithm_t compression_algorithms[NUM_ALGORITHMS]; static int algorithm_min = WKDM_IDX; static int algorithm_max = LZO_IDX; --- 27,31 ---- extern unsigned long new_num_comp_pages, max_num_comp_pages, min_num_comp_pages; ! static struct comp_alg compression_algorithms[NUM_ALGORITHMS]; static int algorithm_min = WKDM_IDX; static int algorithm_max = LZO_IDX; *************** *** 33,37 **** /* data used for compression */ ! static comp_data_t comp_data; static WK_word compresseddata[1200]; --- 33,37 ---- /* data used for compression */ ! static struct comp_alg_data comp_data; static WK_word compresseddata[1200]; *************** *** 81,88 **** static void ! comp_cache_update_comp_stats(stats_page_t * comp_page_stats, struct page * page, int dirty) { ! compression_algorithm_t * algorithm = &compression_algorithms[current_algorithm]; ! stats_summary_t * stats = &(algorithm->stats); /* update compressed size statistics */ --- 81,88 ---- static void ! comp_cache_update_comp_stats(struct stats_page * comp_page_stats, struct page * page, int dirty) { ! struct comp_alg * algorithm = &compression_algorithms[current_algorithm]; ! struct stats_summary * stats = &(algorithm->stats); /* update compressed size statistics */ *************** *** 111,118 **** static void ! comp_cache_update_decomp_stats(unsigned short alg_idx, stats_page_t * comp_page_stats, comp_cache_fragment_t * fragment) { ! compression_algorithm_t * algorithm = &compression_algorithms[alg_idx]; ! stats_summary_t * stats = &(algorithm->stats); /* update decomp cycles statistics */ --- 111,118 ---- static void ! comp_cache_update_decomp_stats(unsigned short alg_idx, struct stats_page * comp_page_stats, struct comp_cache_fragment * fragment) { ! struct comp_alg * algorithm = &compression_algorithms[alg_idx]; ! struct stats_summary * stats = &(algorithm->stats); /* update decomp cycles statistics */ *************** *** 134,138 **** void ! comp_cache_update_writeout_stats(comp_cache_fragment_t * fragment) { #ifdef CONFIG_COMP_PAGE_CACHE --- 134,138 ---- void ! comp_cache_update_writeout_stats(struct comp_cache_fragment * fragment) { #ifdef CONFIG_COMP_PAGE_CACHE *************** *** 145,149 **** void ! comp_cache_update_faultin_stats(comp_cache_fragment_t * fragment) { #ifdef CONFIG_COMP_PAGE_CACHE --- 145,149 ---- void ! comp_cache_update_faultin_stats(struct comp_cache_fragment * fragment) { #ifdef CONFIG_COMP_PAGE_CACHE *************** *** 156,160 **** void ! set_fragment_algorithm(comp_cache_fragment_t * fragment, unsigned short algorithm) { switch (algorithm) { --- 156,160 ---- void ! set_fragment_algorithm(struct comp_cache_fragment * fragment, unsigned short algorithm) { switch (algorithm) { *************** *** 193,197 **** lzo_uint new_len; ! error = lzo1x_decompress((lzo_byte *) from, ((comp_data_t *) page)->compressed_size, (lzo_byte *) to, &new_len, NULL); if (error != LZO_E_OK || new_len != PAGE_SIZE) { --- 193,197 ---- lzo_uint new_len; ! error = lzo1x_decompress((lzo_byte *) from, ((struct comp_alg_data *) page)->compressed_size, (lzo_byte *) to, &new_len, NULL); if (error != LZO_E_OK || new_len != PAGE_SIZE) { *************** *** 204,208 **** compress(struct page * page, void * to, unsigned short * algorithm, int dirty) { ! stats_page_t comp_page_stats; void * from = page_address(page); --- 204,208 ---- compress(struct page * page, void * to, unsigned short * algorithm, int dirty) { ! struct stats_page comp_page_stats; void * from = page_address(page); *************** *** 230,236 **** void ! decompress(comp_cache_fragment_t * fragment, struct page * page) { ! stats_page_t comp_page_stats; unsigned int algorithm = WKDM_IDX; void * from = page_address(fragment->comp_page->page) + fragment->offset; --- 230,236 ---- void ! decompress(struct comp_cache_fragment * fragment, struct page * page) { ! struct stats_page comp_page_stats; unsigned int algorithm = WKDM_IDX; void * from = page_address(fragment->comp_page->page) + fragment->offset; *************** *** 267,271 **** for (i = 0; i < NUM_ALGORITHMS; i++) { ! memset((void *) &compression_algorithms[i], 0, sizeof(stats_summary_t)); compression_algorithms[i].stats.comp_size_min = INF; compression_algorithms[i].stats.comp_cycles_min = INF; --- 267,271 ---- for (i = 0; i < NUM_ALGORITHMS; i++) { ! memset((void *) &compression_algorithms[i], 0, sizeof(struct stats_summary)); compression_algorithms[i].stats.comp_size_min = INF; compression_algorithms[i].stats.comp_cycles_min = INF; *************** *** 315,320 **** unsigned long total_comp_pages, total_wout_pages, total_decomp_pages, total_faultin_pages; ! compression_algorithm_t * algorithm = &compression_algorithms[alg_idx]; ! stats_summary_t * stats = &algorithm->stats; total_comp_pages = stats->comp_swap + stats->comp_page; --- 315,320 ---- unsigned long total_comp_pages, total_wout_pages, total_decomp_pages, total_faultin_pages; ! struct comp_alg * algorithm = &compression_algorithms[alg_idx]; ! struct stats_summary * stats = &algorithm->stats; total_comp_pages = stats->comp_swap + stats->comp_page; Index: swapin.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapin.c,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -r1.39 -r1.40 *** swapin.c 13 Jun 2002 20:18:34 -0000 1.39 --- swapin.c 19 Jun 2002 12:18:44 -0000 1.40 *************** *** 2,6 **** * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-06-12 17:05:28 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/swapin.c * ! * Time-stamp: <2002-06-19 08:47:06 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 21,25 **** invalidate_comp_cache(struct address_space *mapping, unsigned long offset) { ! comp_cache_fragment_t * fragment; int err = find_comp_page(mapping, offset, &fragment); --- 21,25 ---- invalidate_comp_cache(struct address_space *mapping, unsigned long offset) { ! struct comp_cache_fragment * fragment; int err = find_comp_page(mapping, offset, &fragment); *************** *** 35,39 **** int flush_comp_cache(struct page * page) { ! comp_cache_fragment_t * fragment; int err = -ENOENT; --- 35,39 ---- int flush_comp_cache(struct page * page) { ! struct comp_cache_fragment * fragment; int err = -ENOENT; *************** *** 63,69 **** void ! decompress_fragment(comp_cache_fragment_t * fragment, struct page * page) { ! comp_cache_t * comp_page; if (!fragment) --- 63,69 ---- void ! decompress_fragment(struct comp_cache_fragment * fragment, struct page * page) { ! struct comp_cache_page * comp_page; if (!fragment) *************** *** 89,93 **** read_comp_cache(struct address_space *mapping, unsigned long offset, struct page * page, int access) { ! comp_cache_fragment_t * fragment; int err; --- 89,93 ---- read_comp_cache(struct address_space *mapping, unsigned long offset, struct page * page, int access) { ! struct comp_cache_fragment * fragment; int err; *************** *** 142,149 **** { struct list_head * fragment_lh, * tmp_lh; ! comp_cache_fragment_t * fragment; list_for_each_safe(fragment_lh, tmp_lh, list) { ! fragment = list_entry(fragment_lh, comp_cache_fragment_t, mapping_list); if ((fragment->index >= start) || (partial && (fragment->index + 1) == start)) { --- 142,149 ---- { struct list_head * fragment_lh, * tmp_lh; ! struct comp_cache_fragment * fragment; list_for_each_safe(fragment_lh, tmp_lh, list) { ! fragment = list_entry(fragment_lh, struct comp_cache_fragment, mapping_list); if ((fragment->index >= start) || (partial && (fragment->index + 1) == start)) { *************** *** 196,200 **** struct page **hash; struct page * page; ! comp_cache_fragment_t * fragment; if (list_empty(&mapping->dirty_comp_pages)) --- 196,200 ---- struct page **hash; struct page * page; ! struct comp_cache_fragment * fragment; if (list_empty(&mapping->dirty_comp_pages)) *************** *** 208,212 **** goto out_release; ! fragment = list_entry(mapping->dirty_comp_pages.next, comp_cache_fragment_t, mapping_list); hash = page_hash(mapping, fragment->index); --- 208,212 ---- goto out_release; ! fragment = list_entry(mapping->dirty_comp_pages.next, struct comp_cache_fragment, mapping_list); hash = page_hash(mapping, fragment->index); Index: swapout.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/swapout.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C2 -r1.50 -r1.51 *** swapout.c 18 Jun 2002 12:47:21 -0000 1.50 --- swapout.c 19 Jun 2002 12:18:44 -0000 1.51 *************** *** 2,6 **** * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-06-17 17:39:26 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * /mm/comp_cache/swapout.c * ! * Time-stamp: <2002-06-19 08:47:28 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 29,33 **** struct page * buffer_page; struct swp_buffer * swp_buffer; ! comp_cache_fragment_t * fragment; unsigned int gfp_mask_buffer; int wait, maxscan; --- 29,33 ---- struct page * buffer_page; struct swp_buffer * swp_buffer; ! struct comp_cache_fragment * fragment; unsigned int gfp_mask_buffer; int wait, maxscan; *************** *** 123,127 **** */ static struct swp_buffer * ! find_free_swp_buffer(comp_cache_fragment_t * fragment, unsigned int gfp_mask) { struct page * buffer_page; --- 123,127 ---- */ static struct swp_buffer * ! find_free_swp_buffer(struct comp_cache_fragment * fragment, unsigned int gfp_mask) { struct page * buffer_page; *************** *** 172,179 **** } ! extern void decompress_fragment(comp_cache_fragment_t *, struct page *); static struct swp_buffer * ! decompress_to_swp_buffer(comp_cache_fragment_t * fragment, unsigned int gfp_mask) { struct page * buffer_page; struct swp_buffer * swp_buffer; --- 172,179 ---- } ! extern void decompress_fragment(struct comp_cache_fragment *, struct page *); static struct swp_buffer * ! decompress_to_swp_buffer(struct comp_cache_fragment * fragment, unsigned int gfp_mask) { struct page * buffer_page; struct swp_buffer * swp_buffer; *************** *** 210,214 **** struct list_head * fragment_lh, * tmp_lh; int maxscan, nrpages, swap_cache_page; ! comp_cache_fragment_t * fragment; struct swp_buffer * swp_buffer; struct page * page; --- 210,214 ---- struct list_head * fragment_lh, * tmp_lh; int maxscan, nrpages, swap_cache_page; ! struct comp_cache_fragment * fragment; struct swp_buffer * swp_buffer; struct page * page; *************** *** 224,228 **** } ! fragment = list_entry(fragment_lh = lru_queue.prev, comp_cache_fragment_t, lru_queue); page = fragment->comp_page->page; --- 224,228 ---- } ! fragment = list_entry(fragment_lh = lru_queue.prev, struct comp_cache_fragment, lru_queue); page = fragment->comp_page->page; *************** *** 314,318 **** for_each_fragment(tmp_lh, fragment->comp_page) { if (tmp_lh != fragment_lh) { ! comp_cache_fragment_t * tmp = list_entry(tmp_lh, comp_cache_fragment_t, list); if (!list_empty(&(tmp->lru_queue))) { remove_fragment_from_lru_queue(tmp); --- 314,318 ---- for_each_fragment(tmp_lh, fragment->comp_page) { if (tmp_lh != fragment_lh) { ! struct comp_cache_fragment * tmp = list_entry(tmp_lh, struct comp_cache_fragment, list); if (!list_empty(&(tmp->lru_queue))) { remove_fragment_from_lru_queue(tmp); *************** *** 356,360 **** } ! extern void add_fragment_vswap(comp_cache_fragment_t *); /*** --- 356,360 ---- } ! extern void add_fragment_vswap(struct comp_cache_fragment *); /*** *************** *** 381,389 **** * * @gfp_mask: we need to know if we can perform IO */ ! comp_cache_t * ! get_comp_cache_page(struct page * page, unsigned short compressed_size, comp_cache_fragment_t ** fragment_out, int dirty, int alloc, unsigned int gfp_mask) { ! comp_cache_t * comp_page = NULL; ! comp_cache_fragment_t * fragment = NULL, * previous_fragment = NULL; struct list_head * fragment_lh; struct page * new_page; --- 381,389 ---- * * @gfp_mask: we need to know if we can perform IO */ ! struct comp_cache_page * ! get_comp_cache_page(struct page * page, unsigned short compressed_size, struct comp_cache_fragment ** fragment_out, int dirty, int alloc, unsigned int gfp_mask) { ! struct comp_cache_page * comp_page = NULL; ! struct comp_cache_fragment * fragment = NULL, * previous_fragment = NULL; struct list_head * fragment_lh; struct page * new_page; *************** *** 521,525 **** #if 0 { ! comp_cache_fragment_t * fout; if (!find_comp_page(page->mapping, page->index, &fout)) { --- 521,525 ---- #if 0 { ! struct comp_cache_fragment * fout; if (!find_comp_page(page->mapping, page->index, &fout)) { *************** *** 542,546 **** /* add the fragment to the comp_page list of fragments */ ! previous_fragment = list_entry(comp_page->fragments.prev, comp_cache_fragment_t, list); if (previous_fragment->offset + previous_fragment->compressed_size == fragment->offset) { --- 542,546 ---- /* add the fragment to the comp_page list of fragments */ ! previous_fragment = list_entry(comp_page->fragments.prev, struct comp_cache_fragment, list); if (previous_fragment->offset + previous_fragment->compressed_size == fragment->offset) { *************** *** 553,559 **** for_each_fragment(fragment_lh, comp_page) { ! comp_cache_fragment_t * aux_fragment; ! aux_fragment = list_entry(fragment_lh, comp_cache_fragment_t, list); if (aux_fragment->offset + aux_fragment->compressed_size > fragment->offset) --- 553,559 ---- for_each_fragment(fragment_lh, comp_page) { ! struct comp_cache_fragment * aux_fragment; ! aux_fragment = list_entry(fragment_lh, struct comp_cache_fragment, list); if (aux_fragment->offset + aux_fragment->compressed_size > fragment->offset) Index: vswap.c =================================================================== RCS file: /cvsroot/linuxcompressed/linux/mm/comp_cache/vswap.c,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -r1.33 -r1.34 *** vswap.c 18 Jun 2002 18:04:32 -0000 1.33 --- vswap.c 19 Jun 2002 12:18:44 -0000 1.34 *************** *** 2,6 **** * linux/mm/comp_cache/vswap.c * ! * Time-stamp: <2002-06-18 14:56:27 rcastro> * * Linux Virtual Memory Compressed Cache --- 2,6 ---- * linux/mm/comp_cache/vswap.c * ! * Time-stamp: <2002-06-19 08:47:38 rcastro> * * Linux Virtual Memory Compressed Cache *************** *** 243,247 **** unsigned long offset = SWP_OFFSET(entry); unsigned int count; ! comp_cache_fragment_t * fragment; struct vswap_address * vswap; struct page * page; --- 243,247 ---- unsigned long offset = SWP_OFFSET(entry); unsigned int count; ! struct comp_cache_fragment * fragment; struct vswap_address * vswap; struct page * page; *************** *** 343,347 **** */ inline void ! remove_fragment_vswap(comp_cache_fragment_t * fragment) { swp_entry_t entry; --- 343,347 ---- */ inline void ! remove_fragment_vswap(struct comp_cache_fragment * fragment) { swp_entry_t entry; *************** *** 384,388 **** */ inline void ! add_fragment_vswap(comp_cache_fragment_t * fragment) { swp_entry_t entry; --- 384,388 ---- */ inline void ! add_fragment_vswap(struct comp_cache_fragment * fragment) { swp_entry_t entry; |