Skip to content

Commit 82abe67

Browse files
committed
cityhash: replace invocations with specialized versions when possible
So that we can get actual benefit from last commit. See more discussion at #16483. Acked-by: Alexander Motin <[email protected]> Signed-off-by: Shengqi Chen <[email protected]>
1 parent 8f8ed18 commit 82abe67

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
@@ -566,8 +566,8 @@ zvol_request_impl(zvol_state_t *zv, struct bio *bio, struct request *rq,
566566
rq->q->queue_hw_ctx[rq->q->mq_map[rq->cpu]]->queue_num;
567567
#endif
568568
#endif
569-
taskq_hash = cityhash4((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
570-
blk_mq_hw_queue, 0);
569+
taskq_hash = cityhash3((uintptr_t)zv, offset >> ZVOL_TASKQ_OFFSET_SHIFT,
570+
blk_mq_hw_queue);
571571
tq_idx = taskq_hash % ztqs->tqs_cnt;
572572

573573
if (rw == WRITE) {

module/zfs/dmu_objset.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,12 +391,12 @@ dmu_objset_byteswap(void *buf, size_t size)
391391
}
392392

393393
/*
394-
* Runs cityhash4 on the objset_t pointer and the object number.
394+
* Runs cityhash on the objset_t pointer and the object number.
395395
*/
396396
static uint64_t
397397
dnode_hash(const objset_t *os, uint64_t obj)
398398
{
399-
return (cityhash4((uint64_t)os, obj, 0, 0));
399+
return (cityhash2((uint64_t)os, obj));
400400
}
401401

402402
static unsigned int

module/zfs/zio.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,8 +4157,8 @@ zio_alloc_zil(spa_t *spa, objset_t *os, uint64_t txg, blkptr_t *new_bp,
41574157
* some parallelism.
41584158
*/
41594159
int flags = METASLAB_ZIL;
4160-
int allocator = (uint_t)cityhash4(0, 0, 0,
4161-
os->os_dsl_dataset->ds_object) % spa->spa_alloc_count;
4160+
int allocator = (uint_t)cityhash1(os->os_dsl_dataset->ds_object)
4161+
% spa->spa_alloc_count;
41624162
error = metaslab_alloc(spa, spa_log_class(spa), size, new_bp, 1,
41634163
txg, NULL, flags, &io_alloc_list, NULL, allocator);
41644164
*slog = (error == 0);

0 commit comments

Comments
 (0)