mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-18 15:15:56 +08:00
[svn-r2157] Changed hashing scheme slightly to better spread out the hash values returned.
This commit is contained in:
parent
395326672c
commit
5999195011
@ -494,6 +494,7 @@ H5AC_set(H5F_t *f, const H5AC_class_t *type, haddr_t addr, void *thing)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
if (slot->type) {
|
||||
flush = slot->type->flush;
|
||||
status = (flush)(f, TRUE, slot->addr, slot->thing);
|
||||
@ -666,7 +667,7 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, haddr_t addr,
|
||||
cache->diagnostics[slot->type->id].nhits++;
|
||||
thing = slot->thing;
|
||||
slot->type = NULL;
|
||||
slot->addr = HADDR_UNDEF;
|
||||
slot->addr = HADDR_UNDEF;
|
||||
slot->thing = NULL;
|
||||
|
||||
} else if (slot->type && H5F_addr_eq(slot->addr, addr)) {
|
||||
|
@ -71,8 +71,11 @@ typedef struct H5AC_class_t {
|
||||
* cache entry by hashing the object's file address. Each file has its
|
||||
* own cache, an array of slots.
|
||||
*/
|
||||
#define H5AC_NSLOTS 10330 /*prime number tend to work best */
|
||||
#define H5AC_HASH(F,ADDR) H5F_addr_hash(ADDR,(F)->shared->cache->nslots)
|
||||
#define H5AC_NSLOTS 10330 /* The library "likes" this number... */
|
||||
#define H5AC_HASH_DIVISOR 8 /* Attempt to spread out the hashing */
|
||||
/* This should be the same size as the alignment of */
|
||||
/* of the smallest file format object written to the file. */
|
||||
#define H5AC_HASH(F,ADDR) H5F_addr_hash((ADDR/H5AC_HASH_DIVISOR),(F)->shared->cache->nslots)
|
||||
|
||||
typedef struct H5AC_prot_t {
|
||||
const H5AC_class_t *type; /*type of protected thing */
|
||||
|
Loading…
Reference in New Issue
Block a user