Commit 0c2a867f authored by Stephen Lord's avatar Stephen Lord Committed by Stephen Lord

[XFS] Switch pagebuf hashing to be based on the block_device address

rather than the dev_t. Should give better distribution. Mod from Al Viro.

SGI Modid: 2.5.x-xfs:slinx:158800a
parent a28e797b
......@@ -174,16 +174,13 @@ STATIC pb_hash_t pbhash[NHASH];
STATIC int
_bhash(
dev_t dev,
struct block_device *bdev,
loff_t base)
{
int bit, hval;
base >>= 9;
/*
* dev_t is 16 bits, loff_t is always 64 bits
*/
base ^= dev;
base ^= (unsigned long)bdev / L1_CACHE_BYTES;
for (bit = hval = 0; base && bit < sizeof(base) * 8; bit += NBITS) {
hval ^= (int)base & (NHASH-1);
base >>= NBITS;
......@@ -619,7 +616,7 @@ _pagebuf_find( /* find buffer for block */
/* Ensure we never do IOs that are not sector aligned */
BUG_ON(range_base & (loff_t)target->pbr_smask);
hval = _bhash(target->pbr_bdev->bd_dev, range_base);
hval = _bhash(target->pbr_bdev, range_base);
h = &pbhash[hval];
spin_lock(&h->pb_hash_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment