/* Allocate buffer hash table for a given target. For devices containing metadata (i.e. not the log/realtime devices) we need to allocate a much larger hash table.  */
STATIC void xfs_alloc_bufhash(xfs_buftarg_t *btp, int external)
/* Allocate buffer hash table for a given target. For devices containing metadata (i.e. not the log/realtime devices) we need to allocate a much larger hash table.  */
STATIC void xfs_alloc_bufhash(xfs_buftarg_t *btp, int external)
{
	unsigned int		i;
	btp->bt_hashshift = external ? 3 : 8;
	btp->bt_hashmask = (1 << btp->bt_hashshift) - 1;
	btp->bt_hash = kmem_zalloc((1 << btp->bt_hashshift) *
					sizeof(xfs_bufhash_t), KM_SLEEP | KM_LARGE);
	for (i = 0; i < (1 << btp->bt_hashshift); i++) {
		spin_lock_init(&btp->bt_hash[i].bh_lock);
		INIT_LIST_HEAD(&btp->bt_hash[i].bh_list);
	}
}