* Process a list of errors into the current on-disk log. */
| 298 | * Process a list of errors into the current on-disk log. |
| 299 | */ |
| 300 | static void |
| 301 | sync_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 |
no test coverage detected