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

Function sync_error_list

freebsd/contrib/openzfs/module/zfs/spa_errlog.c:300–329  ·  view source on GitHub ↗

* Process a list of errors into the current on-disk log. */

Source from the content-addressed store, hash-verified

298 * Process a list of errors into the current on-disk log.
299 */
300static void
301sync_error_list(spa_t *spa, avl_tree_t *t, uint64_t *obj, dmu_tx_t *tx)
302{
303 spa_error_entry_t *se;
304 char buf[64];
305 void *cookie;
306
307 if (avl_numnodes(t) != 0) {
308 /* create log if necessary */
309 if (*obj == 0)
310 *obj = zap_create(spa->spa_meta_objset,
311 DMU_OT_ERROR_LOG, DMU_OT_NONE,
312 0, tx);
313
314 /* add errors to the current log */
315 for (se = avl_first(t); se != NULL; se = AVL_NEXT(t, se)) {
316 char *name = se->se_name ? se->se_name : "";
317
318 bookmark_to_name(&se->se_bookmark, buf, sizeof (buf));
319
320 (void) zap_update(spa->spa_meta_objset,
321 *obj, buf, 1, strlen(name) + 1, name, tx);
322 }
323
324 /* purge the error list */
325 cookie = NULL;
326 while ((se = avl_destroy_nodes(t, &cookie)) != NULL)
327 kmem_free(se, sizeof (spa_error_entry_t));
328 }
329}
330
331/*
332 * Sync the error log out to disk. This is a little tricky because the act of

Callers 1

spa_errlog_syncFunction · 0.85

Calls 7

avl_numnodesFunction · 0.85
zap_createFunction · 0.85
avl_firstFunction · 0.85
bookmark_to_nameFunction · 0.85
zap_updateFunction · 0.85
avl_destroy_nodesFunction · 0.85
kmem_freeFunction · 0.50

Tested by

no test coverage detected