diff -Naur /home/rni/linux-cart.v2/include/linux/cart.h linux-cart.v3/include/linux/cart.h --- /home/rni/linux-cart.v2/include/linux/cart.h 2005-08-16 13:58:49.000000000 -0400 +++ linux-cart.v3/include/linux/cart.h 2005-08-16 14:01:20.000000000 -0400 @@ -7,20 +7,18 @@ #define EVICTED_ACTIVE 1 #define EVICTED_LONGTERM 2 -#define ACTIVE 3 -#define ACTIVE_LONGTERM 4 +#define ACTIVE 4 +#define ACTIVE_LONGTERM 8 -#define EvictedActive(location) location & EVICTED_ACTIVE -#define EvictedLongterm(location) location & EVICTED_LONGTERM -#define Active(location) location & ACTIVE -#define ActiveLongterm(location) location & ACTIVE_LONGTERM +#define EvictedActive(location) (location & EVICTED_ACTIVE) +#define EvictedLongterm(location) (location & EVICTED_LONGTERM) +#define Active(location) (location & ACTIVE) +#define ActiveLongterm(location) (location & ACTIVE_LONGTERM) struct non_res_list_node { struct list_head list; struct list_head hash; - unsigned long mapping; - unsigned long offset; - unsigned long inode; + unsigned long hashval; }; extern void cart_init(); diff -Naur /home/rni/linux-cart.v2/include/linux/evicted_hash.h linux-cart.v3/include/linux/evicted_hash.h --- /home/rni/linux-cart.v2/include/linux/evicted_hash.h 2005-08-16 13:58:50.000000000 -0400 +++ linux-cart.v3/include/linux/evicted_hash.h 2005-08-16 14:06:54.000000000 -0400 @@ -3,7 +3,7 @@ #include void hashtable_init(struct hashtable *h); -unsigned long mk_hash(struct page *page); +unsigned long mk_hash_page(struct page *page); unsigned long find_in_hashtable(struct hashtable *h, struct page *page); void add_to_hashtable (struct hashtable *, struct non_res_list_node *); unsigned long get_inode_num(void *addr); diff -Naur /home/rni/linux-cart.v2/mm/cart.c linux-cart.v3/mm/cart.c --- /home/rni/linux-cart.v2/mm/cart.c 2005-08-16 13:58:40.000000000 -0400 +++ linux-cart.v3/mm/cart.c 2005-08-16 14:06:12.000000000 -0400 @@ -67,9 +67,7 @@ printk (KERN_EMERG "Couldn't get a non_res_node!\n"); return; - node->offset = page->index; - node->mapping = (unsigned long) page->mapping; - node->inode = get_inode_num(page->mapping); + node->hashval = mk_hash_page(page); list_add(&node->list, l); add_to_hashtable(h, node); diff -Naur /home/rni/linux-cart.v2/mm/evicted_hash.c linux-cart.v3/mm/evicted_hash.c --- /home/rni/linux-cart.v2/mm/evicted_hash.c 2005-08-16 13:58:40.000000000 -0400 +++ linux-cart.v3/mm/evicted_hash.c 2005-08-16 14:05:29.000000000 -0400 @@ -34,13 +34,13 @@ /* The hashing function... a better one is needed */ static inline unsigned long mk_hash_page(struct page *page) { - return (((unsigned long)page->mapping ^ page->index) ^ get_inode_num(page->mapping))%HASHTABLE_SIZE; + return ((unsigned long)page->mapping ^ page->index) ^ get_inode_num(page->mapping); } /* Hashing for non resident nodes */ static inline unsigned long mk_hash_non_res(struct non_res_list_node *node) { - return (node->offset ^ node->mapping ^ node->inode)%HASHTABLE_SIZE; + return (node->hashval)%HASHTABLE_SIZE; } /* Search in the hash table */ @@ -49,11 +49,12 @@ unsigned long index; struct non_res_list_node *node; struct list_head *list; - - index = mk_hash_page(page); + unsigned long hashval = mk_hash_page(page); + + index = hashval%HASHTABLE_SIZE; list_for_each_entry(node, &h->buckets[index], hash) { - if (node->mapping == (unsigned long)page->mapping && node->offset == page->index && node->inode == get_inode_num(page->mapping)) + if (node->hashval == hashval) return 1; }