mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Rebase master to b117
This commit is contained in:
+43
-16
@@ -229,7 +229,7 @@ dsl_dataset_prev_snap_txg(dsl_dataset_t *ds)
|
||||
return (MAX(ds->ds_phys->ds_prev_snap_txg, trysnap));
|
||||
}
|
||||
|
||||
int
|
||||
boolean_t
|
||||
dsl_dataset_block_freeable(dsl_dataset_t *ds, uint64_t blk_birth)
|
||||
{
|
||||
return (blk_birth > dsl_dataset_prev_snap_txg(ds));
|
||||
@@ -548,6 +548,7 @@ dsl_dataset_own_obj(dsl_pool_t *dp, uint64_t dsobj, int flags, void *owner,
|
||||
return (err);
|
||||
if (!dsl_dataset_tryown(*dsp, DS_MODE_IS_INCONSISTENT(flags), owner)) {
|
||||
dsl_dataset_rele(*dsp, owner);
|
||||
*dsp = NULL;
|
||||
return (EBUSY);
|
||||
}
|
||||
return (0);
|
||||
@@ -974,6 +975,27 @@ dsl_dataset_destroy(dsl_dataset_t *ds, void *tag)
|
||||
(void) dmu_free_object(os, obj);
|
||||
}
|
||||
|
||||
/*
|
||||
* We need to sync out all in-flight IO before we try to evict
|
||||
* (the dataset evict func is trying to clear the cached entries
|
||||
* for this dataset in the ARC).
|
||||
*/
|
||||
txg_wait_synced(dd->dd_pool, 0);
|
||||
|
||||
/*
|
||||
* If we managed to free all the objects in open
|
||||
* context, the user space accounting should be zero.
|
||||
*/
|
||||
if (ds->ds_phys->ds_bp.blk_fill == 0 &&
|
||||
dmu_objset_userused_enabled(os->os)) {
|
||||
uint64_t count;
|
||||
|
||||
ASSERT(zap_count(os, DMU_USERUSED_OBJECT, &count) != 0 ||
|
||||
count == 0);
|
||||
ASSERT(zap_count(os, DMU_GROUPUSED_OBJECT, &count) != 0 ||
|
||||
count == 0);
|
||||
}
|
||||
|
||||
dmu_objset_close(os);
|
||||
if (err != ESRCH)
|
||||
goto out;
|
||||
@@ -1058,7 +1080,6 @@ dsl_dataset_get_user_ptr(dsl_dataset_t *ds)
|
||||
return (ds->ds_user_ptr);
|
||||
}
|
||||
|
||||
|
||||
blkptr_t *
|
||||
dsl_dataset_get_blkptr(dsl_dataset_t *ds)
|
||||
{
|
||||
@@ -1164,8 +1185,18 @@ kill_blkptr(spa_t *spa, blkptr_t *bp, const zbookmark_t *zb,
|
||||
if (bp == NULL)
|
||||
return (0);
|
||||
|
||||
ASSERT3U(bp->blk_birth, >, ka->ds->ds_phys->ds_prev_snap_txg);
|
||||
(void) dsl_dataset_block_kill(ka->ds, bp, ka->zio, ka->tx);
|
||||
if ((zb->zb_level == -1ULL && zb->zb_blkid != 0) ||
|
||||
(zb->zb_object != 0 && dnp == NULL)) {
|
||||
/*
|
||||
* It's a block in the intent log. It has no
|
||||
* accounting, so just free it.
|
||||
*/
|
||||
VERIFY3U(0, ==, dsl_free(ka->zio, ka->tx->tx_pool,
|
||||
ka->tx->tx_txg, bp, NULL, NULL, ARC_NOWAIT));
|
||||
} else {
|
||||
ASSERT3U(bp->blk_birth, >, ka->ds->ds_phys->ds_prev_snap_txg);
|
||||
(void) dsl_dataset_block_kill(ka->ds, bp, ka->zio, ka->tx);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
@@ -1209,13 +1240,7 @@ dsl_dataset_rollback_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
|
||||
|
||||
dmu_buf_will_dirty(ds->ds_dbuf, tx);
|
||||
|
||||
/*
|
||||
* Before the roll back destroy the zil.
|
||||
*/
|
||||
if (ds->ds_user_ptr != NULL) {
|
||||
zil_rollback_destroy(
|
||||
((objset_impl_t *)ds->ds_user_ptr)->os_zil, tx);
|
||||
|
||||
/*
|
||||
* We need to make sure that the objset_impl_t is reopened after
|
||||
* we do the rollback, otherwise it will have the wrong
|
||||
@@ -1248,7 +1273,10 @@ dsl_dataset_rollback_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
|
||||
ds->ds_phys->ds_deadlist_obj));
|
||||
|
||||
{
|
||||
/* Free blkptrs that we gave birth to */
|
||||
/*
|
||||
* Free blkptrs that we gave birth to - this covers
|
||||
* claimed but not played log blocks too.
|
||||
*/
|
||||
zio_t *zio;
|
||||
struct killarg ka;
|
||||
|
||||
@@ -1262,8 +1290,7 @@ dsl_dataset_rollback_sync(void *arg1, void *arg2, cred_t *cr, dmu_tx_t *tx)
|
||||
(void) zio_wait(zio);
|
||||
}
|
||||
|
||||
ASSERT(!(ds->ds_phys->ds_flags & DS_FLAG_UNIQUE_ACCURATE) ||
|
||||
ds->ds_phys->ds_unique_bytes == 0);
|
||||
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) || ds->ds_phys->ds_unique_bytes == 0);
|
||||
|
||||
if (ds->ds_prev && ds->ds_prev != ds->ds_dir->dd_pool->dp_origin_snap) {
|
||||
/* Change our contents to that of the prev snapshot */
|
||||
@@ -1481,7 +1508,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, cred_t *cr, dmu_tx_t *tx)
|
||||
dmu_buf_will_dirty(ds_prev->ds_dbuf, tx);
|
||||
if (after_branch_point &&
|
||||
ds_prev->ds_phys->ds_next_clones_obj != 0) {
|
||||
VERIFY(0 == zap_remove_int(mos,
|
||||
VERIFY3U(0, ==, zap_remove_int(mos,
|
||||
ds_prev->ds_phys->ds_next_clones_obj, obj, tx));
|
||||
if (ds->ds_phys->ds_next_snap_obj != 0) {
|
||||
VERIFY(0 == zap_add_int(mos,
|
||||
@@ -1654,7 +1681,7 @@ dsl_dataset_destroy_sync(void *arg1, void *tag, cred_t *cr, dmu_tx_t *tx)
|
||||
err = traverse_dataset(ds, ds->ds_phys->ds_prev_snap_txg,
|
||||
TRAVERSE_POST, kill_blkptr, &ka);
|
||||
ASSERT3U(err, ==, 0);
|
||||
ASSERT(spa_version(dp->dp_spa) < SPA_VERSION_UNIQUE_ACCURATE ||
|
||||
ASSERT(!DS_UNIQUE_IS_ACCURATE(ds) ||
|
||||
ds->ds_phys->ds_unique_bytes == 0);
|
||||
}
|
||||
|
||||
@@ -2583,7 +2610,7 @@ snaplist_destroy(list_t *l, boolean_t own)
|
||||
{
|
||||
struct promotenode *snap;
|
||||
|
||||
if (!list_link_active(&l->list_head))
|
||||
if (!l || !list_link_active(&l->list_head))
|
||||
return;
|
||||
|
||||
while ((snap = list_tail(l)) != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user