ASSERT(list_head(list) == NULL || dmu_objset_userused_enabled(os));
- while (dn = list_head(list)) {
+ while ((dn = list_head(list))) {
- dmu_object_type_t bonustype;
-
ASSERT(!DMU_OBJECT_IS_SPECIAL(dn->dn_object));
- ASSERT(dn->dn_oldphys);
ASSERT(dn->dn_phys->dn_type == DMU_OT_NONE ||
dn->dn_phys->dn_flags &
DNODE_FLAG_USERUSED_ACCOUNTED);
mutex_exit(&dn->dn_mtx);
+ if (kill_spill) {
+ (void) free_blocks(dn, &dn->dn_phys->dn_spill, 1, tx);
+ mutex_enter(&dn->dn_mtx);
+ dnp->dn_flags &= ~DNODE_FLAG_SPILL_BLKPTR;
+ mutex_exit(&dn->dn_mtx);
+ }
+
/* process all the "freed" ranges in the file */
- while (rp = avl_last(&dn->dn_ranges[txgoff])) {
+ while ((rp = avl_last(&dn->dn_ranges[txgoff]))) {
dnode_sync_free_range(dn, rp->fr_blkid, rp->fr_nblks, tx);
/* grab the mutex so we don't race with dnode_block_freed() */
mutex_enter(&dn->dn_mtx);
}
err = zio_wait(zio);
- while (dstg = txg_list_remove(&dp->dp_sync_tasks, txg)) {
+ /*
+ * Move dead blocks from the pending deadlist to the on-disk
+ * deadlist.
+ */
+ for (ds = list_head(&dp->dp_synced_datasets); ds;
+ ds = list_next(&dp->dp_synced_datasets, ds)) {
+ bplist_iterate(&ds->ds_pending_deadlist,
+ deadlist_enqueue_cb, &ds->ds_deadlist, tx);
+ }
+
+ while ((dstg = txg_list_remove(&dp->dp_sync_tasks, txg))) {
/*
* No more sync tasks should have been added while we
* were syncing.
}
void
- dsl_pool_zil_clean(dsl_pool_t *dp)
+ dsl_pool_sync_done(dsl_pool_t *dp, uint64_t txg)
{
dsl_dataset_t *ds;
+ objset_t *os;
- while (ds = list_head(&dp->dp_synced_datasets)) {
+ while ((ds = list_head(&dp->dp_synced_datasets))) {
list_remove(&dp->dp_synced_datasets, ds);
- ASSERT(ds->ds_user_ptr != NULL);
- zil_clean(((objset_impl_t *)ds->ds_user_ptr)->os_zil);
+ os = ds->ds_objset;
+ zil_clean(os->os_zil);
+ ASSERT(!dmu_objset_is_dirty(os, txg));
dmu_buf_rele(ds->ds_dbuf, ds);
}
+ ASSERT(!dmu_objset_is_dirty(dp->dp_meta_objset, txg));
}
/*
dsl_dataset_t *ds;
uint64_t version;
nvpair_t *elem = NULL;
+ dsl_props_arg_t pa;
int err;
- if (err = dsl_dataset_hold(dsname, FTAG, &ds))
+ if ((err = dsl_dataset_hold(dsname, FTAG, &ds)))
return (err);
/*
* Do these checks before the syncfunc, since it can't fail.
break;
}
- if ((error = dmu_objset_open(strval,DMU_OST_ZFS,
- DS_MODE_USER | DS_MODE_READONLY, &os)))
- if (error = dmu_objset_hold(strval, FTAG, &os))
++ if ((error = dmu_objset_hold(strval,FTAG,&os)))
break;
- /* We don't support gzip bootable datasets */
- if ((error = dsl_prop_get_integer(strval,
+ /* Must be ZPL and not gzip compressed. */
+
+ if (dmu_objset_type(os) != DMU_OST_ZFS) {
+ error = ENOTSUP;
+ } else if ((error = dsl_prop_get_integer(strval,
zfs_prop_to_name(ZFS_PROP_COMPRESSION),
&compress, NULL)) == 0 &&
!BOOTFS_COMPRESS_VALID(compress)) {
/*
* Update usable space statistics.
*/
- while (vd = txg_list_remove(&spa->spa_vdev_txg_list, TXG_CLEAN(txg)))
+ while ((vd = txg_list_remove(&spa->spa_vdev_txg_list, TXG_CLEAN(txg))))
vdev_sync_done(vd, txg);
+ spa_update_dspace(spa);
+
/*
* It had better be the case that we didn't dirty anything
* since vdev_config_sync().
vdev_sync_done(vdev_t *vd, uint64_t txg)
{
metaslab_t *msp;
+ boolean_t reassess = !txg_list_empty(&vd->vdev_ms_list, TXG_CLEAN(txg));
+
+ ASSERT(!vd->vdev_ishole);
- while (msp = txg_list_remove(&vd->vdev_ms_list, TXG_CLEAN(txg)))
+ while ((msp = txg_list_remove(&vd->vdev_ms_list, TXG_CLEAN(txg))))
metaslab_sync_done(msp, txg);
+
+ if (reassess)
+ metaslab_sync_reassess(vd->vdev_mg);
}
void
int error;
nvlist_t *nv;
- if ((error = dmu_objset_open(zc->zc_name,
- DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)))
- if (error = dmu_objset_hold(zc->zc_name, FTAG, &os))
++ if ((error = dmu_objset_hold(zc->zc_name, FTAG, &os)))
return (error);
dmu_objset_fast_stat(os, &zc->zc_objset_stats);
objset_t *os;
int err;
- if ((err = dmu_objset_open(zc->zc_name,
- DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os)))
+ /* XXX reading without owning */
- if (err = dmu_objset_hold(zc->zc_name, FTAG, &os))
++ if ((err = dmu_objset_hold(zc->zc_name, FTAG, &os)))
return (err);
dmu_objset_fast_stat(os, &zc->zc_objset_stats);
objset_t *os;
int error;
char *p;
+ size_t orig_len = strlen(zc->zc_name);
- if ((error = dmu_objset_open(zc->zc_name,
- DMU_OST_ANY, DS_MODE_USER | DS_MODE_READONLY, &os))) {
+ top:
- if (error = dmu_objset_hold(zc->zc_name, FTAG, &os)) {
++ if ((error = dmu_objset_hold(zc->zc_name, FTAG, &os))) {
if (error == ENOENT)
error = ESRCH;
return (error);
char *valstr;
if (!zfs_prop_user(propname) ||
- nvpair_type(elem) != DATA_TYPE_STRING)
+ nvpair_type(pair) != DATA_TYPE_STRING)
return (EINVAL);
- if (error = zfs_secpolicy_write_perms(fsname,
- ZFS_DELEG_PERM_USERPROP, CRED()))
+ if ((error = zfs_secpolicy_write_perms(fsname,
+ ZFS_DELEG_PERM_USERPROP, CRED())))
return (error);
if (strlen(propname) >= ZAP_MAXNAMELEN)