]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Eliminate gratuitous bzeroing in dbuf_stats_hash_table_data
authorMatthew Macy <mmacy@freebsd.org>
Wed, 30 Sep 2020 20:24:38 +0000 (13:24 -0700)
committerGitHub <noreply@github.com>
Wed, 30 Sep 2020 20:24:38 +0000 (13:24 -0700)
`dbuf_stats_hash_table_data` can take much longer than it needs to
by repeatedly bzeroing its buffer when in fact the buffer only needs
to be NULL terminated.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Matt Macy <mmacy@FreeBSD.org>
Closes #10993

module/zfs/dbuf_stats.c

index a2f3c580ee6ce26925fe7d8d9447cf62b9292376..12bb568a08cc94b625e424df926f7e41e7b7df89 100644 (file)
@@ -134,7 +134,8 @@ dbuf_stats_hash_table_data(char *buf, size_t size, void *data)
 
        ASSERT3S(dsh->idx, >=, 0);
        ASSERT3S(dsh->idx, <=, h->hash_table_mask);
-       memset(buf, 0, size);
+       if (size)
+               buf[0] = 0;
 
        mutex_enter(DBUF_HASH_MUTEX(h, dsh->idx));
        for (db = h->hash_table[dsh->idx]; db != NULL; db = db->db_hash_next) {