summaryrefslogtreecommitdiffstats
path: root/cddl
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2014-08-10 05:58:41 +0000
committerdelphij <delphij@FreeBSD.org>2014-08-10 05:58:41 +0000
commitc14fd95fbce4723cad57b71f8e79384531937540 (patch)
treed685c6db2bb9a4d6c9e7e85215db5e682b38276d /cddl
parent33ac232e589b350c7979e97a5f080b8939dcc19f (diff)
downloadFreeBSD-src-c14fd95fbce4723cad57b71f8e79384531937540.zip
FreeBSD-src-c14fd95fbce4723cad57b71f8e79384531937540.tar.gz
MFC r269118: MFV r269010:
Import Illumos changes to address the following Illumos issues: 4976 zfs should only avoid writing to a failing non-redundant top-level vdev 4978 ztest fails in get_metaslab_refcount() 4979 extend free space histogram to device and pool 4980 metaslabs should have a fragmentation metric 4981 remove fragmented ops vector from block allocator 4982 space_map object should proactively upgrade when feature is enabled 4984 device selection should use fragmentation metric
Diffstat (limited to 'cddl')
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.817
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.c79
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool.864
-rw-r--r--cddl/contrib/opensolaris/cmd/zpool/zpool_main.c17
-rw-r--r--cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c8
5 files changed, 144 insertions, 41 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.8 b/cddl/contrib/opensolaris/cmd/zdb/zdb.8
index 41b99ac..4ef437e 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.8
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.8
@@ -19,7 +19,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd July 1, 2014
+.Dd July 26, 2014
.Dt ZDB 8
.Os
.Sh NAME
@@ -27,11 +27,11 @@
.Nd Display zpool debugging and consistency information
.Sh SYNOPSIS
.Nm
-.Op Fl CumdibcsDvhLXFPA
+.Op Fl CumdibcsDvhLMXFPA
.Op Fl e Op Fl p Ar path...
.Op Fl t Ar txg
.Op Fl U Ar cache
-.Op Fl M Ar inflight I/Os
+.Op Fl I Ar inflight I/Os
.Op Fl x Ar dumpdir
.Ar poolname
.Op Ar object ...
@@ -42,7 +42,7 @@
.Ar dataset
.Op Ar object ...
.Nm
-.Fl m Op Fl LXFPA
+.Fl m Op Fl MLXFPA
.Op Fl t Ar txg
.Op Fl e Op Fl p Ar path...
.Op Fl U Ar cache
@@ -155,6 +155,13 @@ By default,
verifies that all non-free blocks are referenced, which can be very expensive.
.It Fl m
Display the offset, spacemap, and free space of each metaslab.
+When specified twice, also display information about the on-disk free
+space histogram associated with each metaslab. When specified three time,
+display the maximum contiguous free space, the in-core free space histogram,
+and the percentage of free space in each space map. When specified
+four times display every spacemap record.
+.It Fl M
+Display the offset, spacemap, and free space of each metaslab.
When specified twice, also display information about the maximum contiguous
free space and the percentage of free space in each space map.
When specified three times display every spacemap record.
@@ -229,7 +236,7 @@ all metadata on the pool.
.It Fl F
Attempt to make an unreadable pool readable by trying progressively older
transactions.
-.It Fl M Ar inflight I/Os
+.It Fl I Ar inflight I/Os
Limit the number of outstanding checksum I/Os to the specified value.
The default value is 200. This option affects the performance of the
.Fl c
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
index 37c5aee..04970fc 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -111,11 +111,11 @@ static void
usage(void)
{
(void) fprintf(stderr,
- "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] "
- "[-U config] [-M inflight I/Os] [-x dumpdir] poolname [object...]\n"
+ "Usage: %s [-CumMdibcsDvhLXFPA] [-t txg] [-e [-p path...]] "
+ "[-U config] [-I inflight I/Os] [-x dumpdir] poolname [object...]\n"
" %s [-divPA] [-e -p path...] [-U config] dataset "
"[object...]\n"
- " %s -m [-LXFPA] [-t txg] [-e [-p path...]] [-U config] "
+ " %s -mM [-LXFPA] [-t txg] [-e [-p path...]] [-U config] "
"poolname [vdev [metaslab...]]\n"
" %s -R [-A] [-e [-p path...]] poolname "
"vdev:offset:size[:flags]\n"
@@ -138,6 +138,7 @@ usage(void)
(void) fprintf(stderr, " -h pool history\n");
(void) fprintf(stderr, " -b block statistics\n");
(void) fprintf(stderr, " -m metaslabs\n");
+ (void) fprintf(stderr, " -M metaslab groups\n");
(void) fprintf(stderr, " -c checksum all metadata (twice for "
"all data) blocks\n");
(void) fprintf(stderr, " -s report stats on zdb's I/O\n");
@@ -168,7 +169,7 @@ usage(void)
(void) fprintf(stderr, " -P print numbers in parseable form\n");
(void) fprintf(stderr, " -t <txg> -- highest txg to use when "
"searching for uberblocks\n");
- (void) fprintf(stderr, " -M <number of inflight I/Os> -- "
+ (void) fprintf(stderr, " -I <number of inflight I/Os> -- "
"specify the maximum number of "
"checksumming I/Os [default is 200]\n");
(void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
@@ -548,7 +549,7 @@ get_metaslab_refcount(vdev_t *vd)
{
int refcount = 0;
- if (vd->vdev_top == vd) {
+ if (vd->vdev_top == vd && !vd->vdev_removing) {
for (int m = 0; m < vd->vdev_ms_count; m++) {
space_map_t *sm = vd->vdev_ms[m]->ms_sm;
@@ -686,9 +687,10 @@ dump_metaslab(metaslab_t *msp)
* The space map histogram represents free space in chunks
* of sm_shift (i.e. bucket 0 refers to 2^sm_shift).
*/
- (void) printf("\tOn-disk histogram:\n");
+ (void) printf("\tOn-disk histogram:\t\tfragmentation %llu\n",
+ (u_longlong_t)msp->ms_fragmentation);
dump_histogram(sm->sm_phys->smp_histogram,
- SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift);
+ SPACE_MAP_HISTOGRAM_SIZE, sm->sm_shift);
}
if (dump_opt['d'] > 5 || dump_opt['m'] > 3) {
@@ -713,6 +715,47 @@ print_vdev_metaslab_header(vdev_t *vd)
}
static void
+dump_metaslab_groups(spa_t *spa)
+{
+ vdev_t *rvd = spa->spa_root_vdev;
+ metaslab_class_t *mc = spa_normal_class(spa);
+ uint64_t fragmentation;
+
+ metaslab_class_histogram_verify(mc);
+
+ for (int c = 0; c < rvd->vdev_children; c++) {
+ vdev_t *tvd = rvd->vdev_child[c];
+ metaslab_group_t *mg = tvd->vdev_mg;
+
+ if (mg->mg_class != mc)
+ continue;
+
+ metaslab_group_histogram_verify(mg);
+ mg->mg_fragmentation = metaslab_group_fragmentation(mg);
+
+ (void) printf("\tvdev %10llu\t\tmetaslabs%5llu\t\t"
+ "fragmentation",
+ (u_longlong_t)tvd->vdev_id,
+ (u_longlong_t)tvd->vdev_ms_count);
+ if (mg->mg_fragmentation == ZFS_FRAG_INVALID) {
+ (void) printf("%3s\n", "-");
+ } else {
+ (void) printf("%3llu%%\n",
+ (u_longlong_t)mg->mg_fragmentation);
+ }
+ dump_histogram(mg->mg_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0);
+ }
+
+ (void) printf("\tpool %s\tfragmentation", spa_name(spa));
+ fragmentation = metaslab_class_fragmentation(mc);
+ if (fragmentation == ZFS_FRAG_INVALID)
+ (void) printf("\t%3s\n", "-");
+ else
+ (void) printf("\t%3llu%%\n", (u_longlong_t)fragmentation);
+ dump_histogram(mc->mc_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0);
+}
+
+static void
dump_metaslabs(spa_t *spa)
{
vdev_t *vd, *rvd = spa->spa_root_vdev;
@@ -2369,8 +2412,7 @@ zdb_leak(void *arg, uint64_t start, uint64_t size)
}
static metaslab_ops_t zdb_metaslab_ops = {
- NULL, /* alloc */
- NULL /* fragmented */
+ NULL /* alloc */
};
static void
@@ -2865,6 +2907,8 @@ dump_zpool(spa_t *spa)
if (dump_opt['d'] > 2 || dump_opt['m'])
dump_metaslabs(spa);
+ if (dump_opt['M'])
+ dump_metaslab_groups(spa);
if (dump_opt['d'] || dump_opt['i']) {
dump_dir(dp->dp_meta_objset);
@@ -3360,7 +3404,7 @@ main(int argc, char **argv)
dprintf_setup(&argc, argv);
while ((c = getopt(argc, argv,
- "bcdhilmM:suCDRSAFLXx:evp:t:U:P")) != -1) {
+ "bcdhilmMI:suCDRSAFLXx:evp:t:U:P")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -3373,6 +3417,7 @@ main(int argc, char **argv)
case 'u':
case 'C':
case 'D':
+ case 'M':
case 'R':
case 'S':
dump_opt[c]++;
@@ -3386,10 +3431,7 @@ main(int argc, char **argv)
case 'P':
dump_opt[c]++;
break;
- case 'v':
- verbose++;
- break;
- case 'M':
+ case 'I':
max_inflight = strtoull(optarg, NULL, 0);
if (max_inflight == 0) {
(void) fprintf(stderr, "maximum number "
@@ -3413,9 +3455,6 @@ main(int argc, char **argv)
}
searchdirs[nsearch++] = optarg;
break;
- case 'x':
- vn_dumpdir = optarg;
- break;
case 't':
max_txg = strtoull(optarg, NULL, 0);
if (max_txg < TXG_INITIAL) {
@@ -3427,6 +3466,12 @@ main(int argc, char **argv)
case 'U':
spa_config_path = optarg;
break;
+ case 'v':
+ verbose++;
+ break;
+ case 'x':
+ vn_dumpdir = optarg;
+ break;
default:
usage();
break;
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool.8 b/cddl/contrib/opensolaris/cmd/zpool/zpool.8
index b69aef9..44d92b0 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool.8
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool.8
@@ -21,12 +21,12 @@
.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
.\" Copyright (c) 2011, Justin T. Gibbs <gibbs@FreeBSD.org>
-.\" Copyright (c) 2012 by Delphix. All Rights Reserved.
+.\" Copyright (c) 2013 by Delphix. All Rights Reserved.
.\" Copyright (c) 2012, Glen Barber <gjb@FreeBSD.org>
.\"
.\" $FreeBSD$
.\"
-.Dd July 25, 2014
+.Dd July 26, 2014
.Dt ZPOOL 8
.Os
.Sh NAME
@@ -543,6 +543,15 @@ For example, a
value of 1.76 indicates that 1.76 units of data were stored but only 1 unit of disk space was actually consumed. See
.Xr zfs 8
for a description of the deduplication feature.
+.It Sy expandsize
+Amount of uninitialized space within the pool or device that can be used to
+increase the total capacity of the pool.
+Uninitialized space consists of
+any space on an EFI labeled vdev which has not been brought online
+.Pq i.e. zpool online -e .
+This space occurs when a LUN is dynamically expanded.
+.It Sy fragmentation
+The amount of fragmentation in the pool.
.It Sy free
Number of blocks within the pool that are not allocated.
.It Sy freeing
@@ -555,13 +564,6 @@ Over time
will decrease while
.Sy free
increases.
-.It Sy expandsize
-Amount of uninitialized space within the pool or device that can be used to
-increase the total capacity of the pool.
-Uninitialized space consists of
-any space on an EFI labeled vdev which has not been brought online
-.Pq i.e. zpool online -e .
-This space occurs when a LUN is dynamically expanded.
.It Sy guid
A unique identifier for the pool.
.It Sy health
@@ -1408,6 +1410,7 @@ section for a list of valid properties. The default list is
.Sy size ,
.Sy used ,
.Sy available ,
+.Sy fragmentation ,
.Sy expandsize ,
.Sy capacity ,
.Sy health ,
@@ -1794,9 +1797,9 @@ is immediately available to any datasets within the pool.
The following command lists all available pools on the system.
.Bd -literal -offset 2n
.Li # Ic zpool list
-NAME SIZE ALLOC FREE EXPANDSZ CAP DEDUP HEALTH ALTROOT
-pool 2.70T 473G 2.24T - 17% 1.00x ONLINE -
-test 1.98G 89.5K 1.98G - 0% 1.00x ONLINE -
+NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
+pool 2.70T 473G 2.24T 33% - 17% 1.00x ONLINE -
+test 1.98G 89.5K 1.98G 48% - 0% 1.00x ONLINE -
.Ed
.It Sy Example 7 No Listing All Properties for a Pool
.Pp
@@ -1924,7 +1927,35 @@ subcommand as follows:
.Bd -literal -offset 2n
.Li # Ic zpool iostat -v pool 5
.Ed
-.It Sy Example 15 No Removing a Mirrored Log Device
+.It Xo
+.Sy Example 15
+Displaying expanded space on a device
+.Xc
+.Pp
+The following command dipslays the detailed information for the
+.Em data
+pool.
+This pool is comprised of a single
+.Em raidz
+vdev where one of its
+devices increased its capacity by 10GB.
+In this example, the pool will not
+be able to utilized this extra capacity until all the devices under the
+.Em raidz
+vdev have been expanded.
+.Bd -literal -offset 2n
+.Li # Ic zpool list -v data
+NAME SIZE ALLOC FREE FRAG EXPANDSZ CAP DEDUP HEALTH ALTROOT
+data 23.9G 14.6G 9.30G 48% - 61% 1.00x ONLINE -
+ raidz1 23.9G 14.6G 9.30G 48% -
+ ada0 - - - - -
+ ada1 - - - - 10G
+ ada2 - - - - -
+.Ed
+.It Xo
+.Sy Example 16
+Removing a Mirrored Log Device
+.Xc
.Pp
The following command removes the mirrored log device
.Em mirror-2 .
@@ -1956,7 +1987,12 @@ is:
.Bd -literal -offset 2n
.Li # Ic zpool remove tank mirror-2
.Ed
-.It Sy Example 16 No Recovering a Faulted Tn ZFS No Pool
+.It Xo
+.Sy Example 17
+Recovering a Faulted
+.Tn ZFS
+Pool
+.Xc
.Pp
If a pool is faulted but recoverable, a message indicating this state is
provided by
diff --git a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
index 74e07f1..fe73169 100644
--- a/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
+++ b/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
@@ -2900,10 +2900,15 @@ print_one_column(zpool_prop_t prop, uint64_t value, boolean_t scripted)
boolean_t fixed;
size_t width = zprop_width(prop, &fixed, ZFS_TYPE_POOL);
- zfs_nicenum(value, propval, sizeof (propval));
if (prop == ZPOOL_PROP_EXPANDSZ && value == 0)
(void) strlcpy(propval, "-", sizeof (propval));
+ else if (prop == ZPOOL_PROP_FRAGMENTATION && value == ZFS_FRAG_INVALID)
+ (void) strlcpy(propval, "-", sizeof (propval));
+ else if (prop == ZPOOL_PROP_FRAGMENTATION)
+ (void) snprintf(propval, sizeof (propval), "%llu%%", value);
+ else
+ zfs_nicenum(value, propval, sizeof (propval));
if (scripted)
(void) printf("\t%s", propval);
@@ -2936,9 +2941,9 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
/* only toplevel vdevs have capacity stats */
if (vs->vs_space == 0) {
if (scripted)
- (void) printf("\t-\t-\t-");
+ (void) printf("\t-\t-\t-\t-");
else
- (void) printf(" - - -");
+ (void) printf(" - - - -");
} else {
print_one_column(ZPOOL_PROP_SIZE, vs->vs_space,
scripted);
@@ -2946,6 +2951,8 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
scripted);
print_one_column(ZPOOL_PROP_FREE,
vs->vs_space - vs->vs_alloc, scripted);
+ print_one_column(ZPOOL_PROP_FRAGMENTATION,
+ vs->vs_fragmentation, scripted);
}
print_one_column(ZPOOL_PROP_EXPANDSZ, vs->vs_esize,
scripted);
@@ -3031,8 +3038,8 @@ zpool_do_list(int argc, char **argv)
int ret;
list_cbdata_t cb = { 0 };
static char default_props[] =
- "name,size,allocated,free,expandsize,capacity,dedupratio,"
- "health,altroot";
+ "name,size,allocated,free,fragmentation,expandsize,capacity,"
+ "dedupratio,health,altroot";
char *props = default_props;
unsigned long interval = 0, count = 0;
zpool_list_t *list;
diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
index f6e84f8..30b2d87 100644
--- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
+++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
@@ -322,6 +322,14 @@ zpool_get_prop(zpool_handle_t *zhp, zpool_prop_t prop, char *buf, size_t len,
(u_longlong_t)intval);
}
break;
+ case ZPOOL_PROP_FRAGMENTATION:
+ if (intval == UINT64_MAX) {
+ (void) strlcpy(buf, "-", len);
+ } else {
+ (void) snprintf(buf, len, "%llu%%",
+ (u_longlong_t)intval);
+ }
+ break;
case ZPOOL_PROP_DEDUPRATIO:
(void) snprintf(buf, len, "%llu.%02llux",
OpenPOWER on IntegriCloud