MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zap_update

Function zap_update

freebsd/contrib/openzfs/module/zfs/zap_micro.c:1319–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1317}
1318
1319int
1320zap_update(objset_t *os, uint64_t zapobj, const char *name,
1321 int integer_size, uint64_t num_integers, const void *val, dmu_tx_t *tx)
1322{
1323 zap_t *zap;
1324 const uint64_t *intval = val;
1325
1326 int err =
1327 zap_lockdir(os, zapobj, tx, RW_WRITER, TRUE, TRUE, FTAG, &zap);
1328 if (err != 0)
1329 return (err);
1330 zap_name_t *zn = zap_name_alloc(zap, name, 0);
1331 if (zn == NULL) {
1332 zap_unlockdir(zap, FTAG);
1333 return (SET_ERROR(ENOTSUP));
1334 }
1335 if (!zap->zap_ismicro) {
1336 err = fzap_update(zn, integer_size, num_integers, val,
1337 FTAG, tx);
1338 zap = zn->zn_zap; /* fzap_update() may change zap */
1339 } else if (integer_size != 8 || num_integers != 1 ||
1340 strlen(name) >= MZAP_NAME_LEN) {
1341 dprintf("upgrading obj %llu: intsz=%u numint=%llu name=%s\n",
1342 zapobj, integer_size, num_integers, name);
1343 err = mzap_upgrade(&zn->zn_zap, FTAG, tx, 0);
1344 if (err == 0) {
1345 err = fzap_update(zn, integer_size, num_integers,
1346 val, FTAG, tx);
1347 }
1348 zap = zn->zn_zap; /* fzap_update() may change zap */
1349 } else {
1350 mzap_ent_t *mze = mze_find(zn);
1351 if (mze != NULL) {
1352 MZE_PHYS(zap, mze)->mze_value = *intval;
1353 } else {
1354 mzap_addent(zn, *intval);
1355 }
1356 }
1357 ASSERT(zap == zn->zn_zap);
1358 zap_name_free(zn);
1359 if (zap != NULL) /* may be NULL if fzap_upgrade() failed */
1360 zap_unlockdir(zap, FTAG);
1361 return (err);
1362}
1363
1364int
1365zap_update_uint64(objset_t *os, uint64_t zapobj, const uint64_t *key,

Callers 15

zfs_create_fsFunction · 0.85
zfs_set_versionFunction · 0.85
zfs_create_fsFunction · 0.85
zfs_set_versionFunction · 0.85
vdev_rebuild_update_syncFunction · 0.85
vdev_rebuild_cancel_syncFunction · 0.85
vdev_rebuild_reset_syncFunction · 0.85
vdev_rebuild_clear_syncFunction · 0.85

Calls 8

zap_lockdirFunction · 0.85
zap_name_allocFunction · 0.85
zap_unlockdirFunction · 0.85
fzap_updateFunction · 0.85
mzap_upgradeFunction · 0.85
mze_findFunction · 0.85
mzap_addentFunction · 0.85
zap_name_freeFunction · 0.85

Tested by 2

ztest_zapFunction · 0.68
ztest_zap_parallelFunction · 0.68