dnode_sync.c (196703) | dnode_sync.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 --- 492 unchanged lines hidden (view full) --- 501 /* 502 * Now that we've released our hold, the dnode may 503 * be evicted, so we musn't access it. 504 */ 505} 506 507/* 508 * Write out the dnode's dirty buffers. | 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 --- 492 unchanged lines hidden (view full) --- 501 /* 502 * Now that we've released our hold, the dnode may 503 * be evicted, so we musn't access it. 504 */ 505} 506 507/* 508 * Write out the dnode's dirty buffers. |
509 * 510 * NOTE: The dnode is kept in memory by being dirty. Once the 511 * dirty bit is cleared, it may be evicted. Beware of this! | |
512 */ 513void 514dnode_sync(dnode_t *dn, dmu_tx_t *tx) 515{ 516 free_range_t *rp; 517 dnode_phys_t *dnp = dn->dn_phys; 518 int txgoff = tx->tx_txg & TXG_MASK; 519 list_t *list = &dn->dn_dirty_records[txgoff]; | 509 */ 510void 511dnode_sync(dnode_t *dn, dmu_tx_t *tx) 512{ 513 free_range_t *rp; 514 dnode_phys_t *dnp = dn->dn_phys; 515 int txgoff = tx->tx_txg & TXG_MASK; 516 list_t *list = &dn->dn_dirty_records[txgoff]; |
517 static const dnode_phys_t zerodn = { 0 }; |
|
520 521 ASSERT(dmu_tx_is_syncing(tx)); 522 ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg); | 518 519 ASSERT(dmu_tx_is_syncing(tx)); 520 ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg); |
521 ASSERT(dnp->dn_type != DMU_OT_NONE || 522 bcmp(dnp, &zerodn, DNODE_SIZE) == 0); |
|
523 DNODE_VERIFY(dn); 524 525 ASSERT(dn->dn_dbuf == NULL || arc_released(dn->dn_dbuf->db_buf)); 526 | 523 DNODE_VERIFY(dn); 524 525 ASSERT(dn->dn_dbuf == NULL || arc_released(dn->dn_dbuf->db_buf)); 526 |
527 if (dmu_objset_userused_enabled(dn->dn_objset) && 528 !DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { 529 ASSERT(dn->dn_oldphys == NULL); 530 dn->dn_oldphys = zio_buf_alloc(sizeof (dnode_phys_t)); 531 *dn->dn_oldphys = *dn->dn_phys; /* struct assignment */ 532 dn->dn_phys->dn_flags |= DNODE_FLAG_USERUSED_ACCOUNTED; 533 } else { 534 /* Once we account for it, we should always account for it. */ 535 ASSERT(!(dn->dn_phys->dn_flags & 536 DNODE_FLAG_USERUSED_ACCOUNTED)); 537 } 538 |
|
527 mutex_enter(&dn->dn_mtx); 528 if (dn->dn_allocated_txg == tx->tx_txg) { 529 /* The dnode is newly allocated or reallocated */ 530 if (dnp->dn_type == DMU_OT_NONE) { 531 /* this is a first alloc, not a realloc */ | 539 mutex_enter(&dn->dn_mtx); 540 if (dn->dn_allocated_txg == tx->tx_txg) { 541 /* The dnode is newly allocated or reallocated */ 542 if (dnp->dn_type == DMU_OT_NONE) { 543 /* this is a first alloc, not a realloc */ |
532 /* XXX shouldn't the phys already be zeroed? */ 533 bzero(dnp, DNODE_CORE_SIZE); | |
534 dnp->dn_nlevels = 1; 535 dnp->dn_nblkptr = dn->dn_nblkptr; 536 } 537 538 dnp->dn_type = dn->dn_type; 539 dnp->dn_bonustype = dn->dn_bonustype; 540 dnp->dn_bonuslen = dn->dn_bonuslen; 541 } --- 81 unchanged lines hidden (view full) --- 623 624 if (dn->dn_next_nlevels[txgoff]) { 625 dnode_increase_indirection(dn, tx); 626 dn->dn_next_nlevels[txgoff] = 0; 627 } 628 629 dbuf_sync_list(list, tx); 630 | 544 dnp->dn_nlevels = 1; 545 dnp->dn_nblkptr = dn->dn_nblkptr; 546 } 547 548 dnp->dn_type = dn->dn_type; 549 dnp->dn_bonustype = dn->dn_bonustype; 550 dnp->dn_bonuslen = dn->dn_bonuslen; 551 } --- 81 unchanged lines hidden (view full) --- 633 634 if (dn->dn_next_nlevels[txgoff]) { 635 dnode_increase_indirection(dn, tx); 636 dn->dn_next_nlevels[txgoff] = 0; 637 } 638 639 dbuf_sync_list(list, tx); 640 |
631 if (dn->dn_object != DMU_META_DNODE_OBJECT) { | 641 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) { |
632 ASSERT3P(list_head(list), ==, NULL); 633 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg); 634 } 635 636 /* 637 * Although we have dropped our reference to the dnode, it 638 * can't be evicted until its written, and we haven't yet 639 * initiated the IO for the dnode's dbuf. 640 */ 641} | 642 ASSERT3P(list_head(list), ==, NULL); 643 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg); 644 } 645 646 /* 647 * Although we have dropped our reference to the dnode, it 648 * can't be evicted until its written, and we haven't yet 649 * initiated the IO for the dnode's dbuf. 650 */ 651} |