Micro-optimize dsl_prop_get_dd()

Use the saved property index instead of looking it up once per DSL
directory when traversing up towards the root.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Allan Jude <allan@klarasystems.com>
Reviewed-by: Akash B <akash-b@hpe.com>
Signed-off-by: Mark Johnston <markj@FreeBSD.org>
Sponsored-by: The FreeBSD Foundation
Closes #14397
This commit is contained in:
Mark Johnston 2023-01-16 07:53:16 -05:00 committed by Brian Behlendorf
parent 7c30100c00
commit ebabb93e6c

View File

@ -123,7 +123,7 @@ dsl_prop_get_dd(dsl_dir_t *dd, const char *propname,
/* Check for a iuv value. */ /* Check for a iuv value. */
err = zap_lookup(mos, dsl_dir_phys(dd)->dd_props_zapobj, err = zap_lookup(mos, dsl_dir_phys(dd)->dd_props_zapobj,
iuvstr, intsz, numints, buf); iuvstr, intsz, numints, buf);
if (err == 0 && dsl_prop_known_index(zfs_name_to_prop(propname), if (err == 0 && dsl_prop_known_index(prop,
*(uint64_t *)buf) != 1) *(uint64_t *)buf) != 1)
err = ENOENT; err = ENOENT;
if (err != ENOENT) { if (err != ENOENT) {