26 #include <sys/arc.h>
27 #include <sys/bptree.h>
28 #include <sys/dmu.h>
29 #include <sys/dmu_objset.h>
30 #include <sys/dmu_tx.h>
31 #include <sys/dmu_traverse.h>
32 #include <sys/dsl_dataset.h>
33 #include <sys/dsl_dir.h>
34 #include <sys/dsl_pool.h>
35 #include <sys/dnode.h>
36 #include <sys/refcount.h>
37 #include <sys/spa.h>
38
39 /*
40 * A bptree is a queue of root block pointers from destroyed datasets. When a
41 * dataset is destroyed its root block pointer is put on the end of the pool's
42 * bptree queue so the dataset's blocks can be freed asynchronously by
43 * dsl_scan_sync. This allows the delete operation to finish without traversing
44 * all the dataset's blocks.
45 *
46 * Note that while bt_begin and bt_end are only ever incremented in this code
47 * they are effectively reset to 0 every time the entire bptree is freed because
48 * the bptree's object is destroyed and re-created.
49 */
50
51 struct bptree_args {
52 bptree_phys_t *ba_phys; /* data in bonus buffer, dirtied if freeing */
53 boolean_t ba_free; /* true if freeing during traversal */
54
55 bptree_itor_t *ba_func; /* function to call for each blockpointer */
56 void *ba_arg; /* caller supplied argument to ba_func */
57 dmu_tx_t *ba_tx; /* caller supplied tx, NULL if not freeing */
58 } bptree_args_t;
59
60 uint64_t
61 bptree_alloc(objset_t *os, dmu_tx_t *tx)
62 {
63 uint64_t obj;
64 dmu_buf_t *db;
65 bptree_phys_t *bt;
66
|
26 #include <sys/arc.h>
27 #include <sys/bptree.h>
28 #include <sys/dmu.h>
29 #include <sys/dmu_objset.h>
30 #include <sys/dmu_tx.h>
31 #include <sys/dmu_traverse.h>
32 #include <sys/dsl_dataset.h>
33 #include <sys/dsl_dir.h>
34 #include <sys/dsl_pool.h>
35 #include <sys/dnode.h>
36 #include <sys/refcount.h>
37 #include <sys/spa.h>
38
39 /*
40 * A bptree is a queue of root block pointers from destroyed datasets. When a
41 * dataset is destroyed its root block pointer is put on the end of the pool's
42 * bptree queue so the dataset's blocks can be freed asynchronously by
43 * dsl_scan_sync. This allows the delete operation to finish without traversing
44 * all the dataset's blocks.
45 *
46 * Note that while bt_begin and bt_end are only ever incremented in this code,
47 * they are effectively reset to 0 every time the entire bptree is freed because
48 * the bptree's object is destroyed and re-created.
49 */
50
51 struct bptree_args {
52 bptree_phys_t *ba_phys; /* data in bonus buffer, dirtied if freeing */
53 boolean_t ba_free; /* true if freeing during traversal */
54
55 bptree_itor_t *ba_func; /* function to call for each blockpointer */
56 void *ba_arg; /* caller supplied argument to ba_func */
57 dmu_tx_t *ba_tx; /* caller supplied tx, NULL if not freeing */
58 } bptree_args_t;
59
60 uint64_t
61 bptree_alloc(objset_t *os, dmu_tx_t *tx)
62 {
63 uint64_t obj;
64 dmu_buf_t *db;
65 bptree_phys_t *bt;
66
|