Skip to content

Commit a877b39

Browse files
Harry-Chenbehlendorf
authored andcommitted
cityhash: replace invocations with specialized versions when possible
So that we can get actual benefit from last commit. Reviewed by: Brian Behlendorf <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Signed-off-by: Shengqi Chen <[email protected]> Closes #16131 Closes #16483
1 parent 0ae4460 commit a877b39

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

cmd/zstream/zstream_redup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ static void
132132
rdt_insert(redup_table_t *rdt,
133133
uint64_t guid, uint64_t object, uint64_t offset, uint64_t stream_offset)
134134
{
135-
uint64_t ch = cityhash4(guid, object, offset, 0);
135+
uint64_t ch = cityhash3(guid, object, offset);
136136
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
137137
redup_entry_t **rdepp;
138138

@@ -152,7 +152,7 @@ rdt_lookup(redup_table_t *rdt,
152152
uint64_t guid, uint64_t object, uint64_t offset,
153153
uint64_t *stream_offsetp)
154154
{
155-
uint64_t ch = cityhash4(guid, object, offset, 0);
155+
uint64_t ch = cityhash3(guid, object, offset);
156156
uint64_t hashcode = BF64_GET(ch, 0, rdt->numhashbits);
157157

158158
for (redup_entry_t *rde = rdt->redup_hash_array[hashcode];

module/os/linux/zfs/zvol_os.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,8 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
551551
blk_mq_hw_queue =
552552
rq->q->queue_hw_ctx[rq->q->mq_map[rq->cpu]]->queue_num;
553553
#endif
554-
taskq_hash = cityhash4((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
555-
blk_mq_hw_queue, 0);
554+
taskq_hash = cityhash3((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
555+
blk_mq_hw_queue);
556556
tq_idx = taskq_hash % ztqs->tqs_cnt;
557557

558558
if (rw == WRITE) {

module/zfs/dmu_objset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,13 +405,13 @@ dmu_objset_byteswap(void *buf, size_t size)
405405
}
406406

407407
/*
408-
* Runs cityhash4 on the objset_t pointer and the object number.
408+
* Runs cityhash on the objset_t pointer and the object number.
409409
*/
410410
static uint64_t
411411
dnode_hash(const objset_t *os, uint64_t obj)
412412
{
413413
uintptr_t osv = (uintptr_t)os;
414-
return (cityhash4((uint64_t)osv, obj, 0, 0));
414+
return (cityhash2((uint64_t)osv, obj));
415415
}
416416

417417
static unsigned int

module/zfs/zio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4182,8 +4182,8 @@ zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, blkptr_t *new_bp,
41824182
* some parallelism.
41834183
*/
41844184
int flags = METASLAB_ZIL;
4185-
int allocator = (uint_t)cityhash4(0, 0, 0,
4186-
os->os_dsl_dataset->ds_object) % spa->spa_alloc_count;
4185+
int allocator = (uint_t)cityhash1(os->os_dsl_dataset->ds_object)
4186+
% spa->spa_alloc_count;
41874187
error = metaslab_alloc(spa, spa_log_class(spa), size, new_bp, 1,
41884188
txg, NULL, flags, &io_alloc_list, NULL, allocator);
41894189
*slog = (error == 0);

0 commit comments

Comments
 (0)