Permalink
Browse files

OpenZFS 7614, 9064 - zfs device evacuation/removal

OpenZFS 7614 - zfs device evacuation/removal
OpenZFS 9064 - remove_mirror should wait for device removal to complete

This project allows top-level vdevs to be removed from the storage pool
with "zpool remove", reducing the total amount of storage in the pool.
This operation copies all allocated regions of the device to be removed
onto other devices, recording the mapping from old to new location.
After the removal is complete, read and free operations to the removed
(now "indirect") vdev must be remapped and performed at the new location
on disk.  The indirect mapping table is kept in memory whenever the pool
is loaded, so there is minimal performance overhead when doing operations
on the indirect vdev.

The size of the in-memory mapping table will be reduced when its entries
become "obsolete" because they are no longer used by any block pointers
in the pool.  An entry becomes obsolete when all the blocks that use
it are freed.  An entry can also become obsolete when all the snapshots
that reference it are deleted, and the block pointers that reference it
have been "remapped" in all filesystems/zvols (and clones).  Whenever an
indirect block is written, all the block pointers in it will be "remapped"
to their new (concrete) locations if possible.  This process can be
accelerated by using the "zfs remap" command to proactively rewrite all
indirect blocks that reference indirect (removed) vdevs.

Note that when a device is removed, we do not verify the checksum of
the data that is copied.  This makes the process much faster, but if it
were used on redundant vdevs (i.e. mirror or raidz vdevs), it would be
possible to copy the wrong data, when we have the correct data on e.g.
the other side of the mirror.

At the moment, only mirrors and simple top-level vdevs can be removed
and no removal is allowed if any of the top-level vdevs are raidz.

Porting Notes:

* Avoid zero-sized kmem_alloc() in vdev_compact_children().

    The device evacuation code adds a dependency that
    vdev_compact_children() be able to properly empty the vdev_child
    array by setting it to NULL and zeroing vdev_children.  Under Linux,
    kmem_alloc() and related functions return a sentinel pointer rather
    than NULL for zero-sized allocations.

* Remove comment regarding "mpt" driver where zfs_remove_max_segment
  is initialized to SPA_MAXBLOCKSIZE.

  Change zfs_condense_indirect_commit_entry_delay_ticks to
  zfs_condense_indirect_commit_entry_delay_ms for consistency with
  most other tunables in which delays are specified in ms.

* ZTS changes:

    Use set_tunable rather than mdb
    Use zpool sync as appropriate
    Use sync_pool instead of sync
    Kill jobs during test_removal_with_operation to allow unmount/export
    Don't add non-disk names such as "mirror" or "raidz" to $DISKS
    Use $TEST_BASE_DIR instead of /tmp
    Increase HZ from 100 to 1000 which is more common on Linux

    removal_multiple_indirection.ksh
        Reduce iterations in order to not time out on the code
        coverage builders.

    removal_resume_export:
        Functionally, the test case is correct but there exists a race
        where the kernel thread hasn't been fully started yet and is
        not visible.  Wait for up to 1 second for the removal thread
        to be started before giving up on it.  Also, increase the
        amount of data copied in order that the removal not finish
        before the export has a chance to fail.

* MMP compatibility, the concept of concrete versus non-concrete devices
  has slightly changed the semantics of vdev_writeable().  Update
  mmp_random_leaf_impl() accordingly.

* Updated dbuf_remap() to handle the org.zfsonlinux:large_dnode pool
  feature which is not supported by OpenZFS.

* Added support for new vdev removal tracepoints.

* Test cases removal_with_zdb and removal_condense_export have been
  intentionally disabled.  When run manually they pass as intended,
  but when running in the automated test environment they produce
  unreliable results on the latest Fedora release.

  They may work better once the upstream pool import refectoring is
  merged into ZoL at which point they will be re-enabled.

Authored by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Alex Reece <alex@delphix.com>
Reviewed-by: George Wilson <george.wilson@delphix.com>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Richard Laager <rlaager@wiktel.com>
Reviewed by: Tim Chase <tim@chase2k.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Approved by: Garrett D'Amore <garrett@damore.org>
Ported-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Tim Chase <tim@chase2k.com>

OpenZFS-issue: https://www.illumos.org/issues/7614
OpenZFS-commit: openzfs/openzfs@f539f1e
Closes #6900
  • Loading branch information...
ahrens authored and behlendorf committed Sep 22, 2016
1 parent 4b0f5b2 commit a1d477c24c7badc89c60955995fd84d311938486
Showing with 9,862 additions and 912 deletions.
  1. +632 −62 cmd/zdb/zdb.c
  2. +24 −1 cmd/zfs/zfs_main.c
  3. +193 −14 cmd/zpool/zpool_main.c
  4. +81 −10 cmd/ztest/ztest.c
  5. +1 −0 configure.ac
  6. +6 −1 include/libzfs.h
  7. +1 −0 include/libzfs_core.h
  8. +4 −0 include/sys/Makefile.am
  9. +3 −1 include/sys/bpobj.h
  10. +2 −0 include/sys/dbuf.h
  11. +9 −2 include/sys/dmu.h
  12. +1 −0 include/sys/dnode.h
  13. +30 −0 include/sys/dsl_dataset.h
  14. +2 −0 include/sys/dsl_deadlist.h
  15. +2 −1 include/sys/dsl_deleg.h
  16. +4 −1 include/sys/dsl_dir.h
  17. +4 −1 include/sys/dsl_pool.h
  18. +2 −1 include/sys/dsl_scan.h
  19. +31 −1 include/sys/fs/zfs.h
  20. +7 −0 include/sys/metaslab.h
  21. +8 −8 include/sys/metaslab_impl.h
  22. +7 −6 include/sys/range_tree.h
  23. +12 −3 include/sys/spa.h
  24. +73 −1 include/sys/spa_impl.h
  25. +10 −3 include/sys/space_map.h
  26. +119 −0 include/sys/trace_vdev.h
  27. +7 −2 include/sys/vdev.h
  28. +94 −1 include/sys/vdev_impl.h
  29. +80 −0 include/sys/vdev_indirect_births.h
  30. +141 −0 include/sys/vdev_indirect_mapping.h
  31. +93 −0 include/sys/vdev_removal.h
  32. +2 −1 include/sys/zfs_debug.h
  33. +1 −1 include/sys/zil.h
  34. +4 −1 include/sys/zio.h
  35. +1 −0 include/sys/zio_priority.h
  36. +2 −0 include/zfeature_common.h
  37. +2 −1 include/zfs_deleg.h
  38. +18 −0 lib/libzfs/libzfs_dataset.c
  39. +92 −19 lib/libzfs/libzfs_pool.c
  40. +8 −0 lib/libzfs/libzfs_util.c
  41. +10 −0 lib/libzfs_core/libzfs_core.c
  42. +9 −5 lib/libzpool/Makefile.am
  43. +1 −1 man/man5/zfs-module-parameters.5
  44. +43 −1 man/man5/zpool-features.5
  45. +13 −0 man/man8/zfs.8
  46. +59 −12 man/man8/zpool.8
  47. +16 −0 module/zcommon/zfeature_common.c
  48. +2 −1 module/zcommon/zfs_deleg.c
  49. +3 −1 module/zcommon/zfs_prop.c
  50. +4 −0 module/zfs/Makefile.in
  51. +1 −1 module/zfs/arc.c
  52. +19 −9 module/zfs/bpobj.c
  53. +139 −0 module/zfs/dbuf.c
  54. +4 −4 module/zfs/ddt.c
  55. +124 −0 module/zfs/dmu.c
  56. +111 −0 module/zfs/dmu_objset.c
  57. +17 −0 module/zfs/dmu_tx.c
  58. +10 −0 module/zfs/dmu_zfetch.c
  59. +1 −2 module/zfs/dnode.c
  60. +212 −17 module/zfs/dsl_dataset.c
  61. +15 −2 module/zfs/dsl_deadlist.c
  62. +50 −2 module/zfs/dsl_destroy.c
  63. +51 −1 module/zfs/dsl_dir.c
  64. +55 −9 module/zfs/dsl_pool.c
  65. +64 −23 module/zfs/dsl_scan.c
  66. +520 −119 module/zfs/metaslab.c
  67. +7 −6 module/zfs/mmp.c
  68. +7 −34 module/zfs/range_tree.c
  69. +257 −338 module/zfs/spa.c
  70. +6 −5 module/zfs/spa_config.c
  71. +77 −5 module/zfs/spa_misc.c
  72. +77 −59 module/zfs/space_map.c
  73. +0 −4 module/zfs/space_reftree.c
  74. +1 −0 module/zfs/trace.c
  75. +2 −0 module/zfs/txg.c
  76. +268 −82 module/zfs/vdev.c
  77. +1 −0 module/zfs/vdev_disk.c
  78. +2 −0 module/zfs/vdev_file.c
  79. +1,064 −0 module/zfs/vdev_indirect.c
  80. +226 −0 module/zfs/vdev_indirect_births.c
  81. +616 −0 module/zfs/vdev_indirect_mapping.c
  82. +83 −6 module/zfs/vdev_label.c
  83. +3 −0 module/zfs/vdev_mirror.c
  84. +2 −0 module/zfs/vdev_missing.c
  85. +14 −4 module/zfs/vdev_queue.c
  86. +1 −0 module/zfs/vdev_raidz.c
  87. +1,925 −0 module/zfs/vdev_removal.c
  88. +2 −1 module/zfs/vdev_root.c
  89. +32 −4 module/zfs/zfs_ioctl.c
  90. +12 −0 module/zfs/zfs_vnops.c
  91. +1 −2 module/zfs/zil.c
  92. +41 −5 module/zfs/zio.c
  93. +14 −0 tests/runfiles/linux.run
  94. +57 −0 tests/zfs-tests/include/libtest.shlib
  95. +1 −0 tests/zfs-tests/tests/functional/Makefile.am
  96. +4 −0 tests/zfs-tests/tests/functional/bootfs/bootfs_001_pos.ksh
  97. +4 −0 tests/zfs-tests/tests/functional/bootfs/bootfs_002_neg.ksh
  98. +3 −1 tests/zfs-tests/tests/functional/cli_root/zpool_get/zpool_get.cfg
  99. +18 −3 tests/zfs-tests/tests/functional/features/async_destroy/async_destroy_001_pos.ksh
  100. +32 −0 tests/zfs-tests/tests/functional/removal/Makefile.am
  101. +23 −0 tests/zfs-tests/tests/functional/removal/cleanup.ksh
  102. +158 −0 tests/zfs-tests/tests/functional/removal/removal.kshlib
  103. +39 −0 tests/zfs-tests/tests/functional/removal/removal_all_vdev.ksh
  104. +44 −0 tests/zfs-tests/tests/functional/removal/removal_check_space.ksh
  105. +90 −0 tests/zfs-tests/tests/functional/removal/removal_condense_export.ksh
  106. +93 −0 tests/zfs-tests/tests/functional/removal/removal_multiple_indirection.ksh
  107. +123 −0 tests/zfs-tests/tests/functional/removal/removal_remap.ksh
  108. +77 −0 tests/zfs-tests/tests/functional/removal/removal_remap_deadlists.ksh
  109. +68 −0 tests/zfs-tests/tests/functional/removal/removal_reservation.ksh
  110. +134 −0 tests/zfs-tests/tests/functional/removal/removal_resume_export.ksh
  111. +39 −0 tests/zfs-tests/tests/functional/removal/removal_sanity.ksh
  112. +52 −0 tests/zfs-tests/tests/functional/removal/removal_with_add.ksh
  113. +39 −0 tests/zfs-tests/tests/functional/removal/removal_with_create_fs.ksh
  114. +49 −0 tests/zfs-tests/tests/functional/removal/removal_with_dedup.ksh
  115. +50 −0 tests/zfs-tests/tests/functional/removal/removal_with_export.ksh
  116. +47 −0 tests/zfs-tests/tests/functional/removal/removal_with_ganging.ksh
  117. +38 −0 tests/zfs-tests/tests/functional/removal/removal_with_remap.ksh
  118. +38 −0 tests/zfs-tests/tests/functional/removal/removal_with_remove.ksh
  119. +38 −0 tests/zfs-tests/tests/functional/removal/removal_with_scrub.ksh
  120. +40 −0 tests/zfs-tests/tests/functional/removal/removal_with_send.ksh
  121. +41 −0 tests/zfs-tests/tests/functional/removal/removal_with_send_recv.ksh
  122. +39 −0 tests/zfs-tests/tests/functional/removal/removal_with_snapshot.ksh
  123. +34 −0 tests/zfs-tests/tests/functional/removal/removal_with_write.ksh
  124. +78 −0 tests/zfs-tests/tests/functional/removal/removal_with_zdb.ksh
  125. +57 −0 tests/zfs-tests/tests/functional/removal/remove_mirror.ksh
  126. +58 −0 tests/zfs-tests/tests/functional/removal/remove_mirror_sanity.ksh
  127. +50 −0 tests/zfs-tests/tests/functional/removal/remove_raidz.ksh
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -111,6 +111,7 @@ static int zfs_do_release(int argc, char **argv);
static int zfs_do_diff(int argc, char **argv);
static int zfs_do_bookmark(int argc, char **argv);
static int zfs_do_channel_program(int argc, char **argv);
static int zfs_do_remap(int argc, char **argv);
static int zfs_do_load_key(int argc, char **argv);
static int zfs_do_unload_key(int argc, char **argv);
static int zfs_do_change_key(int argc, char **argv);
@@ -163,6 +164,7 @@ typedef enum {
HELP_HOLDS,
HELP_RELEASE,
HELP_DIFF,
HELP_REMAP,
HELP_BOOKMARK,
HELP_CHANNEL_PROGRAM,
HELP_LOAD_KEY,
@@ -226,6 +228,7 @@ static zfs_command_t command_table[] = {
{ "holds", zfs_do_holds, HELP_HOLDS },
{ "release", zfs_do_release, HELP_RELEASE },
{ "diff", zfs_do_diff, HELP_DIFF },
{ "remap", zfs_do_remap, HELP_REMAP },
{ "load-key", zfs_do_load_key, HELP_LOAD_KEY },
{ "unload-key", zfs_do_unload_key, HELP_UNLOAD_KEY },
{ "change-key", zfs_do_change_key, HELP_CHANGE_KEY },
@@ -356,6 +359,8 @@ get_usage(zfs_help_t idx)
case HELP_DIFF:
return (gettext("\tdiff [-FHt] <snapshot> "
"[snapshot|filesystem]\n"));
case HELP_REMAP:
return (gettext("\tremap <filesystem | volume>\n"));
case HELP_BOOKMARK:
return (gettext("\tbookmark <snapshot> <bookmark>\n"));
case HELP_CHANNEL_PROGRAM:
@@ -4363,6 +4368,7 @@ zfs_do_receive(int argc, char **argv)
#define ZFS_DELEG_PERM_RELEASE "release"
#define ZFS_DELEG_PERM_DIFF "diff"
#define ZFS_DELEG_PERM_BOOKMARK "bookmark"
#define ZFS_DELEG_PERM_REMAP "remap"
#define ZFS_DELEG_PERM_LOAD_KEY "load-key"
#define ZFS_DELEG_PERM_CHANGE_KEY "change-key"
@@ -4390,6 +4396,7 @@ static zfs_deleg_perm_tab_t zfs_deleg_perm_tbl[] = {
{ ZFS_DELEG_PERM_SHARE, ZFS_DELEG_NOTE_SHARE },
{ ZFS_DELEG_PERM_SNAPSHOT, ZFS_DELEG_NOTE_SNAPSHOT },
{ ZFS_DELEG_PERM_BOOKMARK, ZFS_DELEG_NOTE_BOOKMARK },
{ ZFS_DELEG_PERM_REMAP, ZFS_DELEG_NOTE_REMAP },
{ ZFS_DELEG_PERM_LOAD_KEY, ZFS_DELEG_NOTE_LOAD_KEY },
{ ZFS_DELEG_PERM_CHANGE_KEY, ZFS_DELEG_NOTE_CHANGE_KEY },
@@ -7059,7 +7066,7 @@ zfs_do_diff(int argc, char **argv)
if (argc < 1) {
(void) fprintf(stderr,
gettext("must provide at least one snapshot name\n"));
gettext("must provide at least one snapshot name\n"));
usage(B_FALSE);
}
@@ -7101,6 +7108,22 @@ zfs_do_diff(int argc, char **argv)
return (err != 0);
}
static int
zfs_do_remap(int argc, char **argv)
{
const char *fsname;
int err = 0;
if (argc != 2) {
(void) fprintf(stderr, gettext("wrong number of arguments\n"));
usage(B_FALSE);
}
fsname = argv[1];
err = zfs_remap_indirects(g_zfs, fsname);
return (err);
}
/*
* zfs bookmark <fs@snap> <fs#bmark>
*
View
@@ -344,7 +344,7 @@ get_usage(zpool_help_t idx)
return (gettext("\treplace [-f] [-o property=value] "
"<pool> <device> [new-device]\n"));
case HELP_REMOVE:
return (gettext("\tremove <pool> <device> ...\n"));
return (gettext("\tremove [-nps] <pool> <device> ...\n"));
case HELP_REOPEN:
return (gettext("\treopen [-n] <pool>\n"));
case HELP_SCRUB:
@@ -782,37 +782,95 @@ zpool_do_add(int argc, char **argv)
/*
* zpool remove <pool> <vdev> ...
*
* Removes the given vdev from the pool. Currently, this supports removing
* spares, cache, and log devices from the pool.
* Removes the given vdev from the pool.
*/
int
zpool_do_remove(int argc, char **argv)
{
char *poolname;
int i, ret = 0;
zpool_handle_t *zhp = NULL;
boolean_t stop = B_FALSE;
char c;
boolean_t noop = B_FALSE;
boolean_t parsable = B_FALSE;
argc--;
argv++;
/* check options */
while ((c = getopt(argc, argv, "nps")) != -1) {
switch (c) {
case 'n':
noop = B_TRUE;
break;
case 'p':
parsable = B_TRUE;
break;
case 's':
stop = B_TRUE;
break;
case '?':
(void) fprintf(stderr, gettext("invalid option '%c'\n"),
optopt);
usage(B_FALSE);
}
}
argc -= optind;
argv += optind;
/* get pool name and check number of arguments */
if (argc < 1) {
(void) fprintf(stderr, gettext("missing pool name argument\n"));
usage(B_FALSE);
}
if (argc < 2) {
(void) fprintf(stderr, gettext("missing device\n"));
usage(B_FALSE);
}
poolname = argv[0];
if ((zhp = zpool_open(g_zfs, poolname)) == NULL)
return (1);
for (i = 1; i < argc; i++) {
if (zpool_vdev_remove(zhp, argv[i]) != 0)
if (stop && noop) {
(void) fprintf(stderr, gettext("stop request ignored\n"));
return (0);
}
if (stop) {
if (argc > 1) {
(void) fprintf(stderr, gettext("too many arguments\n"));
usage(B_FALSE);
}
if (zpool_vdev_remove_cancel(zhp) != 0)
ret = 1;
} else {
if (argc < 2) {
(void) fprintf(stderr, gettext("missing device\n"));
usage(B_FALSE);
}
for (i = 1; i < argc; i++) {
if (noop) {
uint64_t size;
if (zpool_vdev_indirect_size(zhp, argv[i],
&size) != 0) {
ret = 1;
break;
}
if (parsable) {
(void) printf("%s %llu\n",
argv[i], (unsigned long long)size);
} else {
char valstr[32];
zfs_nicenum(size, valstr,
sizeof (valstr));
(void) printf("Memory that will be "
"used after removing %s: %s\n",
argv[i], valstr);
}
} else {
if (zpool_vdev_remove(zhp, argv[i]) != 0)
ret = 1;
}
}
}
zpool_close(zhp);
@@ -1655,6 +1713,7 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
uint64_t notpresent;
spare_cbdata_t spare_cb;
const char *state;
char *type;
char *path = NULL;
if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN,
@@ -1664,6 +1723,11 @@ print_status_config(zpool_handle_t *zhp, status_cbdata_t *cb, const char *name,
verify(nvlist_lookup_uint64_array(nv, ZPOOL_CONFIG_VDEV_STATS,
(uint64_t **)&vs, &c) == 0);
verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0);
if (strcmp(type, VDEV_TYPE_INDIRECT) == 0)
return;
state = zpool_state_to_name(vs->vs_state, vs->vs_aux);
if (isspare) {
/*
@@ -3668,6 +3732,9 @@ print_vdev_stats(zpool_handle_t *zhp, const char *name, nvlist_t *oldnv,
calcvs = safe_malloc(sizeof (*calcvs));
if (strcmp(name, VDEV_TYPE_INDIRECT) == 0)
return (ret);
if (oldnv != NULL) {
verify(nvlist_lookup_uint64_array(oldnv,
ZPOOL_CONFIG_VDEV_STATS, (uint64_t **)&oldvs, &c) == 0);
@@ -4964,6 +5031,9 @@ print_list_stats(zpool_handle_t *zhp, const char *name, nvlist_t *nv,
else
format = ZFS_NICENUM_1024;
if (strcmp(name, VDEV_TYPE_INDIRECT) == 0)
return;
if (scripted)
(void) printf("\t%s", name);
else if (strlen(name) + depth > cb->cb_namewidth)
@@ -5982,7 +6052,7 @@ zpool_do_scrub(int argc, char **argv)
/*
* Print out detailed scrub status.
*/
void
static void
print_scan_status(pool_scan_stat_t *ps)
{
time_t start, end, pause;
@@ -6129,6 +6199,111 @@ print_scan_status(pool_scan_stat_t *ps)
}
}
/*
* Print out detailed removal status.
*/
static void
print_removal_status(zpool_handle_t *zhp, pool_removal_stat_t *prs)
{
char copied_buf[7], examined_buf[7], total_buf[7], rate_buf[7];
time_t start, end;
nvlist_t *config, *nvroot;
nvlist_t **child;
uint_t children;
char *vdev_name;
if (prs == NULL || prs->prs_state == DSS_NONE)
return;
/*
* Determine name of vdev.
*/
config = zpool_get_config(zhp, NULL);
nvroot = fnvlist_lookup_nvlist(config,
ZPOOL_CONFIG_VDEV_TREE);
verify(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN,
&child, &children) == 0);
assert(prs->prs_removing_vdev < children);
vdev_name = zpool_vdev_name(g_zfs, zhp,
child[prs->prs_removing_vdev], B_TRUE);
(void) printf(gettext("remove: "));
start = prs->prs_start_time;
end = prs->prs_end_time;
zfs_nicenum(prs->prs_copied, copied_buf, sizeof (copied_buf));
/*
* Removal is finished or canceled.
*/
if (prs->prs_state == DSS_FINISHED) {
uint64_t minutes_taken = (end - start) / 60;
(void) printf(gettext("Removal of vdev %llu copied %s "
"in %lluh%um, completed on %s"),
(longlong_t)prs->prs_removing_vdev,
copied_buf,
(u_longlong_t)(minutes_taken / 60),
(uint_t)(minutes_taken % 60),
ctime((time_t *)&end));
} else if (prs->prs_state == DSS_CANCELED) {
(void) printf(gettext("Removal of %s canceled on %s"),
vdev_name, ctime(&end));
} else {
uint64_t copied, total, elapsed, mins_left, hours_left;
double fraction_done;
uint_t rate;
assert(prs->prs_state == DSS_SCANNING);
/*
* Removal is in progress.
*/
(void) printf(gettext(
"Evacuation of %s in progress since %s"),
vdev_name, ctime(&start));
copied = prs->prs_copied > 0 ? prs->prs_copied : 1;
total = prs->prs_to_copy;
fraction_done = (double)copied / total;
/* elapsed time for this pass */
elapsed = time(NULL) - prs->prs_start_time;
elapsed = elapsed > 0 ? elapsed : 1;
rate = copied / elapsed;
rate = rate > 0 ? rate : 1;
mins_left = ((total - copied) / rate) / 60;
hours_left = mins_left / 60;
zfs_nicenum(copied, examined_buf, sizeof (examined_buf));
zfs_nicenum(total, total_buf, sizeof (total_buf));
zfs_nicenum(rate, rate_buf, sizeof (rate_buf));
/*
* do not print estimated time if hours_left is more than
* 30 days
*/
(void) printf(gettext(" %s copied out of %s at %s/s, "
"%.2f%% done"),
examined_buf, total_buf, rate_buf, 100 * fraction_done);
if (hours_left < (30 * 24)) {
(void) printf(gettext(", %lluh%um to go\n"),
(u_longlong_t)hours_left, (uint_t)(mins_left % 60));
} else {
(void) printf(gettext(
", (copy is slow, no estimated time)\n"));
}
}
if (prs->prs_mapping_memory > 0) {
char mem_buf[7];
zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf));
(void) printf(gettext(" %s memory used for "
"removed device mappings\n"),
mem_buf);
}
}
static void
print_error_log(zpool_handle_t *zhp)
{
@@ -6294,8 +6469,7 @@ status_callback(zpool_handle_t *zhp, void *data)
else
(void) printf("\n");
verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
&nvroot) == 0);
nvroot = fnvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE);
verify(nvlist_lookup_uint64_array(nvroot, ZPOOL_CONFIG_VDEV_STATS,
(uint64_t **)&vs, &c) == 0);
health = zpool_state_to_name(vs->vs_state, vs->vs_aux);
@@ -6555,11 +6729,16 @@ status_callback(zpool_handle_t *zhp, void *data)
nvlist_t **spares, **l2cache;
uint_t nspares, nl2cache;
pool_scan_stat_t *ps = NULL;
pool_removal_stat_t *prs = NULL;
(void) nvlist_lookup_uint64_array(nvroot,
ZPOOL_CONFIG_SCAN_STATS, (uint64_t **)&ps, &c);
print_scan_status(ps);
(void) nvlist_lookup_uint64_array(nvroot,
ZPOOL_CONFIG_REMOVAL_STATS, (uint64_t **)&prs, &c);
print_removal_status(zhp, prs);
cbp->cb_namewidth = max_width(zhp, nvroot, 0, 0,
cbp->cb_name_flags | VDEV_NAME_TYPE_ID);
if (cbp->cb_namewidth < 10)
Oops, something went wrong.

0 comments on commit a1d477c

Please sign in to comment.