Lines Matching refs:vib

28 vdev_indirect_births_verify(vdev_indirect_births_t *vib)  in vdev_indirect_births_verify()  argument
30 ASSERT(vib != NULL); in vdev_indirect_births_verify()
32 ASSERT(vib->vib_object != 0); in vdev_indirect_births_verify()
33 ASSERT(vib->vib_objset != NULL); in vdev_indirect_births_verify()
34 ASSERT(vib->vib_phys != NULL); in vdev_indirect_births_verify()
35 ASSERT(vib->vib_dbuf != NULL); in vdev_indirect_births_verify()
37 EQUIV(vib->vib_phys->vib_count > 0, vib->vib_entries != NULL); in vdev_indirect_births_verify()
42 #define vdev_indirect_births_verify(vib) ((void) sizeof (vib), B_TRUE) argument
46 vdev_indirect_births_count(vdev_indirect_births_t *vib) in vdev_indirect_births_count() argument
48 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_count()
50 return (vib->vib_phys->vib_count); in vdev_indirect_births_count()
54 vdev_indirect_births_object(vdev_indirect_births_t *vib) in vdev_indirect_births_object() argument
56 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_object()
58 return (vib->vib_object); in vdev_indirect_births_object()
62 vdev_indirect_births_size_impl(vdev_indirect_births_t *vib) in vdev_indirect_births_size_impl() argument
64 return (vib->vib_phys->vib_count * sizeof (*vib->vib_entries)); in vdev_indirect_births_size_impl()
68 vdev_indirect_births_close(vdev_indirect_births_t *vib) in vdev_indirect_births_close() argument
70 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_close()
72 if (vib->vib_phys->vib_count > 0) { in vdev_indirect_births_close()
73 uint64_t births_size = vdev_indirect_births_size_impl(vib); in vdev_indirect_births_close()
75 vmem_free(vib->vib_entries, births_size); in vdev_indirect_births_close()
76 vib->vib_entries = NULL; in vdev_indirect_births_close()
79 dmu_buf_rele(vib->vib_dbuf, vib); in vdev_indirect_births_close()
81 vib->vib_objset = NULL; in vdev_indirect_births_close()
82 vib->vib_object = 0; in vdev_indirect_births_close()
83 vib->vib_dbuf = NULL; in vdev_indirect_births_close()
84 vib->vib_phys = NULL; in vdev_indirect_births_close()
86 kmem_free(vib, sizeof (*vib)); in vdev_indirect_births_close()
103 vdev_indirect_births_t *vib = kmem_zalloc(sizeof (*vib), KM_SLEEP); in vdev_indirect_births_open() local
105 vib->vib_objset = os; in vdev_indirect_births_open()
106 vib->vib_object = births_object; in vdev_indirect_births_open()
108 VERIFY0(dmu_bonus_hold(os, vib->vib_object, vib, &vib->vib_dbuf)); in vdev_indirect_births_open()
109 vib->vib_phys = vib->vib_dbuf->db_data; in vdev_indirect_births_open()
111 if (vib->vib_phys->vib_count > 0) { in vdev_indirect_births_open()
112 uint64_t births_size = vdev_indirect_births_size_impl(vib); in vdev_indirect_births_open()
113 vib->vib_entries = vmem_alloc(births_size, KM_SLEEP); in vdev_indirect_births_open()
114 VERIFY0(dmu_read(vib->vib_objset, vib->vib_object, 0, in vdev_indirect_births_open()
115 births_size, vib->vib_entries, DMU_READ_PREFETCH)); in vdev_indirect_births_open()
118 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_open()
120 return (vib); in vdev_indirect_births_open()
130 vdev_indirect_births_add_entry(vdev_indirect_births_t *vib, in vdev_indirect_births_add_entry() argument
140 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_add_entry()
142 dmu_buf_will_dirty(vib->vib_dbuf, tx); in vdev_indirect_births_add_entry()
147 old_size = vdev_indirect_births_size_impl(vib); in vdev_indirect_births_add_entry()
148 dmu_write(vib->vib_objset, vib->vib_object, old_size, sizeof (vibe), in vdev_indirect_births_add_entry()
150 vib->vib_phys->vib_count++; in vdev_indirect_births_add_entry()
151 new_size = vdev_indirect_births_size_impl(vib); in vdev_indirect_births_add_entry()
155 memcpy(new_entries, vib->vib_entries, old_size); in vdev_indirect_births_add_entry()
156 vmem_free(vib->vib_entries, old_size); in vdev_indirect_births_add_entry()
158 new_entries[vib->vib_phys->vib_count - 1] = vibe; in vdev_indirect_births_add_entry()
159 vib->vib_entries = new_entries; in vdev_indirect_births_add_entry()
163 vdev_indirect_births_last_entry_txg(vdev_indirect_births_t *vib) in vdev_indirect_births_last_entry_txg() argument
165 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_last_entry_txg()
166 ASSERT(vib->vib_phys->vib_count > 0); in vdev_indirect_births_last_entry_txg()
169 &vib->vib_entries[vib->vib_phys->vib_count - 1]; in vdev_indirect_births_last_entry_txg()
187 vdev_indirect_births_physbirth(vdev_indirect_births_t *vib, uint64_t offset, in vdev_indirect_births_physbirth() argument
193 ASSERT(vdev_indirect_births_verify(vib)); in vdev_indirect_births_physbirth()
194 ASSERT(vib->vib_phys->vib_count > 0); in vdev_indirect_births_physbirth()
196 base = vib->vib_entries; in vdev_indirect_births_physbirth()
197 last = base + vib->vib_phys->vib_count - 1; in vdev_indirect_births_physbirth()
206 } else if (p == vib->vib_entries || in vdev_indirect_births_physbirth()