mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
2619 asynchronous destruction of ZFS file systems 2747 SPA versioning with zfs feature flags Reviewed by: Matt Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <gwilson@delphix.com> Reviewed by: Richard Lowe <richlowe@richlowe.net> Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com> Approved by: Eric Schrock <Eric.Schrock@delphix.com> References: illumos/illumos-gate@53089ab7c8 illumos/illumos-gate@ad135b5d64 illumos changeset: 13700:2889e2596bd6 https://www.illumos.org/issues/2619 https://www.illumos.org/issues/2747 NOTE: The grub specific changes were not ported. This change must be made to the Linux grub packages. Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
committed by
Brian Behlendorf
parent
15313c5e18
commit
9ae529ec5d
+65
-7
@@ -18,8 +18,10 @@
|
||||
*
|
||||
* CDDL HEADER END
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012 by Delphix. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -54,6 +56,7 @@
|
||||
#include <sys/zfs_fuid.h>
|
||||
#include <sys/arc.h>
|
||||
#include <sys/ddt.h>
|
||||
#include <sys/zfeature.h>
|
||||
#undef ZFS_MAXNAMELEN
|
||||
#include <libzfs.h>
|
||||
|
||||
@@ -62,7 +65,8 @@
|
||||
#define ZDB_CHECKSUM_NAME(idx) ((idx) < ZIO_CHECKSUM_FUNCTIONS ? \
|
||||
zio_checksum_table[(idx)].ci_name : "UNKNOWN")
|
||||
#define ZDB_OT_NAME(idx) ((idx) < DMU_OT_NUMTYPES ? \
|
||||
dmu_ot[(idx)].ot_name : "UNKNOWN")
|
||||
dmu_ot[(idx)].ot_name : DMU_OT_IS_VALID(idx) ? \
|
||||
dmu_ot_byteswap[DMU_OT_BYTESWAP(idx)].ob_name : "UNKNOWN")
|
||||
#define ZDB_OT_TYPE(idx) ((idx) < DMU_OT_NUMTYPES ? (idx) : DMU_OT_NUMTYPES)
|
||||
|
||||
#ifndef lint
|
||||
@@ -1099,7 +1103,7 @@ dump_dsl_dataset(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
|
||||
ASSERT(size == sizeof (*ds));
|
||||
crtime = ds->ds_creation_time;
|
||||
zdb_nicenum(ds->ds_used_bytes, used);
|
||||
zdb_nicenum(ds->ds_referenced_bytes, used);
|
||||
zdb_nicenum(ds->ds_compressed_bytes, compressed);
|
||||
zdb_nicenum(ds->ds_uncompressed_bytes, uncompressed);
|
||||
zdb_nicenum(ds->ds_unique_bytes, unique);
|
||||
@@ -1141,6 +1145,44 @@ dump_dsl_dataset(objset_t *os, uint64_t object, void *data, size_t size)
|
||||
(void) printf("\t\tbp = %s\n", blkbuf);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
dump_bptree_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
{
|
||||
char blkbuf[BP_SPRINTF_LEN];
|
||||
|
||||
if (bp->blk_birth != 0) {
|
||||
sprintf_blkptr(blkbuf, bp);
|
||||
(void) printf("\t%s\n", blkbuf);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
dump_bptree(objset_t *os, uint64_t obj, char *name)
|
||||
{
|
||||
char bytes[32];
|
||||
bptree_phys_t *bt;
|
||||
dmu_buf_t *db;
|
||||
|
||||
if (dump_opt['d'] < 3)
|
||||
return;
|
||||
|
||||
VERIFY3U(0, ==, dmu_bonus_hold(os, obj, FTAG, &db));
|
||||
bt = db->db_data;
|
||||
zdb_nicenum(bt->bt_bytes, bytes);
|
||||
(void) printf("\n %s: %llu datasets, %s\n",
|
||||
name, (unsigned long long)(bt->bt_end - bt->bt_begin), bytes);
|
||||
dmu_buf_rele(db, FTAG);
|
||||
|
||||
if (dump_opt['d'] < 5)
|
||||
return;
|
||||
|
||||
(void) printf("\n");
|
||||
|
||||
(void) bptree_iterate(os, obj, B_FALSE, dump_bptree_cb, NULL, NULL);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
dump_bpobj_cb(void *arg, const blkptr_t *bp, dmu_tx_t *tx)
|
||||
@@ -1888,11 +1930,13 @@ typedef struct zdb_blkstats {
|
||||
*/
|
||||
#define ZDB_OT_DEFERRED (DMU_OT_NUMTYPES + 0)
|
||||
#define ZDB_OT_DITTO (DMU_OT_NUMTYPES + 1)
|
||||
#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 2)
|
||||
#define ZDB_OT_OTHER (DMU_OT_NUMTYPES + 2)
|
||||
#define ZDB_OT_TOTAL (DMU_OT_NUMTYPES + 3)
|
||||
|
||||
static char *zdb_ot_extname[] = {
|
||||
"deferred free",
|
||||
"dedup ditto",
|
||||
"other",
|
||||
"Total",
|
||||
};
|
||||
|
||||
@@ -1974,9 +2018,10 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp, arc_buf_t *pbuf,
|
||||
|
||||
type = BP_GET_TYPE(bp);
|
||||
|
||||
zdb_count_block(zcb, zilog, bp, type);
|
||||
zdb_count_block(zcb, zilog, bp,
|
||||
(type & DMU_OT_NEWTYPE) ? ZDB_OT_OTHER : type);
|
||||
|
||||
is_metadata = (BP_GET_LEVEL(bp) != 0 || dmu_ot[type].ot_metadata);
|
||||
is_metadata = (BP_GET_LEVEL(bp) != 0 || DMU_OT_IS_METADATA(type));
|
||||
|
||||
if (dump_opt['c'] > 1 || (dump_opt['c'] && is_metadata)) {
|
||||
int ioerr;
|
||||
@@ -2207,6 +2252,12 @@ dump_block_stats(spa_t *spa)
|
||||
count_block_cb, &zcb, NULL);
|
||||
(void) bpobj_iterate_nofree(&spa->spa_dsl_pool->dp_free_bpobj,
|
||||
count_block_cb, &zcb, NULL);
|
||||
if (spa_feature_is_active(spa,
|
||||
&spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
|
||||
VERIFY3U(0, ==, bptree_iterate(spa->spa_meta_objset,
|
||||
spa->spa_dsl_pool->dp_bptree_obj, B_FALSE, count_block_cb,
|
||||
&zcb, NULL));
|
||||
}
|
||||
|
||||
if (dump_opt['c'] > 1)
|
||||
flags |= TRAVERSE_PREFETCH_DATA;
|
||||
@@ -2383,7 +2434,7 @@ zdb_ddt_add_cb(spa_t *spa, zilog_t *zilog, const blkptr_t *bp,
|
||||
}
|
||||
|
||||
if (BP_IS_HOLE(bp) || BP_GET_CHECKSUM(bp) == ZIO_CHECKSUM_OFF ||
|
||||
BP_GET_LEVEL(bp) > 0 || dmu_ot[BP_GET_TYPE(bp)].ot_metadata)
|
||||
BP_GET_LEVEL(bp) > 0 || DMU_OT_IS_METADATA(BP_GET_TYPE(bp)))
|
||||
return (0);
|
||||
|
||||
ddt_key_fill(&zdde_search.zdde_key, bp);
|
||||
@@ -2491,7 +2542,14 @@ dump_zpool(spa_t *spa)
|
||||
dump_bpobj(&spa->spa_deferred_bpobj, "Deferred frees");
|
||||
if (spa_version(spa) >= SPA_VERSION_DEADLISTS) {
|
||||
dump_bpobj(&spa->spa_dsl_pool->dp_free_bpobj,
|
||||
"Pool frees");
|
||||
"Pool snapshot frees");
|
||||
}
|
||||
|
||||
if (spa_feature_is_active(spa,
|
||||
&spa_feature_table[SPA_FEATURE_ASYNC_DESTROY])) {
|
||||
dump_bptree(spa->spa_meta_objset,
|
||||
spa->spa_dsl_pool->dp_bptree_obj,
|
||||
"Pool dataset frees");
|
||||
}
|
||||
dump_dtl(spa->spa_root_vdev, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user