From 051a8c749455689c0f3861120028bcc6a18894fe Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Wed, 17 Dec 2025 21:59:47 -0500 Subject: [PATCH] Bypass snprintf() in quota checks if no quotas set This improves synthetic 1 byte write speed by ~2.5%. Reviewed-by: Ameer Hamza Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Signed-off-by: Alexander Motin Closes #18063 --- module/zfs/zfs_quota.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/module/zfs/zfs_quota.c b/module/zfs/zfs_quota.c index 2e91ccc27..85b7a549b 100644 --- a/module/zfs/zfs_quota.c +++ b/module/zfs/zfs_quota.c @@ -433,13 +433,13 @@ zfs_id_overobjquota(zfsvfs_t *zfsvfs, uint64_t usedobj, uint64_t id) } else { return (B_FALSE); } + if (quotaobj == 0 && default_quota == 0) + return (B_FALSE); if (zfsvfs->z_replay) return (B_FALSE); (void) snprintf(buf, sizeof (buf), "%llx", (longlong_t)id); if (quotaobj == 0) { - if (default_quota == 0) - return (B_FALSE); quota = default_quota; } else { err = zap_lookup(zfsvfs->z_os, quotaobj, buf, 8, 1, "a); @@ -484,13 +484,13 @@ zfs_id_overblockquota(zfsvfs_t *zfsvfs, uint64_t usedobj, uint64_t id) } else { return (B_FALSE); } + if (quotaobj == 0 && default_quota == 0) + return (B_FALSE); if (zfsvfs->z_replay) return (B_FALSE); (void) snprintf(buf, sizeof (buf), "%llx", (longlong_t)id); if (quotaobj == 0) { - if (default_quota == 0) - return (B_FALSE); quota = default_quota; } else { err = zap_lookup(zfsvfs->z_os, quotaobj, buf, 8, 1, "a);