cityhash: replace invocations with specialized versions when possible
So that we can get actual benefit from last commit. See more discussion at https://github.com/openzfs/zfs/pull/16483. Acked-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Shengqi Chen <harry-chen@outlook.com>
This commit is contained in:
parent
7b580dcdf2
commit
af3228c69b
|
@ -132,7 +132,7 @@ static void
|
||||||
rdt_insert(redup_table_t *rdt,
|
rdt_insert(redup_table_t *rdt,
|
||||||
uint64_t guid, uint64_t object, uint64_t offset, uint64_t stream_offset)
|
uint64_t guid, uint64_t object, uint64_t offset, uint64_t stream_offset)
|
||||||
{
|
{
|
||||||
uint64_t ch = cityhash4(guid, object, offset, 0);
|
uint64_t ch = cityhash3(guid, object, offset);
|
||||||
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
|
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
|
||||||
redup_entry_t **rdepp;
|
redup_entry_t **rdepp;
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ rdt_lookup(redup_table_t *rdt,
|
||||||
uint64_t guid, uint64_t object, uint64_t offset,
|
uint64_t guid, uint64_t object, uint64_t offset,
|
||||||
uint64_t *stream_offsetp)
|
uint64_t *stream_offsetp)
|
||||||
{
|
{
|
||||||
uint64_t ch = cityhash4(guid, object, offset, 0);
|
uint64_t ch = cityhash3(guid, object, offset);
|
||||||
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
|
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
|
||||||
|
|
||||||
for (redup_entry_t *rde = rdt->redup_hash_array[hashcode];
|
for (redup_entry_t *rde = rdt->redup_hash_array[hashcode];
|
||||||
|
|
|
@ -566,8 +566,8 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
|
||||||
rq->q->queue_hw_ctx[rq->q->mq_map[rq->cpu]]->queue_num;
|
rq->q->queue_hw_ctx[rq->q->mq_map[rq->cpu]]->queue_num;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
taskq_hash = cityhash4((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
|
taskq_hash = cityhash3((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
|
||||||
blk_mq_hw_queue, 0);
|
blk_mq_hw_queue);
|
||||||
tq_idx = taskq_hash % ztqs->tqs_cnt;
|
tq_idx = taskq_hash % ztqs->tqs_cnt;
|
||||||
|
|
||||||
if (rw == WRITE) {
|
if (rw == WRITE) {
|
||||||
|
|
|
@ -391,13 +391,13 @@ dmu_objset_byteswap(void *buf, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Runs cityhash4 on the objset_t pointer and the object number.
|
* Runs cityhash on the objset_t pointer and the object number.
|
||||||
*/
|
*/
|
||||||
static uint64_t
|
static uint64_t
|
||||||
dnode_hash(const objset_t *os, uint64_t obj)
|
dnode_hash(const objset_t *os, uint64_t obj)
|
||||||
{
|
{
|
||||||
uintptr_t osv = (uintptr_t)os;
|
uintptr_t osv = (uintptr_t)os;
|
||||||
return (cityhash4((uint64_t)osv, obj, 0, 0));
|
return (cityhash2((uint64_t)osv, obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
|
|
|
@ -4157,8 +4157,8 @@ zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, blkptr_t *new_bp,
|
||||||
* some parallelism.
|
* some parallelism.
|
||||||
*/
|
*/
|
||||||
int flags = METASLAB_ZIL;
|
int flags = METASLAB_ZIL;
|
||||||
int allocator = (uint_t)cityhash4(0, 0, 0,
|
int allocator = (uint_t)cityhash1(os->os_dsl_dataset->ds_object)
|
||||||
os->os_dsl_dataset->ds_object) % spa->spa_alloc_count;
|
% spa->spa_alloc_count;
|
||||||
error = metaslab_alloc(spa, spa_log_class(spa), size, new_bp, 1,
|
error = metaslab_alloc(spa, spa_log_class(spa), size, new_bp, 1,
|
||||||
txg, NULL, flags, &io_alloc_list, NULL, allocator);
|
txg, NULL, flags, &io_alloc_list, NULL, allocator);
|
||||||
*slog = (error == 0);
|
*slog = (error == 0);
|
||||||
|
|
Loading…
Reference in New Issue