Changeset 358


Ignore:
Timestamp:
2007-03-01T11:51:20+01:00 (8 years ago)
Author:
moo
Message:

fixed #71 inode hasing issue on some fs, by folding hash value with xor so every bits takes its value

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.2/xcache.c

    r340 r358  
    680680#define HASH_STR(s) HASH_STR_L(s, strlen(s) + 1) 
    681681#define HASH_NUM(n) HASH(n) 
     682static inline xc_hash_value_t xc_hash_fold(xc_hash_value_t hvalue, const xc_hash_t *hasher) /* {{{ fold hash bits as needed */ 
     683{ 
     684    xc_hash_value_t folded = 0; 
     685    while (hvalue) { 
     686        folded ^= (hvalue & hasher->mask); 
     687        hvalue >>= hasher->bits; 
     688    } 
     689    return folded; 
     690} 
     691/* }}} */ 
    682692static inline xc_hash_value_t xc_entry_hash_name(xc_entry_t *xce TSRMLS_DC) /* {{{ */ 
    683693{ 
     
    790800 
    791801    hv = xc_entry_hash_php(xce TSRMLS_CC); 
    792     cacheid = (hv & xc_php_hcache.mask); 
     802    cacheid = xc_hash_fold(hv, &xc_php_hcache); 
    793803    xce->cache = xc_php_caches[cacheid]; 
    794     hv >>= xc_php_hcache.bits; 
    795     xce->hvalue = (hv & xc_php_hentry.mask); 
     804    xce->hvalue = xc_hash_fold(hv, &xc_php_hentry); 
    796805 
    797806    xce->type = XC_TYPE_PHP; 
Note: See TracChangeset for help on using the changeset viewer.