dnode.c (209094) | dnode.c (209962) |
---|---|
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 --- 142 unchanged lines hidden (view full) --- 151 ASSERT3U((dn->dn_nblkptr - 1) * sizeof (blkptr_t) + 152 dn->dn_bonuslen, <=, DN_MAX_BONUSLEN); 153 for (i = 0; i < TXG_SIZE; i++) { 154 ASSERT3U(dn->dn_next_nlevels[i], <=, dn->dn_nlevels); 155 } 156 } 157 if (dn->dn_phys->dn_type != DMU_OT_NONE) 158 ASSERT3U(dn->dn_phys->dn_nlevels, <=, dn->dn_nlevels); | 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 --- 142 unchanged lines hidden (view full) --- 151 ASSERT3U((dn->dn_nblkptr - 1) * sizeof (blkptr_t) + 152 dn->dn_bonuslen, <=, DN_MAX_BONUSLEN); 153 for (i = 0; i < TXG_SIZE; i++) { 154 ASSERT3U(dn->dn_next_nlevels[i], <=, dn->dn_nlevels); 155 } 156 } 157 if (dn->dn_phys->dn_type != DMU_OT_NONE) 158 ASSERT3U(dn->dn_phys->dn_nlevels, <=, dn->dn_nlevels); |
159 ASSERT(dn->dn_object == DMU_META_DNODE_OBJECT || dn->dn_dbuf != NULL); | 159 ASSERT(DMU_OBJECT_IS_SPECIAL(dn->dn_object) || dn->dn_dbuf != NULL); |
160 if (dn->dn_dbuf != NULL) { 161 ASSERT3P(dn->dn_phys, ==, 162 (dnode_phys_t *)dn->dn_dbuf->db.db_data + 163 (dn->dn_object % (dn->dn_dbuf->db.db_size >> DNODE_SHIFT))); 164 } 165 if (drop_struct_lock) 166 rw_exit(&dn->dn_struct_rwlock); 167} --- 147 unchanged lines hidden (view full) --- 315 316 for (i = 0; i < TXG_SIZE; i++) { 317 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); 318 ASSERT(NULL == list_head(&dn->dn_dirty_records[i])); 319 ASSERT(0 == avl_numnodes(&dn->dn_ranges[i])); 320 } 321 ASSERT(NULL == list_head(&dn->dn_dbufs)); 322#endif | 160 if (dn->dn_dbuf != NULL) { 161 ASSERT3P(dn->dn_phys, ==, 162 (dnode_phys_t *)dn->dn_dbuf->db.db_data + 163 (dn->dn_object % (dn->dn_dbuf->db.db_size >> DNODE_SHIFT))); 164 } 165 if (drop_struct_lock) 166 rw_exit(&dn->dn_struct_rwlock); 167} --- 147 unchanged lines hidden (view full) --- 315 316 for (i = 0; i < TXG_SIZE; i++) { 317 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); 318 ASSERT(NULL == list_head(&dn->dn_dirty_records[i])); 319 ASSERT(0 == avl_numnodes(&dn->dn_ranges[i])); 320 } 321 ASSERT(NULL == list_head(&dn->dn_dbufs)); 322#endif |
323 ASSERT(dn->dn_oldphys == NULL); |
|
323 324 mutex_enter(&os->os_lock); 325 list_remove(&os->os_dnodes, dn); 326 mutex_exit(&os->os_lock); 327 328 if (dn->dn_dirtyctx_firstset) { 329 kmem_free(dn->dn_dirtyctx_firstset, 1); 330 dn->dn_dirtyctx_firstset = NULL; --- 214 unchanged lines hidden (view full) --- 545 dnode_t **children_dnodes; 546 547 /* 548 * If you are holding the spa config lock as writer, you shouldn't 549 * be asking the DMU to do *anything*. 550 */ 551 ASSERT(spa_config_held(os->os_spa, SCL_ALL, RW_WRITER) == 0); 552 | 324 325 mutex_enter(&os->os_lock); 326 list_remove(&os->os_dnodes, dn); 327 mutex_exit(&os->os_lock); 328 329 if (dn->dn_dirtyctx_firstset) { 330 kmem_free(dn->dn_dirtyctx_firstset, 1); 331 dn->dn_dirtyctx_firstset = NULL; --- 214 unchanged lines hidden (view full) --- 546 dnode_t **children_dnodes; 547 548 /* 549 * If you are holding the spa config lock as writer, you shouldn't 550 * be asking the DMU to do *anything*. 551 */ 552 ASSERT(spa_config_held(os->os_spa, SCL_ALL, RW_WRITER) == 0); 553 |
554 if (object == DMU_USERUSED_OBJECT || object == DMU_GROUPUSED_OBJECT) { 555 dn = (object == DMU_USERUSED_OBJECT) ? 556 os->os_userused_dnode : os->os_groupused_dnode; 557 if (dn == NULL) 558 return (ENOENT); 559 type = dn->dn_type; 560 if ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) 561 return (ENOENT); 562 if ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE) 563 return (EEXIST); 564 DNODE_VERIFY(dn); 565 (void) refcount_add(&dn->dn_holds, tag); 566 *dnp = dn; 567 return (0); 568 } 569 |
|
553 if (object == 0 || object >= DN_MAX_OBJECT) 554 return (EINVAL); 555 556 mdn = os->os_meta_dnode; 557 558 DNODE_VERIFY(mdn); 559 560 if (!RW_WRITE_HELD(&mdn->dn_struct_rwlock)) { --- 42 unchanged lines hidden (view full) --- 603 dn = winner; 604 } 605 } 606 607 mutex_enter(&dn->dn_mtx); 608 type = dn->dn_type; 609 if (dn->dn_free_txg || 610 ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) || | 570 if (object == 0 || object >= DN_MAX_OBJECT) 571 return (EINVAL); 572 573 mdn = os->os_meta_dnode; 574 575 DNODE_VERIFY(mdn); 576 577 if (!RW_WRITE_HELD(&mdn->dn_struct_rwlock)) { --- 42 unchanged lines hidden (view full) --- 620 dn = winner; 621 } 622 } 623 624 mutex_enter(&dn->dn_mtx); 625 type = dn->dn_type; 626 if (dn->dn_free_txg || 627 ((flag & DNODE_MUST_BE_ALLOCATED) && type == DMU_OT_NONE) || |
611 ((flag & DNODE_MUST_BE_FREE) && type != DMU_OT_NONE)) { | 628 ((flag & DNODE_MUST_BE_FREE) && 629 (type != DMU_OT_NONE || dn->dn_oldphys))) { |
612 mutex_exit(&dn->dn_mtx); 613 dbuf_rele(db, FTAG); 614 return (type == DMU_OT_NONE ? ENOENT : EEXIST); 615 } 616 mutex_exit(&dn->dn_mtx); 617 618 if (refcount_add(&dn->dn_holds, tag) == 1) 619 dbuf_add_ref(db, dn); --- 48 unchanged lines hidden (view full) --- 668} 669 670void 671dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) 672{ 673 objset_impl_t *os = dn->dn_objset; 674 uint64_t txg = tx->tx_txg; 675 | 630 mutex_exit(&dn->dn_mtx); 631 dbuf_rele(db, FTAG); 632 return (type == DMU_OT_NONE ? ENOENT : EEXIST); 633 } 634 mutex_exit(&dn->dn_mtx); 635 636 if (refcount_add(&dn->dn_holds, tag) == 1) 637 dbuf_add_ref(db, dn); --- 48 unchanged lines hidden (view full) --- 686} 687 688void 689dnode_setdirty(dnode_t *dn, dmu_tx_t *tx) 690{ 691 objset_impl_t *os = dn->dn_objset; 692 uint64_t txg = tx->tx_txg; 693 |
676 if (dn->dn_object == DMU_META_DNODE_OBJECT) | 694 if (DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { 695 dsl_dataset_dirty(os->os_dsl_dataset, tx); |
677 return; | 696 return; |
697 } |
|
678 679 DNODE_VERIFY(dn); 680 681#ifdef ZFS_DEBUG 682 mutex_enter(&dn->dn_mtx); 683 ASSERT(dn->dn_phys->dn_type || dn->dn_allocated_txg); 684 /* ASSERT(dn->dn_free_txg == 0 || dn->dn_free_txg >= txg); */ 685 mutex_exit(&dn->dn_mtx); --- 579 unchanged lines hidden (view full) --- 1265 uint64_t epb = 1ULL << epbs; 1266 uint64_t minfill, maxfill; 1267 boolean_t hole; 1268 int i, inc, error, span; 1269 1270 dprintf("probing object %llu offset %llx level %d of %u\n", 1271 dn->dn_object, *offset, lvl, dn->dn_phys->dn_nlevels); 1272 | 698 699 DNODE_VERIFY(dn); 700 701#ifdef ZFS_DEBUG 702 mutex_enter(&dn->dn_mtx); 703 ASSERT(dn->dn_phys->dn_type || dn->dn_allocated_txg); 704 /* ASSERT(dn->dn_free_txg == 0 || dn->dn_free_txg >= txg); */ 705 mutex_exit(&dn->dn_mtx); --- 579 unchanged lines hidden (view full) --- 1285 uint64_t epb = 1ULL << epbs; 1286 uint64_t minfill, maxfill; 1287 boolean_t hole; 1288 int i, inc, error, span; 1289 1290 dprintf("probing object %llu offset %llx level %d of %u\n", 1291 dn->dn_object, *offset, lvl, dn->dn_phys->dn_nlevels); 1292 |
1273 hole = flags & DNODE_FIND_HOLE; | 1293 hole = ((flags & DNODE_FIND_HOLE) != 0); |
1274 inc = (flags & DNODE_FIND_BACKWARDS) ? -1 : 1; 1275 ASSERT(txg == 0 || !hole); 1276 1277 if (lvl == dn->dn_phys->dn_nlevels) { 1278 error = 0; 1279 epb = dn->dn_phys->dn_nblkptr; 1280 data = dn->dn_phys->dn_blkptr; 1281 } else { --- 156 unchanged lines hidden --- | 1294 inc = (flags & DNODE_FIND_BACKWARDS) ? -1 : 1; 1295 ASSERT(txg == 0 || !hole); 1296 1297 if (lvl == dn->dn_phys->dn_nlevels) { 1298 error = 0; 1299 epb = dn->dn_phys->dn_nblkptr; 1300 data = dn->dn_phys->dn_blkptr; 1301 } else { --- 156 unchanged lines hidden --- |