called from dsl */
| 1604 | |
| 1605 | /* called from dsl */ |
| 1606 | void |
| 1607 | dmu_objset_sync(objset_t *os, zio_t *pio, dmu_tx_t *tx) |
| 1608 | { |
| 1609 | int txgoff; |
| 1610 | zbookmark_phys_t zb; |
| 1611 | zio_prop_t zp; |
| 1612 | zio_t *zio; |
| 1613 | list_t *list; |
| 1614 | dbuf_dirty_record_t *dr; |
| 1615 | int num_sublists; |
| 1616 | multilist_t *ml; |
| 1617 | blkptr_t *blkptr_copy = kmem_alloc(sizeof (*os->os_rootbp), KM_SLEEP); |
| 1618 | *blkptr_copy = *os->os_rootbp; |
| 1619 | |
| 1620 | dprintf_ds(os->os_dsl_dataset, "txg=%llu\n", tx->tx_txg); |
| 1621 | |
| 1622 | ASSERT(dmu_tx_is_syncing(tx)); |
| 1623 | /* XXX the write_done callback should really give us the tx... */ |
| 1624 | os->os_synctx = tx; |
| 1625 | |
| 1626 | if (os->os_dsl_dataset == NULL) { |
| 1627 | /* |
| 1628 | * This is the MOS. If we have upgraded, |
| 1629 | * spa_max_replication() could change, so reset |
| 1630 | * os_copies here. |
| 1631 | */ |
| 1632 | os->os_copies = spa_max_replication(os->os_spa); |
| 1633 | } |
| 1634 | |
| 1635 | /* |
| 1636 | * Create the root block IO |
| 1637 | */ |
| 1638 | SET_BOOKMARK(&zb, os->os_dsl_dataset ? |
| 1639 | os->os_dsl_dataset->ds_object : DMU_META_OBJSET, |
| 1640 | ZB_ROOT_OBJECT, ZB_ROOT_LEVEL, ZB_ROOT_BLKID); |
| 1641 | arc_release(os->os_phys_buf, &os->os_phys_buf); |
| 1642 | |
| 1643 | dmu_write_policy(os, NULL, 0, 0, &zp); |
| 1644 | |
| 1645 | /* |
| 1646 | * If we are either claiming the ZIL or doing a raw receive, write |
| 1647 | * out the os_phys_buf raw. Neither of these actions will effect the |
| 1648 | * MAC at this point. |
| 1649 | */ |
| 1650 | if (os->os_raw_receive || |
| 1651 | os->os_next_write_raw[tx->tx_txg & TXG_MASK]) { |
| 1652 | ASSERT(os->os_encrypted); |
| 1653 | arc_convert_to_raw(os->os_phys_buf, |
| 1654 | os->os_dsl_dataset->ds_object, ZFS_HOST_BYTEORDER, |
| 1655 | DMU_OT_OBJSET, NULL, NULL, NULL); |
| 1656 | } |
| 1657 | |
| 1658 | zio = arc_write(pio, os->os_spa, tx->tx_txg, |
| 1659 | blkptr_copy, os->os_phys_buf, DMU_OS_IS_L2CACHEABLE(os), |
| 1660 | &zp, dmu_objset_write_ready, NULL, NULL, dmu_objset_write_done, |
| 1661 | os, ZIO_PRIORITY_ASYNC_WRITE, ZIO_FLAG_MUSTSUCCEED, &zb); |
| 1662 | |
| 1663 | /* |
no test coverage detected