From 1cb8202b1b0b5810ab9eaecd19fc84f8ffb874d9 Mon Sep 17 00:00:00 2001 From: Matthew Macy Date: Wed, 30 Sep 2020 13:24:38 -0700 Subject: Eliminate gratuitous bzeroing in dbuf_stats_hash_table_data `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 Reviewed-by: Ryan Moeller Signed-off-by: Matt Macy Closes #10993 --- module/zfs/dbuf_stats.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/zfs') diff --git a/module/zfs/dbuf_stats.c b/module/zfs/dbuf_stats.c index a2f3c580e..12bb568a0 100644 --- a/module/zfs/dbuf_stats.c +++ b/module/zfs/dbuf_stats.c @@ -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) { -- cgit v1.2.3