[lc-checkins] CVS: linux/include/linux comp_cache.h,1.77,1.78
Status: Beta
Brought to you by:
nitin_sf
|
From: Rodrigo S. de C. <rc...@us...> - 2002-06-19 12:18:50
|
Update of /cvsroot/linuxcompressed/linux/include/linux
In directory usw-pr-cvs1:/tmp/cvs-serv15026/include/linux
Modified Files:
comp_cache.h
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: comp_cache.h
===================================================================
RCS file: /cvsroot/linuxcompressed/linux/include/linux/comp_cache.h,v
retrieving revision 1.77
retrieving revision 1.78
diff -C2 -r1.77 -r1.78
*** comp_cache.h 18 Jun 2002 13:39:33 -0000 1.77
--- comp_cache.h 19 Jun 2002 12:18:43 -0000 1.78
***************
*** 2,6 ****
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-06-18 10:16:07 rcastro>
*
* Linux Virtual Memory Compressed Cache
--- 2,6 ----
* linux/mm/comp_cache.h
*
! * Time-stamp: <2002-06-19 08:59:31 rcastro>
*
* Linux Virtual Memory Compressed Cache
***************
*** 43,47 ****
};
! typedef struct comp_cache_fragment {
/* list of fragments in a comp page*/
struct list_head list;
--- 43,47 ----
};
! struct comp_cache_fragment {
/* list of fragments in a comp page*/
struct list_head list;
***************
*** 64,74 ****
unsigned long flags;
! struct comp_cache_struct * comp_page;
struct comp_cache_fragment * next_hash;
struct comp_cache_fragment ** pprev_hash;
! } comp_cache_fragment_t;
! typedef struct comp_cache_struct {
struct page * page;
--- 64,74 ----
unsigned long flags;
! struct comp_cache_page * comp_page;
struct comp_cache_fragment * next_hash;
struct comp_cache_fragment ** pprev_hash;
! };
! struct comp_cache_page {
struct page * page;
***************
*** 79,91 ****
struct list_head fragments;
! struct comp_cache_struct * next_hash;
! struct comp_cache_struct ** pprev_hash;
! } comp_cache_t;
#define alloc_fragment() \
! ((comp_cache_fragment_t *) kmem_cache_alloc(fragment_cachep, SLAB_ATOMIC))
#define alloc_comp_cache() \
! ((comp_cache_t *) kmem_cache_alloc(comp_cachep, SLAB_ATOMIC))
#define alloc_vswap() \
--- 79,91 ----
struct list_head fragments;
! struct comp_cache_page * next_hash;
! struct comp_cache_page ** pprev_hash;
! };
#define alloc_fragment() \
! ((struct comp_cache_fragment *) kmem_cache_alloc(fragment_cachep, SLAB_ATOMIC))
#define alloc_comp_cache() \
! ((struct comp_cache_page *) kmem_cache_alloc(comp_cachep, SLAB_ATOMIC))
#define alloc_vswap() \
***************
*** 109,117 ****
#ifdef CONFIG_COMP_CACHE
! int shrink_comp_cache(comp_cache_t *);
inline void grow_comp_cache(zone_t *, int);
void adapt_comp_cache(void);
#else
! static inline int shrink_comp_cache(comp_cache_t * comp_page) { return 0; }
static inline void grow_comp_cache(zone_t * zone, int nr_pages) { }
#endif
--- 109,117 ----
#ifdef CONFIG_COMP_CACHE
! int shrink_comp_cache(struct comp_cache_page *);
inline void grow_comp_cache(zone_t *, int);
void adapt_comp_cache(void);
#else
! static inline int shrink_comp_cache(struct comp_cache_page * comp_page) { return 0; }
static inline void grow_comp_cache(zone_t * zone, int nr_pages) { }
#endif
***************
*** 187,191 ****
struct page * page; /* page for IO */
! comp_cache_fragment_t * fragment; /* pointer to the fragment we are doing IO */
};
--- 187,191 ----
struct page * page; /* page for IO */
! struct comp_cache_fragment * fragment; /* pointer to the fragment we are doing IO */
};
***************
*** 201,205 ****
#define for_each_fragment(p, comp_page) list_for_each(p, &(comp_page->fragments))
! #define member_offset(key) ((unsigned long) (&((comp_cache_t *)0)->key))
#define apply_key_offset(node, offset) (* (unsigned short *)((char *) node + offset))
--- 201,205 ----
#define for_each_fragment(p, comp_page) list_for_each(p, &(comp_page->fragments))
! #define member_offset(key) ((unsigned long) (&((struct comp_cache_page *)0)->key))
#define apply_key_offset(node, offset) (* (unsigned short *)((char *) node + offset))
***************
*** 241,245 ****
} zenTimerType;
! typedef struct stats_summary_struct {
unsigned long long comp_size_sum;
unsigned int comp_size_max, comp_size_min;
--- 241,245 ----
} zenTimerType;
! struct stats_summary {
unsigned long long comp_size_sum;
unsigned int comp_size_max, comp_size_min;
***************
*** 253,273 ****
unsigned long faultin_swap, faultin_page;
unsigned long discarded_pages;
! } stats_summary_t;
! typedef struct stats_page_struct {
unsigned int comp_size; /* compressed size of a page */
unsigned long comp_cycles; /* cycles taken for compression */
unsigned long decomp_cycles; /* cycles taken for decompression */
zenTimerType myTimer; /* used to calculate the cycles */
! } stats_page_t;
! typedef struct compression_algorithm_struct {
char name[6];
compress_function_t * comp;
decompress_function_t * decomp;
! stats_summary_t stats;
! } compression_algorithm_t;
! typedef struct {
WK_word *compressed_data;
WK_word *decompressed_data;
--- 253,273 ----
unsigned long faultin_swap, faultin_page;
unsigned long discarded_pages;
! };
! struct stats_page {
unsigned int comp_size; /* compressed size of a page */
unsigned long comp_cycles; /* cycles taken for compression */
unsigned long decomp_cycles; /* cycles taken for decompression */
zenTimerType myTimer; /* used to calculate the cycles */
! };
! struct comp_alg {
char name[6];
compress_function_t * comp;
decompress_function_t * decomp;
! struct stats_summary stats;
! };
! struct comp_alg_data {
WK_word *compressed_data;
WK_word *decompressed_data;
***************
*** 281,285 ****
unsigned short compressed_size;
! } comp_data_t;
#define START_ZEN_TIME(userTimer) { \
--- 281,285 ----
unsigned short compressed_size;
! };
#define START_ZEN_TIME(userTimer) { \
***************
*** 303,310 ****
#ifdef CONFIG_COMP_CACHE
void comp_cache_update_page_comp_stats(struct page *);
! void comp_cache_update_writeout_stats(comp_cache_fragment_t *);
! void comp_cache_update_faultin_stats(comp_cache_fragment_t *);
! void set_fragment_algorithm(comp_cache_fragment_t *, unsigned short);
! void decompress(comp_cache_fragment_t *, struct page *);
int compress(struct page *, void *, unsigned short *, int);
--- 303,310 ----
#ifdef CONFIG_COMP_CACHE
void comp_cache_update_page_comp_stats(struct page *);
! void comp_cache_update_writeout_stats(struct comp_cache_fragment *);
! void comp_cache_update_faultin_stats(struct comp_cache_fragment *);
! void set_fragment_algorithm(struct comp_cache_fragment *, unsigned short);
! void decompress(struct comp_cache_fragment *, struct page *);
int compress(struct page *, void *, unsigned short *, int);
***************
*** 341,345 ****
int compress_page(struct page *, int, unsigned int);
void comp_cache_init(void);
! inline void init_comp_page(comp_cache_t **,struct page *);
inline void compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int);
inline int compress_clean_page(struct page *, unsigned int);
--- 341,345 ----
int compress_page(struct page *, int, unsigned int);
void comp_cache_init(void);
! inline void init_comp_page(struct comp_cache_page **,struct page *);
inline void compress_dirty_page(struct page *, int (*writepage)(struct page *), unsigned int);
inline int compress_clean_page(struct page *, unsigned int);
***************
*** 384,388 ****
unsigned long offset;
! comp_cache_fragment_t * fragment;
struct page * swap_cache_page;
--- 384,388 ----
unsigned long offset;
! struct comp_cache_fragment * fragment;
struct page * swap_cache_page;
***************
*** 407,411 ****
#define COMP_CACHE_SWP_TYPE MAX_SWAPFILES
! #define VSWAP_RESERVED ((comp_cache_fragment_t *) 0xffffffff)
#ifdef CONFIG_COMP_CACHE
--- 407,411 ----
#define COMP_CACHE_SWP_TYPE MAX_SWAPFILES
! #define VSWAP_RESERVED ((struct comp_cache_fragment *) 0xffffffff)
#ifdef CONFIG_COMP_CACHE
***************
*** 450,455 ****
/* free.c */
! void comp_cache_free_locked(comp_cache_fragment_t *);
! inline void comp_cache_free(comp_cache_fragment_t *);
#ifdef CONFIG_COMP_CACHE
--- 450,455 ----
/* free.c */
! void comp_cache_free_locked(struct comp_cache_fragment *);
! inline void comp_cache_free(struct comp_cache_fragment *);
#ifdef CONFIG_COMP_CACHE
***************
*** 500,507 ****
/* aux.c */
unsigned long long big_division(unsigned long long, unsigned long long);
! inline void set_comp_page(comp_cache_t *, struct page *);
! inline void check_all_fragments(comp_cache_t *);
! extern comp_cache_fragment_t ** fragment_hash;
extern unsigned long fragment_hash_size;
extern unsigned long fragment_hash_used;
--- 500,507 ----
/* aux.c */
unsigned long long big_division(unsigned long long, unsigned long long);
! inline void set_comp_page(struct comp_cache_page *, struct page *);
! inline void check_all_fragments(struct comp_cache_page *);
! extern struct comp_cache_fragment ** fragment_hash;
extern unsigned long fragment_hash_size;
extern unsigned long fragment_hash_used;
***************
*** 521,528 ****
}
! inline void __add_fragment_to_hash_table(comp_cache_fragment_t **, unsigned int, comp_cache_fragment_t *);
! inline void remove_fragment_from_hash_table(comp_cache_fragment_t *);
! static inline void add_fragment_to_hash_table(comp_cache_fragment_t * fragment) {
__add_fragment_to_hash_table(fragment_hash, __fragment_hashfn(fragment->mapping, fragment->index, fragment_hash_size, fragment_hash_bits), fragment);
}
--- 521,528 ----
}
! inline void __add_fragment_to_hash_table(struct comp_cache_fragment **, unsigned int, struct comp_cache_fragment *);
! inline void remove_fragment_from_hash_table(struct comp_cache_fragment *);
! static inline void add_fragment_to_hash_table(struct comp_cache_fragment * fragment) {
__add_fragment_to_hash_table(fragment_hash, __fragment_hashfn(fragment->mapping, fragment->index, fragment_hash_size, fragment_hash_bits), fragment);
}
***************
*** 541,562 ****
}
! inline void add_comp_page_to_hash_table(comp_cache_t *);
! inline void remove_comp_page_from_hash_table(comp_cache_t *);
int set_pte_list_to_entry(struct pte_list *, swp_entry_t, swp_entry_t);
! comp_cache_t * search_comp_page_free_space(int);
! comp_cache_fragment_t ** create_fragment_hash(unsigned long *, unsigned int *, unsigned int *);
extern struct list_head lru_queue;
! inline void add_fragment_to_lru_queue(comp_cache_fragment_t *);
! inline void add_fragment_to_lru_queue_tail(comp_cache_fragment_t *);
! inline void remove_fragment_from_lru_queue(comp_cache_fragment_t *);
/* enough memory functions */
#ifdef CONFIG_COMP_CACHE
! extern int FASTCALL(find_comp_page(struct address_space *, unsigned long, comp_cache_fragment_t **));
#else
! static inline int find_comp_page(struct address_space * mapping, unsigned long offset, comp_cache_fragment_t ** fragment) { return -ENOENT; }
#endif
--- 541,562 ----
}
! inline void add_comp_page_to_hash_table(struct comp_cache_page *);
! inline void remove_comp_page_from_hash_table(struct comp_cache_page *);
int set_pte_list_to_entry(struct pte_list *, swp_entry_t, swp_entry_t);
! struct comp_cache_page * search_comp_page_free_space(int);
! struct comp_cache_fragment ** create_fragment_hash(unsigned long *, unsigned int *, unsigned int *);
extern struct list_head lru_queue;
! inline void add_fragment_to_lru_queue(struct comp_cache_fragment *);
! inline void add_fragment_to_lru_queue_tail(struct comp_cache_fragment *);
! inline void remove_fragment_from_lru_queue(struct comp_cache_fragment *);
/* enough memory functions */
#ifdef CONFIG_COMP_CACHE
! extern int FASTCALL(find_comp_page(struct address_space *, unsigned long, struct comp_cache_fragment **));
#else
! static inline int find_comp_page(struct address_space * mapping, unsigned long offset, struct comp_cache_fragment ** fragment) { return -ENOENT; }
#endif
|