bptree.c (236884) | bptree.c (243674) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 80 unchanged lines hidden (view full) --- 89bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx) 90{ 91 dmu_buf_t *db; 92 bptree_phys_t *bt; 93 94 VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); 95 bt = db->db_data; 96 ASSERT3U(bt->bt_begin, ==, bt->bt_end); | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 80 unchanged lines hidden (view full) --- 89bptree_free(objset_t *os, uint64_t obj, dmu_tx_t *tx) 90{ 91 dmu_buf_t *db; 92 bptree_phys_t *bt; 93 94 VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db)); 95 bt = db->db_data; 96 ASSERT3U(bt->bt_begin, ==, bt->bt_end); |
97 ASSERT3U(bt->bt_bytes, ==, 0); 98 ASSERT3U(bt->bt_comp, ==, 0); 99 ASSERT3U(bt->bt_uncomp, ==, 0); | 97 ASSERT0(bt->bt_bytes); 98 ASSERT0(bt->bt_comp); 99 ASSERT0(bt->bt_uncomp); |
100 dmu_buf_rele(db, FTAG); 101 102 return (dmu_object_free(os, obj, tx)); 103} 104 105void 106bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, 107 uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx) --- 76 unchanged lines hidden (view full) --- 184 ASSERT(!free || i == ba.ba_phys->bt_begin); 185 186 err = dmu_read(os, obj, i * sizeof (bte), sizeof (bte), 187 &bte, DMU_READ_NO_PREFETCH); 188 if (err != 0) 189 break; 190 191 err = traverse_dataset_destroyed(os->os_spa, &bte.be_bp, | 100 dmu_buf_rele(db, FTAG); 101 102 return (dmu_object_free(os, obj, tx)); 103} 104 105void 106bptree_add(objset_t *os, uint64_t obj, blkptr_t *bp, uint64_t birth_txg, 107 uint64_t bytes, uint64_t comp, uint64_t uncomp, dmu_tx_t *tx) --- 76 unchanged lines hidden (view full) --- 184 ASSERT(!free || i == ba.ba_phys->bt_begin); 185 186 err = dmu_read(os, obj, i * sizeof (bte), sizeof (bte), 187 &bte, DMU_READ_NO_PREFETCH); 188 if (err != 0) 189 break; 190 191 err = traverse_dataset_destroyed(os->os_spa, &bte.be_bp, |
192 bte.be_birth_txg, &bte.be_zb, TRAVERSE_POST, | 192 bte.be_birth_txg, &bte.be_zb, 193 TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST, |
193 bptree_visit_cb, &ba); 194 if (free) { 195 ASSERT(err == 0 || err == ERESTART); 196 if (err != 0) { 197 /* save bookmark for future resume */ 198 ASSERT3U(bte.be_zb.zb_objset, ==, 199 ZB_DESTROYED_OBJSET); | 194 bptree_visit_cb, &ba); 195 if (free) { 196 ASSERT(err == 0 || err == ERESTART); 197 if (err != 0) { 198 /* save bookmark for future resume */ 199 ASSERT3U(bte.be_zb.zb_objset, ==, 200 ZB_DESTROYED_OBJSET); |
200 ASSERT3U(bte.be_zb.zb_level, ==, 0); | 201 ASSERT0(bte.be_zb.zb_level); |
201 dmu_write(os, obj, i * sizeof (bte), 202 sizeof (bte), &bte, tx); 203 break; 204 } else { 205 ba.ba_phys->bt_begin++; 206 (void) dmu_free_range(os, obj, 207 i * sizeof (bte), sizeof (bte), tx); 208 } 209 } 210 } 211 212 ASSERT(!free || err != 0 || ba.ba_phys->bt_begin == ba.ba_phys->bt_end); 213 214 /* if all blocks are free there should be no used space */ 215 if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) { | 202 dmu_write(os, obj, i * sizeof (bte), 203 sizeof (bte), &bte, tx); 204 break; 205 } else { 206 ba.ba_phys->bt_begin++; 207 (void) dmu_free_range(os, obj, 208 i * sizeof (bte), sizeof (bte), tx); 209 } 210 } 211 } 212 213 ASSERT(!free || err != 0 || ba.ba_phys->bt_begin == ba.ba_phys->bt_end); 214 215 /* if all blocks are free there should be no used space */ 216 if (ba.ba_phys->bt_begin == ba.ba_phys->bt_end) { |
216 ASSERT3U(ba.ba_phys->bt_bytes, ==, 0); 217 ASSERT3U(ba.ba_phys->bt_comp, ==, 0); 218 ASSERT3U(ba.ba_phys->bt_uncomp, ==, 0); | 217 ASSERT0(ba.ba_phys->bt_bytes); 218 ASSERT0(ba.ba_phys->bt_comp); 219 ASSERT0(ba.ba_phys->bt_uncomp); |
219 } 220 221 dmu_buf_rele(db, FTAG); 222 223 return (err); 224} | 220 } 221 222 dmu_buf_rele(db, FTAG); 223 224 return (err); 225} |