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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
23 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright (c) 2012 by Delphix. All rights reserved.
27 #include <sys/zfs_context.h>
29 #include <sys/dnode.h>
31 #include <sys/dmu_tx.h>
32 #include <sys/dmu_objset.h>
33 #include <sys/dsl_dataset.h>
37 dnode_increase_indirection(dnode_t *dn, dmu_tx_t *tx)
40 int txgoff = tx->tx_txg & TXG_MASK;
41 int nblkptr = dn->dn_phys->dn_nblkptr;
42 int old_toplvl = dn->dn_phys->dn_nlevels - 1;
43 int new_level = dn->dn_next_nlevels[txgoff];
46 rw_enter(&dn->dn_struct_rwlock, RW_WRITER);
48 /* this dnode can't be paged out because it's dirty */
49 ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE);
50 ASSERT(RW_WRITE_HELD(&dn->dn_struct_rwlock));
51 ASSERT(new_level > 1 && dn->dn_phys->dn_nlevels > 0);
53 db = dbuf_hold_level(dn, dn->dn_phys->dn_nlevels, 0, FTAG);
56 dn->dn_phys->dn_nlevels = new_level;
57 dprintf("os=%p obj=%llu, increase to %d\n", dn->dn_objset,
58 dn->dn_object, dn->dn_phys->dn_nlevels);
60 /* check for existing blkptrs in the dnode */
61 for (i = 0; i < nblkptr; i++)
62 if (!BP_IS_HOLE(&dn->dn_phys->dn_blkptr[i]))
65 /* transfer dnode's block pointers to new indirect block */
66 (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED|DB_RF_HAVESTRUCT);
67 ASSERT(db->db.db_data);
68 ASSERT(arc_released(db->db_buf));
69 ASSERT3U(sizeof (blkptr_t) * nblkptr, <=, db->db.db_size);
70 bcopy(dn->dn_phys->dn_blkptr, db->db.db_data,
71 sizeof (blkptr_t) * nblkptr);
72 arc_buf_freeze(db->db_buf);
75 /* set dbuf's parent pointers to new indirect buf */
76 for (i = 0; i < nblkptr; i++) {
77 dmu_buf_impl_t *child = dbuf_find(dn, old_toplvl, i);
82 DB_DNODE_ENTER(child);
83 ASSERT3P(DB_DNODE(child), ==, dn);
86 if (child->db_parent && child->db_parent != dn->dn_dbuf) {
87 ASSERT(child->db_parent->db_level == db->db_level);
88 ASSERT(child->db_blkptr !=
89 &dn->dn_phys->dn_blkptr[child->db_blkid]);
90 mutex_exit(&child->db_mtx);
93 ASSERT(child->db_parent == NULL ||
94 child->db_parent == dn->dn_dbuf);
96 child->db_parent = db;
97 dbuf_add_ref(db, child);
99 child->db_blkptr = (blkptr_t *)db->db.db_data + i;
101 child->db_blkptr = NULL;
102 dprintf_dbuf_bp(child, child->db_blkptr,
103 "changed db_blkptr to new indirect %s", "");
105 mutex_exit(&child->db_mtx);
108 bzero(dn->dn_phys->dn_blkptr, sizeof (blkptr_t) * nblkptr);
112 rw_exit(&dn->dn_struct_rwlock);
116 free_blocks(dnode_t *dn, blkptr_t *bp, int num, dmu_tx_t *tx)
118 dsl_dataset_t *ds = dn->dn_objset->os_dsl_dataset;
119 uint64_t bytesfreed = 0;
120 int i, blocks_freed = 0;
122 dprintf("ds=%p obj=%llx num=%d\n", ds, dn->dn_object, num);
124 for (i = 0; i < num; i++, bp++) {
128 bytesfreed += dsl_dataset_block_kill(ds, bp, tx, B_FALSE);
129 ASSERT3U(bytesfreed, <=, DN_USED_BYTES(dn->dn_phys));
130 bzero(bp, sizeof (blkptr_t));
133 dnode_diduse_space(dn, -bytesfreed);
134 return (blocks_freed);
139 free_verify(dmu_buf_impl_t *db, uint64_t start, uint64_t end, dmu_tx_t *tx)
143 uint64_t txg = tx->tx_txg;
148 epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
149 off = start - (db->db_blkid * 1<<epbs);
150 num = end - start + 1;
152 ASSERT3U(off, >=, 0);
153 ASSERT3U(num, >=, 0);
154 ASSERT3U(db->db_level, >, 0);
155 ASSERT3U(db->db.db_size, ==, 1 << dn->dn_phys->dn_indblkshift);
156 ASSERT3U(off+num, <=, db->db.db_size >> SPA_BLKPTRSHIFT);
157 ASSERT(db->db_blkptr != NULL);
159 for (i = off; i < off+num; i++) {
161 dmu_buf_impl_t *child;
162 dbuf_dirty_record_t *dr;
165 ASSERT(db->db_level == 1);
167 rw_enter(&dn->dn_struct_rwlock, RW_READER);
168 err = dbuf_hold_impl(dn, db->db_level-1,
169 (db->db_blkid << epbs) + i, TRUE, FTAG, &child);
170 rw_exit(&dn->dn_struct_rwlock);
174 ASSERT(child->db_level == 0);
175 dr = child->db_last_dirty;
176 while (dr && dr->dr_txg > txg)
178 ASSERT(dr == NULL || dr->dr_txg == txg);
180 /* data_old better be zeroed */
182 buf = dr->dt.dl.dr_data->b_data;
183 for (j = 0; j < child->db.db_size >> 3; j++) {
185 panic("freed data not zero: "
186 "child=%p i=%d off=%d num=%d\n",
187 (void *)child, i, off, num);
193 * db_data better be zeroed unless it's dirty in a
196 mutex_enter(&child->db_mtx);
197 buf = child->db.db_data;
198 if (buf != NULL && child->db_state != DB_FILL &&
199 child->db_last_dirty == NULL) {
200 for (j = 0; j < child->db.db_size >> 3; j++) {
202 panic("freed data not zero: "
203 "child=%p i=%d off=%d num=%d\n",
204 (void *)child, i, off, num);
208 mutex_exit(&child->db_mtx);
210 dbuf_rele(child, FTAG);
219 free_children(dmu_buf_impl_t *db, uint64_t blkid, uint64_t nblks, int trunc,
224 dmu_buf_impl_t *subdb;
225 uint64_t start, end, dbstart, dbend, i;
226 int epbs, shift, err;
228 int blocks_freed = 0;
231 * There is a small possibility that this block will not be cached:
232 * 1 - if level > 1 and there are no children with level <= 1
233 * 2 - if we didn't get a dirty hold (because this block had just
234 * finished being written -- and so had no holds), and then this
235 * block got evicted before we got here.
237 if (db->db_state != DB_CACHED)
238 (void) dbuf_read(db, NULL, DB_RF_MUST_SUCCEED);
241 bp = (blkptr_t *)db->db.db_data;
245 epbs = dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT;
246 shift = (db->db_level - 1) * epbs;
247 dbstart = db->db_blkid << epbs;
248 start = blkid >> shift;
249 if (dbstart < start) {
250 bp += start - dbstart;
255 dbend = ((db->db_blkid + 1) << epbs) - 1;
256 end = (blkid + nblks - 1) >> shift;
261 ASSERT3U(start, <=, end);
263 if (db->db_level == 1) {
264 FREE_VERIFY(db, start, end, tx);
265 blocks_freed = free_blocks(dn, bp, end-start+1, tx);
266 arc_buf_freeze(db->db_buf);
267 ASSERT(all || blocks_freed == 0 || db->db_last_dirty);
269 return (all ? ALL : blocks_freed);
272 for (i = start; i <= end; i++, bp++) {
275 rw_enter(&dn->dn_struct_rwlock, RW_READER);
276 err = dbuf_hold_impl(dn, db->db_level-1, i, TRUE, FTAG, &subdb);
277 ASSERT3U(err, ==, 0);
278 rw_exit(&dn->dn_struct_rwlock);
280 if (free_children(subdb, blkid, nblks, trunc, tx) == ALL) {
281 ASSERT3P(subdb->db_blkptr, ==, bp);
282 blocks_freed += free_blocks(dn, bp, 1, tx);
286 dbuf_rele(subdb, FTAG);
289 arc_buf_freeze(db->db_buf);
292 for (i = start; i <= end; i++, bp++) {
293 if (i == start && blkid != 0)
295 else if (i == end && !trunc)
297 ASSERT3U(bp->blk_birth, ==, 0);
300 ASSERT(all || blocks_freed == 0 || db->db_last_dirty);
301 return (all ? ALL : blocks_freed);
305 * free_range: Traverse the indicated range of the provided file
306 * and "free" all the blocks contained there.
309 dnode_sync_free_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx)
311 blkptr_t *bp = dn->dn_phys->dn_blkptr;
313 int trunc, start, end, shift, i, err;
314 int dnlevel = dn->dn_phys->dn_nlevels;
316 if (blkid > dn->dn_phys->dn_maxblkid)
319 ASSERT(dn->dn_phys->dn_maxblkid < UINT64_MAX);
320 trunc = blkid + nblks > dn->dn_phys->dn_maxblkid;
322 nblks = dn->dn_phys->dn_maxblkid - blkid + 1;
324 /* There are no indirect blocks in the object */
326 if (blkid >= dn->dn_phys->dn_nblkptr) {
327 /* this range was never made persistent */
330 ASSERT3U(blkid + nblks, <=, dn->dn_phys->dn_nblkptr);
331 (void) free_blocks(dn, bp + blkid, nblks, tx);
333 ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
334 (dn->dn_phys->dn_datablkszsec<<SPA_MINBLOCKSHIFT));
335 dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
336 ASSERT(off < dn->dn_phys->dn_maxblkid ||
337 dn->dn_phys->dn_maxblkid == 0 ||
338 dnode_next_offset(dn, 0, &off, 1, 1, 0) != 0);
343 shift = (dnlevel - 1) * (dn->dn_phys->dn_indblkshift - SPA_BLKPTRSHIFT);
344 start = blkid >> shift;
345 ASSERT(start < dn->dn_phys->dn_nblkptr);
346 end = (blkid + nblks - 1) >> shift;
348 for (i = start; i <= end; i++, bp++) {
351 rw_enter(&dn->dn_struct_rwlock, RW_READER);
352 err = dbuf_hold_impl(dn, dnlevel-1, i, TRUE, FTAG, &db);
353 ASSERT3U(err, ==, 0);
354 rw_exit(&dn->dn_struct_rwlock);
356 if (free_children(db, blkid, nblks, trunc, tx) == ALL) {
357 ASSERT3P(db->db_blkptr, ==, bp);
358 (void) free_blocks(dn, bp, 1, tx);
363 ASSERTV(uint64_t off = (dn->dn_phys->dn_maxblkid + 1) *
364 (dn->dn_phys->dn_datablkszsec << SPA_MINBLOCKSHIFT));
365 dn->dn_phys->dn_maxblkid = (blkid ? blkid - 1 : 0);
366 ASSERT(off < dn->dn_phys->dn_maxblkid ||
367 dn->dn_phys->dn_maxblkid == 0 ||
368 dnode_next_offset(dn, 0, &off, 1, 1, 0) != 0);
373 * Try to kick all the dnodes dbufs out of the cache...
376 dnode_evict_dbufs(dnode_t *dn)
382 dmu_buf_impl_t *db, marker;
383 int evicting = FALSE;
386 mutex_enter(&dn->dn_dbufs_mtx);
387 list_insert_tail(&dn->dn_dbufs, &marker);
388 db = list_head(&dn->dn_dbufs);
389 for (; db != ▮ db = list_head(&dn->dn_dbufs)) {
390 list_remove(&dn->dn_dbufs, db);
391 list_insert_tail(&dn->dn_dbufs, db);
394 ASSERT3P(DB_DNODE(db), ==, dn);
398 mutex_enter(&db->db_mtx);
399 if (db->db_state == DB_EVICTING) {
402 mutex_exit(&db->db_mtx);
403 } else if (refcount_is_zero(&db->db_holds)) {
405 dbuf_clear(db); /* exits db_mtx for us */
407 mutex_exit(&db->db_mtx);
411 list_remove(&dn->dn_dbufs, &marker);
413 * NB: we need to drop dn_dbufs_mtx between passes so
414 * that any DB_EVICTING dbufs can make progress.
415 * Ideally, we would have some cv we could wait on, but
416 * since we don't, just wait a bit to give the other
417 * thread a chance to run.
419 mutex_exit(&dn->dn_dbufs_mtx);
423 if ((pass % 100) == 0)
424 dprintf("Exceeded %d passes evicting dbufs\n", pass);
428 dprintf("Required %d passes to evict dbufs\n", pass);
430 rw_enter(&dn->dn_struct_rwlock, RW_WRITER);
431 if (dn->dn_bonus && refcount_is_zero(&dn->dn_bonus->db_holds)) {
432 mutex_enter(&dn->dn_bonus->db_mtx);
433 dbuf_evict(dn->dn_bonus);
436 rw_exit(&dn->dn_struct_rwlock);
440 dnode_undirty_dbufs(list_t *list)
442 dbuf_dirty_record_t *dr;
444 while ((dr = list_head(list))) {
445 dmu_buf_impl_t *db = dr->dr_dbuf;
446 uint64_t txg = dr->dr_txg;
448 if (db->db_level != 0)
449 dnode_undirty_dbufs(&dr->dt.di.dr_children);
451 mutex_enter(&db->db_mtx);
452 /* XXX - use dbuf_undirty()? */
453 list_remove(list, dr);
454 ASSERT(db->db_last_dirty == dr);
455 db->db_last_dirty = NULL;
456 db->db_dirtycnt -= 1;
457 if (db->db_level == 0) {
458 ASSERT(db->db_blkid == DMU_BONUS_BLKID ||
459 dr->dt.dl.dr_data == db->db_buf);
462 kmem_free(dr, sizeof (dbuf_dirty_record_t));
463 dbuf_rele_and_unlock(db, (void *)(uintptr_t)txg);
468 dnode_sync_free(dnode_t *dn, dmu_tx_t *tx)
470 int txgoff = tx->tx_txg & TXG_MASK;
472 ASSERT(dmu_tx_is_syncing(tx));
475 * Our contents should have been freed in dnode_sync() by the
476 * free range record inserted by the caller of dnode_free().
478 ASSERT3U(DN_USED_BYTES(dn->dn_phys), ==, 0);
479 ASSERT(BP_IS_HOLE(dn->dn_phys->dn_blkptr));
481 dnode_undirty_dbufs(&dn->dn_dirty_records[txgoff]);
482 dnode_evict_dbufs(dn);
483 ASSERT3P(list_head(&dn->dn_dbufs), ==, NULL);
486 * XXX - It would be nice to assert this, but we may still
487 * have residual holds from async evictions from the arc...
489 * zfs_obj_to_path() also depends on this being
492 * ASSERT3U(refcount_count(&dn->dn_holds), ==, 1);
495 /* Undirty next bits */
496 dn->dn_next_nlevels[txgoff] = 0;
497 dn->dn_next_indblkshift[txgoff] = 0;
498 dn->dn_next_blksz[txgoff] = 0;
500 /* ASSERT(blkptrs are zero); */
501 ASSERT(dn->dn_phys->dn_type != DMU_OT_NONE);
502 ASSERT(dn->dn_type != DMU_OT_NONE);
504 ASSERT(dn->dn_free_txg > 0);
505 if (dn->dn_allocated_txg != dn->dn_free_txg)
506 dbuf_will_dirty(dn->dn_dbuf, tx);
507 bzero(dn->dn_phys, sizeof (dnode_phys_t));
509 mutex_enter(&dn->dn_mtx);
510 dn->dn_type = DMU_OT_NONE;
512 dn->dn_allocated_txg = 0;
514 dn->dn_have_spill = B_FALSE;
515 mutex_exit(&dn->dn_mtx);
517 ASSERT(dn->dn_object != DMU_META_DNODE_OBJECT);
519 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg);
521 * Now that we've released our hold, the dnode may
522 * be evicted, so we musn't access it.
527 * Write out the dnode's dirty buffers.
530 dnode_sync(dnode_t *dn, dmu_tx_t *tx)
533 dnode_phys_t *dnp = dn->dn_phys;
534 int txgoff = tx->tx_txg & TXG_MASK;
535 list_t *list = &dn->dn_dirty_records[txgoff];
536 boolean_t kill_spill = B_FALSE;
537 ASSERTV(static const dnode_phys_t zerodn = { 0 });
539 ASSERT(dmu_tx_is_syncing(tx));
540 ASSERT(dnp->dn_type != DMU_OT_NONE || dn->dn_allocated_txg);
541 ASSERT(dnp->dn_type != DMU_OT_NONE ||
542 bcmp(dnp, &zerodn, DNODE_SIZE) == 0);
545 ASSERT(dn->dn_dbuf == NULL || arc_released(dn->dn_dbuf->db_buf));
547 if (dmu_objset_userused_enabled(dn->dn_objset) &&
548 !DMU_OBJECT_IS_SPECIAL(dn->dn_object)) {
549 mutex_enter(&dn->dn_mtx);
550 dn->dn_oldused = DN_USED_BYTES(dn->dn_phys);
551 dn->dn_oldflags = dn->dn_phys->dn_flags;
552 dn->dn_phys->dn_flags |= DNODE_FLAG_USERUSED_ACCOUNTED;
553 mutex_exit(&dn->dn_mtx);
554 dmu_objset_userquota_get_ids(dn, B_FALSE, tx);
556 /* Once we account for it, we should always account for it. */
557 ASSERT(!(dn->dn_phys->dn_flags &
558 DNODE_FLAG_USERUSED_ACCOUNTED));
561 mutex_enter(&dn->dn_mtx);
562 if (dn->dn_allocated_txg == tx->tx_txg) {
563 /* The dnode is newly allocated or reallocated */
564 if (dnp->dn_type == DMU_OT_NONE) {
565 /* this is a first alloc, not a realloc */
567 dnp->dn_nblkptr = dn->dn_nblkptr;
570 dnp->dn_type = dn->dn_type;
571 dnp->dn_bonustype = dn->dn_bonustype;
572 dnp->dn_bonuslen = dn->dn_bonuslen;
575 ASSERT(dnp->dn_nlevels > 1 ||
576 BP_IS_HOLE(&dnp->dn_blkptr[0]) ||
577 BP_GET_LSIZE(&dnp->dn_blkptr[0]) ==
578 dnp->dn_datablkszsec << SPA_MINBLOCKSHIFT);
580 if (dn->dn_next_blksz[txgoff]) {
581 ASSERT(P2PHASE(dn->dn_next_blksz[txgoff],
582 SPA_MINBLOCKSIZE) == 0);
583 ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[0]) ||
584 dn->dn_maxblkid == 0 || list_head(list) != NULL ||
585 avl_last(&dn->dn_ranges[txgoff]) ||
586 dn->dn_next_blksz[txgoff] >> SPA_MINBLOCKSHIFT ==
587 dnp->dn_datablkszsec);
588 dnp->dn_datablkszsec =
589 dn->dn_next_blksz[txgoff] >> SPA_MINBLOCKSHIFT;
590 dn->dn_next_blksz[txgoff] = 0;
593 if (dn->dn_next_bonuslen[txgoff]) {
594 if (dn->dn_next_bonuslen[txgoff] == DN_ZERO_BONUSLEN)
595 dnp->dn_bonuslen = 0;
597 dnp->dn_bonuslen = dn->dn_next_bonuslen[txgoff];
598 ASSERT(dnp->dn_bonuslen <= DN_MAX_BONUSLEN);
599 dn->dn_next_bonuslen[txgoff] = 0;
602 if (dn->dn_next_bonustype[txgoff]) {
603 ASSERT(DMU_OT_IS_VALID(dn->dn_next_bonustype[txgoff]));
604 dnp->dn_bonustype = dn->dn_next_bonustype[txgoff];
605 dn->dn_next_bonustype[txgoff] = 0;
609 * We will either remove a spill block when a file is being removed
610 * or we have been asked to remove it.
612 if (dn->dn_rm_spillblk[txgoff] ||
613 ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR) &&
614 dn->dn_free_txg > 0 && dn->dn_free_txg <= tx->tx_txg)) {
615 if ((dnp->dn_flags & DNODE_FLAG_SPILL_BLKPTR))
617 dn->dn_rm_spillblk[txgoff] = 0;
620 if (dn->dn_next_indblkshift[txgoff]) {
621 ASSERT(dnp->dn_nlevels == 1);
622 dnp->dn_indblkshift = dn->dn_next_indblkshift[txgoff];
623 dn->dn_next_indblkshift[txgoff] = 0;
627 * Just take the live (open-context) values for checksum and compress.
628 * Strictly speaking it's a future leak, but nothing bad happens if we
629 * start using the new checksum or compress algorithm a little early.
631 dnp->dn_checksum = dn->dn_checksum;
632 dnp->dn_compress = dn->dn_compress;
634 mutex_exit(&dn->dn_mtx);
637 (void) free_blocks(dn, &dn->dn_phys->dn_spill, 1, tx);
638 mutex_enter(&dn->dn_mtx);
639 dnp->dn_flags &= ~DNODE_FLAG_SPILL_BLKPTR;
640 mutex_exit(&dn->dn_mtx);
643 /* process all the "freed" ranges in the file */
644 while ((rp = avl_last(&dn->dn_ranges[txgoff]))) {
645 dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx);
646 /* grab the mutex so we don't race with dnode_block_freed() */
647 mutex_enter(&dn->dn_mtx);
648 avl_remove(&dn->dn_ranges[txgoff], rp);
649 mutex_exit(&dn->dn_mtx);
650 kmem_free(rp, sizeof (free_range_t));
653 if (dn->dn_free_txg > 0 && dn->dn_free_txg <= tx->tx_txg) {
654 dnode_sync_free(dn, tx);
658 if (dn->dn_next_nblkptr[txgoff]) {
659 /* this should only happen on a realloc */
660 ASSERT(dn->dn_allocated_txg == tx->tx_txg);
661 if (dn->dn_next_nblkptr[txgoff] > dnp->dn_nblkptr) {
662 /* zero the new blkptrs we are gaining */
663 bzero(dnp->dn_blkptr + dnp->dn_nblkptr,
665 (dn->dn_next_nblkptr[txgoff] - dnp->dn_nblkptr));
669 ASSERT(dn->dn_next_nblkptr[txgoff] < dnp->dn_nblkptr);
670 /* the blkptrs we are losing better be unallocated */
671 for (i = 0; i < dnp->dn_nblkptr; i++) {
672 if (i >= dn->dn_next_nblkptr[txgoff])
673 ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[i]));
677 mutex_enter(&dn->dn_mtx);
678 dnp->dn_nblkptr = dn->dn_next_nblkptr[txgoff];
679 dn->dn_next_nblkptr[txgoff] = 0;
680 mutex_exit(&dn->dn_mtx);
683 if (dn->dn_next_nlevels[txgoff]) {
684 dnode_increase_indirection(dn, tx);
685 dn->dn_next_nlevels[txgoff] = 0;
688 dbuf_sync_list(list, tx);
690 if (!DMU_OBJECT_IS_SPECIAL(dn->dn_object)) {
691 ASSERT3P(list_head(list), ==, NULL);
692 dnode_rele(dn, (void *)(uintptr_t)tx->tx_txg);
696 * Although we have dropped our reference to the dnode, it
697 * can't be evicted until its written, and we haven't yet
698 * initiated the IO for the dnode's dbuf.