aboutsummaryrefslogtreecommitdiffstats
path: root/module/zfs/dbuf_stats.c
diff options
context:
space:
mode:
authorMatthew Macy <[email protected]>2020-09-30 13:24:38 -0700
committerGitHub <[email protected]>2020-09-30 13:24:38 -0700
commit1cb8202b1b0b5810ab9eaecd19fc84f8ffb874d9 (patch)
tree29184cab763286fe1c9a1f28abea100781b3017e /module/zfs/dbuf_stats.c
parent8a171ccd9258c9528af413562b5bd6b994cf9c2e (diff)
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 <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: Matt Macy <[email protected]> Closes #10993
Diffstat (limited to 'module/zfs/dbuf_stats.c')
-rw-r--r--module/zfs/dbuf_stats.c3
1 files changed, 2 insertions, 1 deletions
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) {