printf("\tlinkHandle = %p\n", v.linkHandle);
printf("\tnextVnodeUnique = %u\n", v.nextVnodeUnique);
printf("\tdiskDataHandle = %p\n", v.diskDataHandle);
- printf("\tvnodeHashOffset = %u\n", v.vnodeHashOffset);
printf("\tshuttingDown = %d\n", v.shuttingDown);
printf("\tgoingOffline = %d\n", v.goingOffline);
printf("\tcacheCheck = %u\n", v.cacheCheck);
#ifdef AFS_PTHREAD_ENV
#include <opr/lock.h>
#endif
+#include <opr/jhash.h>
#include "rx/rx_queue.h"
#include <afs/afsint.h>
#include "nfs.h"
}
-
-
-/* Vnode hash table. Find hash chain by taking lower bits of
- * (volume_hash_offset + vnode).
- * This distributes the root inodes of the volumes over the
- * hash table entries and also distributes the vnodes of
- * volumes reasonably fairly. The volume_hash_offset field
- * for each volume is established as the volume comes on line
- * by using the VOLUME_HASH_OFFSET macro. This distributes the
- * volumes fairly among the cache entries, both when servicing
- * a small number of volumes and when servicing a large number.
- */
-
-/* VolumeHashOffset -- returns a new value to be stored in the
- * volumeHashOffset of a Volume structure. Called when a
- * volume is initialized. Sets the volumeHashOffset so that
- * vnode cache entries are distributed reasonably between
- * volumes (the root vnodes of the volumes will hash to
- * different values, and spacing is maintained between volumes
- * when there are not many volumes represented), and spread
- * equally amongst vnodes within a single volume.
+/* Vnode hash table. Just use the Jenkins hash of the vnode number,
+ * with the volume ID as an initval because it's there. (That will
+ * make the same vnode number in different volumes hash to a different
+ * value, which would probably not even be a big deal anyway.)
*/
-int
-VolumeHashOffset_r(void)
-{
- static int nextVolumeHashOffset = 0;
- /* hashindex Must be power of two in size */
-# define hashShift 3
-# define hashMask ((1<<hashShift)-1)
- static byte hashindex[1 << hashShift] =
- { 0, 128, 64, 192, 32, 160, 96, 224 };
- int offset;
- offset = hashindex[nextVolumeHashOffset & hashMask]
- + (nextVolumeHashOffset >> hashShift);
- nextVolumeHashOffset++;
- return offset;
-}
-/* Change hashindex (above) if you change this constant */
-#define VNODE_HASH_TABLE_SIZE 256
+#define VNODE_HASH_TABLE_BITS 11
+#define VNODE_HASH_TABLE_SIZE opr_jhash_size(VNODE_HASH_TABLE_BITS)
+#define VNODE_HASH_TABLE_MASK opr_jhash_mask(VNODE_HASH_TABLE_BITS)
private Vnode *VnodeHashTable[VNODE_HASH_TABLE_SIZE];
#define VNODE_HASH(volumeptr,vnodenumber)\
- ((volumeptr->vnodeHashOffset + vnodenumber)&(VNODE_HASH_TABLE_SIZE-1))
+ (opr_jhash_int((vnodenumber), V_id((volumeptr))) & VNODE_HASH_TABLE_MASK)
* uniquifier should be rewritten with the
* value nextVnodeVersion */
IHandle_t *diskDataHandle; /* Unix inode holding general volume info */
- bit16 vnodeHashOffset; /* Computed by HashOffset function in vnode.h.
- * Assigned to the volume when initialized.
- * Added to vnode number for hash table index */
byte shuttingDown; /* This volume is going to be detached */
byte goingOffline; /* This volume is going offline */
bit32 cacheCheck; /* Online sequence number to be used to invalidate vnode cache entries