bptree.c (240133) | bptree.c (240415) |
---|---|
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) --- 85 unchanged lines hidden (view full) --- 193 TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST, 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); | 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) --- 85 unchanged lines hidden (view full) --- 193 TRAVERSE_PREFETCH_METADATA | TRAVERSE_POST, 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); |
201 ASSERT3U(bte.be_zb.zb_level, ==, 0); | 201 ASSERT0(bte.be_zb.zb_level); |
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) { | 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) { |
217 ASSERT3U(ba.ba_phys->bt_bytes, ==, 0); 218 ASSERT3U(ba.ba_phys->bt_comp, ==, 0); 219 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); |
220 } 221 222 dmu_buf_rele(db, FTAG); 223 224 return (err); 225} | 220 } 221 222 dmu_buf_rele(db, FTAG); 223 224 return (err); 225} |