From 47b53fda7d23b4867ea3c6db2014d60960184277 Mon Sep 17 00:00:00 2001 From: Rob Norris Date: Fri, 5 Jun 2026 15:29:16 +1000 Subject: [PATCH] zap: remove zap_join() functions These work, but are limited in their focus (single uint64_t key). The last use anywhere was removed in d4a72f2386 (~2017). Better to remove them rather than bother to uplift them to the new _by_dnode() structure. They're simple to recreate if we ever do need them again. Sponsored-by: TrueNAS Reviewed-by: Alexander Motin Reviewed-by: Brian Behlendorf Signed-off-by: Rob Norris Closes #18630 --- include/sys/zap.h | 15 --------- module/zfs/zap.c | 84 ----------------------------------------------- 2 files changed, 99 deletions(-) diff --git a/include/sys/zap.h b/include/sys/zap.h index cde4c72764a..2fd7332e124 100644 --- a/include/sys/zap.h +++ b/include/sys/zap.h @@ -380,21 +380,6 @@ int zap_increment(objset_t *os, uint64_t obj, const char *name, int64_t delta, int zap_value_search(objset_t *os, uint64_t zapobj, uint64_t value, uint64_t mask, char *name, uint64_t namelen); -/* - * Transfer all the entries from fromobj into intoobj. Only works on - * int_size=8 num_integers=1 values. Fails if there are any duplicated - * entries. - */ -int zap_join(objset_t *os, uint64_t fromobj, uint64_t intoobj, dmu_tx_t *tx); - -/* Same as zap_join, but set the values to 'value'. */ -int zap_join_key(objset_t *os, uint64_t fromobj, uint64_t intoobj, - uint64_t value, dmu_tx_t *tx); - -/* Same as zap_join, but add together any duplicated entries. */ -int zap_join_increment(objset_t *os, uint64_t fromobj, uint64_t intoobj, - dmu_tx_t *tx); - /* * Manipulate entries where the name + value are the "same" (the name is * a stringified version of the value). diff --git a/module/zfs/zap.c b/module/zfs/zap.c index e14ff1027f6..76582a25802 100644 --- a/module/zfs/zap.c +++ b/module/zfs/zap.c @@ -918,88 +918,6 @@ zap_value_search(objset_t *os, uint64_t zapobj, uint64_t value, uint64_t mask, return (err); } -/* zap_join */ - -int -zap_join(objset_t *os, uint64_t fromobj, uint64_t intoobj, dmu_tx_t *tx) -{ - zap_cursor_t zc; - int err = 0; - - zap_attribute_t *za = zap_attribute_long_alloc(); - for (zap_cursor_init(&zc, os, fromobj); - zap_cursor_retrieve(&zc, za) == 0; - (void) zap_cursor_advance(&zc)) { - if (za->za_integer_length != 8 || za->za_num_integers != 1) { - err = SET_ERROR(EINVAL); - break; - } - err = zap_add(os, intoobj, za->za_name, - 8, 1, &za->za_first_integer, tx); - if (err != 0) - break; - } - zap_cursor_fini(&zc); - zap_attribute_free(za); - return (err); -} - -int -zap_join_key(objset_t *os, uint64_t fromobj, uint64_t intoobj, - uint64_t value, dmu_tx_t *tx) -{ - zap_cursor_t zc; - int err = 0; - - zap_attribute_t *za = zap_attribute_long_alloc(); - for (zap_cursor_init(&zc, os, fromobj); - zap_cursor_retrieve(&zc, za) == 0; - (void) zap_cursor_advance(&zc)) { - if (za->za_integer_length != 8 || za->za_num_integers != 1) { - err = SET_ERROR(EINVAL); - break; - } - err = zap_add(os, intoobj, za->za_name, - 8, 1, &value, tx); - if (err != 0) - break; - } - zap_cursor_fini(&zc); - zap_attribute_free(za); - return (err); -} - -int -zap_join_increment(objset_t *os, uint64_t fromobj, uint64_t intoobj, - dmu_tx_t *tx) -{ - zap_cursor_t zc; - int err = 0; - - zap_attribute_t *za = zap_attribute_long_alloc(); - for (zap_cursor_init(&zc, os, fromobj); - zap_cursor_retrieve(&zc, za) == 0; - (void) zap_cursor_advance(&zc)) { - uint64_t delta = 0; - - if (za->za_integer_length != 8 || za->za_num_integers != 1) { - err = SET_ERROR(EINVAL); - break; - } - - err = zap_lookup(os, intoobj, za->za_name, 8, 1, &delta); - if (err != 0 && err != ENOENT) - break; - delta += za->za_first_integer; - err = zap_update(os, intoobj, za->za_name, 8, 1, &delta, tx); - if (err != 0) - break; - } - zap_cursor_fini(&zc); - zap_attribute_free(za); - return (err); -} - /* zap_*_int */ int @@ -1314,8 +1232,6 @@ EXPORT_SYMBOL(zap_remove_uint64_by_dnode); EXPORT_SYMBOL(zap_count); EXPORT_SYMBOL(zap_count_by_dnode); EXPORT_SYMBOL(zap_value_search); -EXPORT_SYMBOL(zap_join); -EXPORT_SYMBOL(zap_join_increment); EXPORT_SYMBOL(zap_add_int); EXPORT_SYMBOL(zap_remove_int); EXPORT_SYMBOL(zap_lookup_int);