Bypass snprintf() in quota checks if no quotas set

This improves synthetic 1 byte write speed by ~2.5%.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Signed-off-by: Alexander Motin <alexander.motin@TrueNAS.com>
Closes #18063
This commit is contained in:
Alexander Motin 2025-12-17 21:59:47 -05:00 committed by GitHub
parent 0550abd4b8
commit 051a8c7494
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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, &quota);
@ -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, &quota);