dnode.c (263397) | dnode.c (265740) |
---|---|
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 --- 6 unchanged lines hidden (view full) --- 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] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. | 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 --- 6 unchanged lines hidden (view full) --- 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] 18 * 19 * CDDL HEADER END 20 */ 21/* 22 * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. |
23 * Copyright (c) 2013 by Delphix. All rights reserved. | 23 * Copyright (c) 2012, 2014 by Delphix. All rights reserved. |
24 */ 25 26#include <sys/zfs_context.h> 27#include <sys/dbuf.h> 28#include <sys/dnode.h> 29#include <sys/dmu.h> 30#include <sys/dmu_impl.h> 31#include <sys/dmu_tx.h> 32#include <sys/dmu_objset.h> 33#include <sys/dsl_dir.h> 34#include <sys/dsl_dataset.h> 35#include <sys/spa.h> 36#include <sys/zio.h> 37#include <sys/dmu_zfetch.h> | 24 */ 25 26#include <sys/zfs_context.h> 27#include <sys/dbuf.h> 28#include <sys/dnode.h> 29#include <sys/dmu.h> 30#include <sys/dmu_impl.h> 31#include <sys/dmu_tx.h> 32#include <sys/dmu_objset.h> 33#include <sys/dsl_dir.h> 34#include <sys/dsl_dataset.h> 35#include <sys/spa.h> 36#include <sys/zio.h> 37#include <sys/dmu_zfetch.h> |
38#include <sys/range_tree.h> |
|
38 | 39 |
39static int free_range_compar(const void *node1, const void *node2); 40 | |
41static kmem_cache_t *dnode_cache; 42/* 43 * Define DNODE_STATS to turn on statistic gathering. By default, it is only 44 * turned on when DEBUG is also defined. 45 */ 46#ifdef DEBUG 47#define DNODE_STATS 48#endif /* DEBUG */ --- 38 unchanged lines hidden (view full) --- 87 bzero(&dn->dn_next_indblkshift[0], sizeof (dn->dn_next_indblkshift)); 88 bzero(&dn->dn_next_bonustype[0], sizeof (dn->dn_next_bonustype)); 89 bzero(&dn->dn_rm_spillblk[0], sizeof (dn->dn_rm_spillblk)); 90 bzero(&dn->dn_next_bonuslen[0], sizeof (dn->dn_next_bonuslen)); 91 bzero(&dn->dn_next_blksz[0], sizeof (dn->dn_next_blksz)); 92 93 for (i = 0; i < TXG_SIZE; i++) { 94 list_link_init(&dn->dn_dirty_link[i]); | 40static kmem_cache_t *dnode_cache; 41/* 42 * Define DNODE_STATS to turn on statistic gathering. By default, it is only 43 * turned on when DEBUG is also defined. 44 */ 45#ifdef DEBUG 46#define DNODE_STATS 47#endif /* DEBUG */ --- 38 unchanged lines hidden (view full) --- 86 bzero(&dn->dn_next_indblkshift[0], sizeof (dn->dn_next_indblkshift)); 87 bzero(&dn->dn_next_bonustype[0], sizeof (dn->dn_next_bonustype)); 88 bzero(&dn->dn_rm_spillblk[0], sizeof (dn->dn_rm_spillblk)); 89 bzero(&dn->dn_next_bonuslen[0], sizeof (dn->dn_next_bonuslen)); 90 bzero(&dn->dn_next_blksz[0], sizeof (dn->dn_next_blksz)); 91 92 for (i = 0; i < TXG_SIZE; i++) { 93 list_link_init(&dn->dn_dirty_link[i]); |
95 avl_create(&dn->dn_ranges[i], free_range_compar, 96 sizeof (free_range_t), 97 offsetof(struct free_range, fr_node)); | 94 dn->dn_free_ranges[i] = NULL; |
98 list_create(&dn->dn_dirty_records[i], 99 sizeof (dbuf_dirty_record_t), 100 offsetof(dbuf_dirty_record_t, dr_dirty_node)); 101 } 102 103 dn->dn_allocated_txg = 0; 104 dn->dn_free_txg = 0; 105 dn->dn_assigned_txg = 0; --- 32 unchanged lines hidden (view full) --- 138 mutex_destroy(&dn->dn_dbufs_mtx); 139 cv_destroy(&dn->dn_notxholds); 140 refcount_destroy(&dn->dn_holds); 141 refcount_destroy(&dn->dn_tx_holds); 142 ASSERT(!list_link_active(&dn->dn_link)); 143 144 for (i = 0; i < TXG_SIZE; i++) { 145 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); | 95 list_create(&dn->dn_dirty_records[i], 96 sizeof (dbuf_dirty_record_t), 97 offsetof(dbuf_dirty_record_t, dr_dirty_node)); 98 } 99 100 dn->dn_allocated_txg = 0; 101 dn->dn_free_txg = 0; 102 dn->dn_assigned_txg = 0; --- 32 unchanged lines hidden (view full) --- 135 mutex_destroy(&dn->dn_dbufs_mtx); 136 cv_destroy(&dn->dn_notxholds); 137 refcount_destroy(&dn->dn_holds); 138 refcount_destroy(&dn->dn_tx_holds); 139 ASSERT(!list_link_active(&dn->dn_link)); 140 141 for (i = 0; i < TXG_SIZE; i++) { 142 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); |
146 avl_destroy(&dn->dn_ranges[i]); | 143 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); |
147 list_destroy(&dn->dn_dirty_records[i]); 148 ASSERT0(dn->dn_next_nblkptr[i]); 149 ASSERT0(dn->dn_next_nlevels[i]); 150 ASSERT0(dn->dn_next_indblkshift[i]); 151 ASSERT0(dn->dn_next_bonustype[i]); 152 ASSERT0(dn->dn_rm_spillblk[i]); 153 ASSERT0(dn->dn_next_bonuslen[i]); 154 ASSERT0(dn->dn_next_blksz[i]); --- 156 unchanged lines hidden (view full) --- 311 312 size >>= DNODE_SHIFT; 313 for (i = 0; i < size; i++) { 314 dnode_byteswap(buf); 315 buf++; 316 } 317} 318 | 144 list_destroy(&dn->dn_dirty_records[i]); 145 ASSERT0(dn->dn_next_nblkptr[i]); 146 ASSERT0(dn->dn_next_nlevels[i]); 147 ASSERT0(dn->dn_next_indblkshift[i]); 148 ASSERT0(dn->dn_next_bonustype[i]); 149 ASSERT0(dn->dn_rm_spillblk[i]); 150 ASSERT0(dn->dn_next_bonuslen[i]); 151 ASSERT0(dn->dn_next_blksz[i]); --- 156 unchanged lines hidden (view full) --- 308 309 size >>= DNODE_SHIFT; 310 for (i = 0; i < size; i++) { 311 dnode_byteswap(buf); 312 buf++; 313 } 314} 315 |
319static int 320free_range_compar(const void *node1, const void *node2) 321{ 322 const free_range_t *rp1 = node1; 323 const free_range_t *rp2 = node2; 324 325 if (rp1->fr_blkid < rp2->fr_blkid) 326 return (-1); 327 else if (rp1->fr_blkid > rp2->fr_blkid) 328 return (1); 329 else return (0); 330} 331 | |
332void 333dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx) 334{ 335 ASSERT3U(refcount_count(&dn->dn_holds), >=, 1); 336 337 dnode_setdirty(dn, tx); 338 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); 339 ASSERT3U(newsize, <=, DN_MAX_BONUSLEN - --- 32 unchanged lines hidden (view full) --- 372{ 373 ASSERT0(P2PHASE(size, SPA_MINBLOCKSIZE)); 374 ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); 375 ASSERT3U(size, >=, SPA_MINBLOCKSIZE); 376 ASSERT3U(size >> SPA_MINBLOCKSHIFT, <, 377 1<<(sizeof (dn->dn_phys->dn_datablkszsec) * 8)); 378 dn->dn_datablksz = size; 379 dn->dn_datablkszsec = size >> SPA_MINBLOCKSHIFT; | 316void 317dnode_setbonuslen(dnode_t *dn, int newsize, dmu_tx_t *tx) 318{ 319 ASSERT3U(refcount_count(&dn->dn_holds), >=, 1); 320 321 dnode_setdirty(dn, tx); 322 rw_enter(&dn->dn_struct_rwlock, RW_WRITER); 323 ASSERT3U(newsize, <=, DN_MAX_BONUSLEN - --- 32 unchanged lines hidden (view full) --- 356{ 357 ASSERT0(P2PHASE(size, SPA_MINBLOCKSIZE)); 358 ASSERT3U(size, <=, SPA_MAXBLOCKSIZE); 359 ASSERT3U(size, >=, SPA_MINBLOCKSIZE); 360 ASSERT3U(size >> SPA_MINBLOCKSHIFT, <, 361 1<<(sizeof (dn->dn_phys->dn_datablkszsec) * 8)); 362 dn->dn_datablksz = size; 363 dn->dn_datablkszsec = size >> SPA_MINBLOCKSHIFT; |
380 dn->dn_datablkshift = ISP2(size) ? highbit(size - 1) : 0; | 364 dn->dn_datablkshift = ISP2(size) ? highbit64(size - 1) : 0; |
381} 382 383static dnode_t * 384dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db, 385 uint64_t object, dnode_handle_t *dnh) 386{ 387 dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); 388 --- 139 unchanged lines hidden (view full) --- 528 ASSERT0(dn->dn_next_nlevels[i]); 529 ASSERT0(dn->dn_next_indblkshift[i]); 530 ASSERT0(dn->dn_next_bonuslen[i]); 531 ASSERT0(dn->dn_next_bonustype[i]); 532 ASSERT0(dn->dn_rm_spillblk[i]); 533 ASSERT0(dn->dn_next_blksz[i]); 534 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); 535 ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); | 365} 366 367static dnode_t * 368dnode_create(objset_t *os, dnode_phys_t *dnp, dmu_buf_impl_t *db, 369 uint64_t object, dnode_handle_t *dnh) 370{ 371 dnode_t *dn = kmem_cache_alloc(dnode_cache, KM_SLEEP); 372 --- 139 unchanged lines hidden (view full) --- 512 ASSERT0(dn->dn_next_nlevels[i]); 513 ASSERT0(dn->dn_next_indblkshift[i]); 514 ASSERT0(dn->dn_next_bonuslen[i]); 515 ASSERT0(dn->dn_next_bonustype[i]); 516 ASSERT0(dn->dn_rm_spillblk[i]); 517 ASSERT0(dn->dn_next_blksz[i]); 518 ASSERT(!list_link_active(&dn->dn_dirty_link[i])); 519 ASSERT3P(list_head(&dn->dn_dirty_records[i]), ==, NULL); |
536 ASSERT0(avl_numnodes(&dn->dn_ranges[i])); | 520 ASSERT3P(dn->dn_free_ranges[i], ==, NULL); |
537 } 538 539 dn->dn_type = ot; 540 dnode_setdblksz(dn, blocksize); 541 dn->dn_indblkshift = ibs; 542 dn->dn_nlevels = 1; 543 if (bonustype == DMU_OT_SA) /* Maximize bonus space for SA */ 544 dn->dn_nblkptr = 1; --- 147 unchanged lines hidden (view full) --- 692 bcopy(&odn->dn_next_bonuslen[0], &ndn->dn_next_bonuslen[0], 693 sizeof (odn->dn_next_bonuslen)); 694 bcopy(&odn->dn_next_blksz[0], &ndn->dn_next_blksz[0], 695 sizeof (odn->dn_next_blksz)); 696 for (i = 0; i < TXG_SIZE; i++) { 697 list_move_tail(&ndn->dn_dirty_records[i], 698 &odn->dn_dirty_records[i]); 699 } | 521 } 522 523 dn->dn_type = ot; 524 dnode_setdblksz(dn, blocksize); 525 dn->dn_indblkshift = ibs; 526 dn->dn_nlevels = 1; 527 if (bonustype == DMU_OT_SA) /* Maximize bonus space for SA */ 528 dn->dn_nblkptr = 1; --- 147 unchanged lines hidden (view full) --- 676 bcopy(&odn->dn_next_bonuslen[0], &ndn->dn_next_bonuslen[0], 677 sizeof (odn->dn_next_bonuslen)); 678 bcopy(&odn->dn_next_blksz[0], &ndn->dn_next_blksz[0], 679 sizeof (odn->dn_next_blksz)); 680 for (i = 0; i < TXG_SIZE; i++) { 681 list_move_tail(&ndn->dn_dirty_records[i], 682 &odn->dn_dirty_records[i]); 683 } |
700 bcopy(&odn->dn_ranges[0], &ndn->dn_ranges[0], sizeof (odn->dn_ranges)); | 684 bcopy(&odn->dn_free_ranges[0], &ndn->dn_free_ranges[0], 685 sizeof (odn->dn_free_ranges)); |
701 ndn->dn_allocated_txg = odn->dn_allocated_txg; 702 ndn->dn_free_txg = odn->dn_free_txg; 703 ndn->dn_assigned_txg = odn->dn_assigned_txg; 704 ndn->dn_dirtyctx = odn->dn_dirtyctx; 705 ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; 706 ASSERT(refcount_count(&odn->dn_tx_holds) == 0); 707 refcount_transfer(&ndn->dn_holds, &odn->dn_holds); 708 ASSERT(list_is_empty(&ndn->dn_dbufs)); --- 46 unchanged lines hidden (view full) --- 755 756 /* 757 * Satisfy the destructor. 758 */ 759 for (i = 0; i < TXG_SIZE; i++) { 760 list_create(&odn->dn_dirty_records[i], 761 sizeof (dbuf_dirty_record_t), 762 offsetof(dbuf_dirty_record_t, dr_dirty_node)); | 686 ndn->dn_allocated_txg = odn->dn_allocated_txg; 687 ndn->dn_free_txg = odn->dn_free_txg; 688 ndn->dn_assigned_txg = odn->dn_assigned_txg; 689 ndn->dn_dirtyctx = odn->dn_dirtyctx; 690 ndn->dn_dirtyctx_firstset = odn->dn_dirtyctx_firstset; 691 ASSERT(refcount_count(&odn->dn_tx_holds) == 0); 692 refcount_transfer(&ndn->dn_holds, &odn->dn_holds); 693 ASSERT(list_is_empty(&ndn->dn_dbufs)); --- 46 unchanged lines hidden (view full) --- 740 741 /* 742 * Satisfy the destructor. 743 */ 744 for (i = 0; i < TXG_SIZE; i++) { 745 list_create(&odn->dn_dirty_records[i], 746 sizeof (dbuf_dirty_record_t), 747 offsetof(dbuf_dirty_record_t, dr_dirty_node)); |
763 odn->dn_ranges[i].avl_root = NULL; 764 odn->dn_ranges[i].avl_numnodes = 0; | 748 odn->dn_free_ranges[i] = NULL; |
765 odn->dn_next_nlevels[i] = 0; 766 odn->dn_next_indblkshift[i] = 0; 767 odn->dn_next_bonustype[i] = 0; 768 odn->dn_rm_spillblk[i] = 0; 769 odn->dn_next_bonuslen[i] = 0; 770 odn->dn_next_blksz[i] = 0; 771 } 772 odn->dn_allocated_txg = 0; --- 689 unchanged lines hidden (view full) --- 1462 } 1463 1464out: 1465 if (have_read) 1466 rw_downgrade(&dn->dn_struct_rwlock); 1467} 1468 1469void | 749 odn->dn_next_nlevels[i] = 0; 750 odn->dn_next_indblkshift[i] = 0; 751 odn->dn_next_bonustype[i] = 0; 752 odn->dn_rm_spillblk[i] = 0; 753 odn->dn_next_bonuslen[i] = 0; 754 odn->dn_next_blksz[i] = 0; 755 } 756 odn->dn_allocated_txg = 0; --- 689 unchanged lines hidden (view full) --- 1446 } 1447 1448out: 1449 if (have_read) 1450 rw_downgrade(&dn->dn_struct_rwlock); 1451} 1452 1453void |
1470dnode_clear_range(dnode_t *dn, uint64_t blkid, uint64_t nblks, dmu_tx_t *tx) 1471{ 1472 avl_tree_t *tree = &dn->dn_ranges[tx->tx_txg&TXG_MASK]; 1473 avl_index_t where; 1474 free_range_t *rp; 1475 free_range_t rp_tofind; 1476 uint64_t endblk = blkid + nblks; 1477 1478 ASSERT(MUTEX_HELD(&dn->dn_mtx)); 1479 ASSERT(nblks <= UINT64_MAX - blkid); /* no overflow */ 1480 1481 dprintf_dnode(dn, "blkid=%llu nblks=%llu txg=%llu\n", 1482 blkid, nblks, tx->tx_txg); 1483 rp_tofind.fr_blkid = blkid; 1484 rp = avl_find(tree, &rp_tofind, &where); 1485 if (rp == NULL) 1486 rp = avl_nearest(tree, where, AVL_BEFORE); 1487 if (rp == NULL) 1488 rp = avl_nearest(tree, where, AVL_AFTER); 1489 1490 while (rp && (rp->fr_blkid <= blkid + nblks)) { 1491 uint64_t fr_endblk = rp->fr_blkid + rp->fr_nblks; 1492 free_range_t *nrp = AVL_NEXT(tree, rp); 1493 1494 if (blkid <= rp->fr_blkid && endblk >= fr_endblk) { 1495 /* clear this entire range */ 1496 avl_remove(tree, rp); 1497 kmem_free(rp, sizeof (free_range_t)); 1498 } else if (blkid <= rp->fr_blkid && 1499 endblk > rp->fr_blkid && endblk < fr_endblk) { 1500 /* clear the beginning of this range */ 1501 rp->fr_blkid = endblk; 1502 rp->fr_nblks = fr_endblk - endblk; 1503 } else if (blkid > rp->fr_blkid && blkid < fr_endblk && 1504 endblk >= fr_endblk) { 1505 /* clear the end of this range */ 1506 rp->fr_nblks = blkid - rp->fr_blkid; 1507 } else if (blkid > rp->fr_blkid && endblk < fr_endblk) { 1508 /* clear a chunk out of this range */ 1509 free_range_t *new_rp = 1510 kmem_alloc(sizeof (free_range_t), KM_SLEEP); 1511 1512 new_rp->fr_blkid = endblk; 1513 new_rp->fr_nblks = fr_endblk - endblk; 1514 avl_insert_here(tree, new_rp, rp, AVL_AFTER); 1515 rp->fr_nblks = blkid - rp->fr_blkid; 1516 } 1517 /* there may be no overlap */ 1518 rp = nrp; 1519 } 1520} 1521 1522void | |
1523dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) 1524{ 1525 dmu_buf_impl_t *db; 1526 uint64_t blkoff, blkid, nblks; 1527 int blksz, blkshift, head, tail; 1528 int trunc = FALSE; 1529 int epbs; 1530 --- 133 unchanged lines hidden (view full) --- 1664 } 1665 1666done: 1667 /* 1668 * Add this range to the dnode range list. 1669 * We will finish up this free operation in the syncing phase. 1670 */ 1671 mutex_enter(&dn->dn_mtx); | 1454dnode_free_range(dnode_t *dn, uint64_t off, uint64_t len, dmu_tx_t *tx) 1455{ 1456 dmu_buf_impl_t *db; 1457 uint64_t blkoff, blkid, nblks; 1458 int blksz, blkshift, head, tail; 1459 int trunc = FALSE; 1460 int epbs; 1461 --- 133 unchanged lines hidden (view full) --- 1595 } 1596 1597done: 1598 /* 1599 * Add this range to the dnode range list. 1600 * We will finish up this free operation in the syncing phase. 1601 */ 1602 mutex_enter(&dn->dn_mtx); |
1672 dnode_clear_range(dn, blkid, nblks, tx); 1673 { 1674 free_range_t *rp, *found; 1675 avl_index_t where; 1676 avl_tree_t *tree = &dn->dn_ranges[tx->tx_txg&TXG_MASK]; 1677 1678 /* Add new range to dn_ranges */ 1679 rp = kmem_alloc(sizeof (free_range_t), KM_SLEEP); 1680 rp->fr_blkid = blkid; 1681 rp->fr_nblks = nblks; 1682 found = avl_find(tree, rp, &where); 1683 ASSERT(found == NULL); 1684 avl_insert(tree, rp, where); 1685 dprintf_dnode(dn, "blkid=%llu nblks=%llu txg=%llu\n", 1686 blkid, nblks, tx->tx_txg); | 1603 int txgoff = tx->tx_txg & TXG_MASK; 1604 if (dn->dn_free_ranges[txgoff] == NULL) { 1605 dn->dn_free_ranges[txgoff] = 1606 range_tree_create(NULL, NULL, &dn->dn_mtx); |
1687 } | 1607 } |
1608 range_tree_clear(dn->dn_free_ranges[txgoff], blkid, nblks); 1609 range_tree_add(dn->dn_free_ranges[txgoff], blkid, nblks); 1610 dprintf_dnode(dn, "blkid=%llu nblks=%llu txg=%llu\n", 1611 blkid, nblks, tx->tx_txg); |
|
1688 mutex_exit(&dn->dn_mtx); 1689 1690 dbuf_free_range(dn, blkid, blkid + nblks - 1, tx); 1691 dnode_setdirty(dn, tx); 1692out: 1693 1694 rw_exit(&dn->dn_struct_rwlock); 1695} --- 11 unchanged lines hidden (view full) --- 1707 mutex_exit(&dn->dn_mtx); 1708 return (i < TXG_SIZE); 1709} 1710 1711/* return TRUE if this blkid was freed in a recent txg, or FALSE if it wasn't */ 1712uint64_t 1713dnode_block_freed(dnode_t *dn, uint64_t blkid) 1714{ | 1612 mutex_exit(&dn->dn_mtx); 1613 1614 dbuf_free_range(dn, blkid, blkid + nblks - 1, tx); 1615 dnode_setdirty(dn, tx); 1616out: 1617 1618 rw_exit(&dn->dn_struct_rwlock); 1619} --- 11 unchanged lines hidden (view full) --- 1631 mutex_exit(&dn->dn_mtx); 1632 return (i < TXG_SIZE); 1633} 1634 1635/* return TRUE if this blkid was freed in a recent txg, or FALSE if it wasn't */ 1636uint64_t 1637dnode_block_freed(dnode_t *dn, uint64_t blkid) 1638{ |
1715 free_range_t range_tofind; | |
1716 void *dp = spa_get_dsl(dn->dn_objset->os_spa); 1717 int i; 1718 1719 if (blkid == DMU_BONUS_BLKID) 1720 return (FALSE); 1721 1722 /* 1723 * If we're in the process of opening the pool, dp will not be 1724 * set yet, but there shouldn't be anything dirty. 1725 */ 1726 if (dp == NULL) 1727 return (FALSE); 1728 1729 if (dn->dn_free_txg) 1730 return (TRUE); 1731 1732 if (blkid == DMU_SPILL_BLKID) 1733 return (dnode_spill_freed(dn)); 1734 | 1639 void *dp = spa_get_dsl(dn->dn_objset->os_spa); 1640 int i; 1641 1642 if (blkid == DMU_BONUS_BLKID) 1643 return (FALSE); 1644 1645 /* 1646 * If we're in the process of opening the pool, dp will not be 1647 * set yet, but there shouldn't be anything dirty. 1648 */ 1649 if (dp == NULL) 1650 return (FALSE); 1651 1652 if (dn->dn_free_txg) 1653 return (TRUE); 1654 1655 if (blkid == DMU_SPILL_BLKID) 1656 return (dnode_spill_freed(dn)); 1657 |
1735 range_tofind.fr_blkid = blkid; | |
1736 mutex_enter(&dn->dn_mtx); 1737 for (i = 0; i < TXG_SIZE; i++) { | 1658 mutex_enter(&dn->dn_mtx); 1659 for (i = 0; i < TXG_SIZE; i++) { |
1738 free_range_t *range_found; 1739 avl_index_t idx; 1740 1741 range_found = avl_find(&dn->dn_ranges[i], &range_tofind, &idx); 1742 if (range_found) { 1743 ASSERT(range_found->fr_nblks > 0); | 1660 if (dn->dn_free_ranges[i] != NULL && 1661 range_tree_contains(dn->dn_free_ranges[i], blkid, 1)) |
1744 break; | 1662 break; |
1745 } 1746 range_found = avl_nearest(&dn->dn_ranges[i], idx, AVL_BEFORE); 1747 if (range_found && 1748 range_found->fr_blkid + range_found->fr_nblks > blkid) 1749 break; | |
1750 } 1751 mutex_exit(&dn->dn_mtx); 1752 return (i < TXG_SIZE); 1753} 1754 1755/* call from syncing context when we actually write/free space for this dnode */ 1756void 1757dnode_diduse_space(dnode_t *dn, int64_t delta) --- 245 unchanged lines hidden --- | 1663 } 1664 mutex_exit(&dn->dn_mtx); 1665 return (i < TXG_SIZE); 1666} 1667 1668/* call from syncing context when we actually write/free space for this dnode */ 1669void 1670dnode_diduse_space(dnode_t *dn, int64_t delta) --- 245 unchanged lines hidden --- |