* Load the spacemap into the rangetree, like space_map_load. But only * read the first 'length' bytes of the spacemap. */
| 417 | * read the first 'length' bytes of the spacemap. |
| 418 | */ |
| 419 | int |
| 420 | space_map_load_length(space_map_t *sm, range_tree_t *rt, maptype_t maptype, |
| 421 | uint64_t length) |
| 422 | { |
| 423 | space_map_load_arg_t smla; |
| 424 | |
| 425 | VERIFY0(range_tree_space(rt)); |
| 426 | |
| 427 | if (maptype == SM_FREE) |
| 428 | range_tree_add(rt, sm->sm_start, sm->sm_size); |
| 429 | |
| 430 | smla.smla_rt = rt; |
| 431 | smla.smla_sm = sm; |
| 432 | smla.smla_type = maptype; |
| 433 | int err = space_map_iterate(sm, length, |
| 434 | space_map_load_callback, &smla); |
| 435 | |
| 436 | if (err != 0) |
| 437 | range_tree_vacate(rt, NULL, NULL); |
| 438 | |
| 439 | return (err); |
| 440 | } |
| 441 | |
| 442 | /* |
| 443 | * Load the space map disk into the specified range tree. Segments of maptype |
no test coverage detected