Lines Matching +full:cdr +full:- +full:mode

9  * or https://opensource.org/licenses/CDDL-1.0.
31 * Copyright (c) 2017 Open-E, Inc. All Rights Reserved.
84 static int mount_tp_nthr = 512; /* tpool threads for multi-threaded mounting */
366 * Given a cb->cb_flags with a histogram bit set, return the iostat_type.
370 #define IOS_HISTO_IDX(a) (highbit64(a & IOS_ANYHISTO_M) - 1)
454 return (gettext("\tadd [-afgLnP] [-o property=value] " in get_usage()
457 return (gettext("\tattach [-fsw] [-o property=value] " in get_usage()
458 "<pool> <device> <new-device>\n")); in get_usage()
460 return (gettext("\tclear [[--power]|[-nF]] <pool> [device]\n")); in get_usage()
462 return (gettext("\tcreate [-fnd] [-o property=value] ... \n" in get_usage()
463 "\t [-O file-system-property=value] ... \n" in get_usage()
464 "\t [-m mountpoint] [-R root] <pool> <vdev> ...\n")); in get_usage()
466 return (gettext("\tcheckpoint [-d [-w]] <pool> ...\n")); in get_usage()
468 return (gettext("\tdestroy [-f] <pool>\n")); in get_usage()
472 return (gettext("\texport [-af] <pool> ...\n")); in get_usage()
474 return (gettext("\thistory [-il] [<pool>] ...\n")); in get_usage()
476 return (gettext("\timport [-d dir] [-D]\n" in get_usage()
477 "\timport [-o mntopts] [-o property=value] ... \n" in get_usage()
478 "\t [-d dir | -c cachefile] [-D] [-l] [-f] [-m] [-N] " in get_usage()
479 "[-R root] [-F [-n]] -a\n" in get_usage()
480 "\timport [-o mntopts] [-o property=value] ... \n" in get_usage()
481 "\t [-d dir | -c cachefile] [-D] [-l] [-f] [-m] [-N] " in get_usage()
482 "[-R root] [-F [-n]]\n" in get_usage()
483 "\t [--rewind-to-checkpoint] <pool | id> [newpool]\n")); in get_usage()
485 return (gettext("\tiostat [[[-c [script1,script2,...]" in get_usage()
486 "[-lq]]|[-rw]] [-T d | u] [-ghHLpPvy]\n" in get_usage()
488 " [[-n] interval [count]]\n")); in get_usage()
490 return (gettext("\tlabelclear [-f] <vdev>\n")); in get_usage()
492 return (gettext("\tlist [-gHLpPv] [-o property[,...]] [-j " in get_usage()
493 "[--json-int, --json-pool-key-guid]] ...\n" in get_usage()
494 "\t [-T d|u] [pool] [interval [count]]\n")); in get_usage()
496 return (gettext("\tprefetch -t <type> [<type opts>] <pool>\n" in get_usage()
497 "\t -t ddt <pool>\n")); in get_usage()
499 return (gettext("\toffline [--power]|[[-f][-t]] <pool> " in get_usage()
502 return (gettext("\tonline [--power][-e] <pool> <device> " in get_usage()
505 return (gettext("\treplace [-fsw] [-o property=value] " in get_usage()
506 "<pool> <device> [new-device]\n")); in get_usage()
508 return (gettext("\tremove [-npsw] <pool> <device> ...\n")); in get_usage()
510 return (gettext("\treopen [-n] <pool>\n")); in get_usage()
512 return (gettext("\tinitialize [-c | -s | -u] [-w] <pool> " in get_usage()
515 return (gettext("\tscrub [-e | -s | -p | -C] [-w] " in get_usage()
520 return (gettext("\ttrim [-dw] [-r <rate>] [-c | -s] <pool> " in get_usage()
523 return (gettext("\tstatus [--power] [-j [--json-int, " in get_usage()
524 "--json-flat-vdevs, ...\n" in get_usage()
525 "\t --json-pool-key-guid]] [-c [script1,script2,...]] " in get_usage()
526 "[-dDegiLpPstvx] ...\n" in get_usage()
527 "\t [-T d|u] [pool] [interval [count]]\n")); in get_usage()
530 "\tupgrade -v\n" in get_usage()
531 "\tupgrade [-V version] <-a | pool ...>\n")); in get_usage()
533 return (gettext("\tevents [-vHf [pool] | -c]\n")); in get_usage()
535 return (gettext("\tget [-Hp] [-j [--json-int, " in get_usage()
536 "--json-pool-key-guid]] ...\n" in get_usage()
537 "\t [-o \"all\" | field[,...]] " in get_usage()
543 return (gettext("\tsplit [-gLnPl] [-R altroot] [-o mntopts]\n" in get_usage()
544 "\t [-o property=value] <pool> <newpool> " in get_usage()
547 return (gettext("\treguid [-g guid] <pool>\n")); in get_usage()
551 return (gettext("\tversion [-j]\n")); in get_usage()
553 return (gettext("\twait [-Hp] [-T d|u] [-t <activity>[,...]] " in get_usage()
556 return (gettext("\tddtprune -d|-p <amount> <pool>\n")); in get_usage()
597 (void) fprintf(fp, "\t%-19s ", zpool_prop_to_name(prop)); in print_pool_prop_cb()
605 (void) fprintf(fp, "-\n"); in print_pool_prop_cb()
620 (void) fprintf(fp, "\t%-19s ", vdev_prop_to_name(prop)); in print_vdev_prop_cb()
628 (void) fprintf(fp, "-\n"); in print_vdev_prop_cb()
637 * '/dev/disk/by-vdev/L5'.
736 (void) fprintf(fp, "%s", get_usage(current_command->usage)); in usage()
741 ((strcmp(current_command->name, "set") == 0) || in usage()
742 (strcmp(current_command->name, "get") == 0) || in usage()
743 (strcmp(current_command->name, "list") == 0))) { in usage()
748 (void) fprintf(fp, "\n\t%-19s %s %s\n\n", in usage()
756 (void) fprintf(fp, "\t%-19s ", "feature@..."); in usage()
762 "See zpool-features(7).\n")); in usage()
781 * zpool initialize [-c | -s | -u] [-w] <pool> [<vdev> ...]
785 * -c Cancel. Ends active initializing.
786 * -s Suspend. Initializing can then be restarted with no flags.
787 * -u Uninitialize. Clears initialization state.
788 * -w Wait. Blocks until initializing has completed.
810 NULL)) != -1) { in zpool_do_initialize()
815 (void) fprintf(stderr, gettext("-c cannot be " in zpool_do_initialize()
824 (void) fprintf(stderr, gettext("-s cannot be " in zpool_do_initialize()
833 (void) fprintf(stderr, gettext("-u cannot be " in zpool_do_initialize()
849 argv[optind - 1]); in zpool_do_initialize()
855 argc -= optind; in zpool_do_initialize()
861 return (-1); in zpool_do_initialize()
865 (void) fprintf(stderr, gettext("-w cannot be used with -c, -s" in zpool_do_initialize()
866 "or -u\n")); in zpool_do_initialize()
873 return (-1); in zpool_do_initialize()
1033 if (find_vdev(nvroot, cbp->cb_guid)) { in find_spare()
1034 cbp->cb_zhp = zhp; in find_spare()
1095 snprintf(cmd, MAX_CMD_LEN, "zpool %s", current_command->name); in zpool_json_schema()
1172 _name = (char *)"root-0"; in fill_vdev_info()
1250 vdev_state_str[vs->vs_state]); in fill_vdev_info()
1268 * Add a property pair (name, string-value) into a property nvlist.
1369 * Set a default property pair (name, string-value) in a property nvlist
1384 * zpool add [-afgLnP] [-o property=value] <pool> <vdev> ...
1386 * -a Disable the ashift validation checks
1387 * -f Force addition of devices, even if they appear in use
1388 * -g Display guid for individual vdev name.
1389 * -L Follow links when resolving vdev path name.
1390 * -n Do not add the devices, but display the resulting layout if
1392 * -o Set property=value.
1393 * -P Display full path for vdev name.
1418 {"allow-in-use", no_argument, NULL, ZPOOL_OPTION_ALLOW_INUSE}, in zpool_do_add()
1419 {"allow-replication-mismatch", no_argument, NULL, in zpool_do_add()
1421 {"allow-ashift-mismatch", no_argument, NULL, in zpool_do_add()
1428 != -1) { in zpool_do_add()
1445 "'=' for -o option\n")); in zpool_do_add()
1474 argc -= optind; in zpool_do_add()
1489 (void) fprintf(stderr, gettext("'-f' option is not " in zpool_do_add()
1490 "allowed with '--allow-replication-mismatch', " in zpool_do_add()
1491 "'--allow-ashift-mismatch', or " in zpool_do_add()
1492 "'--allow-in-use'\n")); in zpool_do_add()
1502 argc--; in zpool_do_add()
1646 * zpool remove [-npsw] <pool> <vdev> ...
1663 while ((c = getopt(argc, argv, "npsw")) != -1) { in zpool_do_remove()
1684 argc -= optind; in zpool_do_remove()
1713 "combination: -w cannot be used with -s\n")); in zpool_do_remove()
1769 return (1); /* cant open O_EXCL - disk is active */ in vdev_is_active()
1777 * zpool labelclear [-f] <vdev>
1779 * -f Force clearing the label for the vdevs which are members of
1790 int c, fd = -1, ret = 0; in zpool_do_labelclear()
1797 while ((c = getopt(argc, argv, "f")) != -1) { in zpool_do_labelclear()
1809 argc -= optind; in zpool_do_labelclear()
1839 if (zfs_append_partition(vdev, MAXPATHLEN) == -1) in zpool_do_labelclear()
1892 * We allow the user to call 'zpool offline -f' in zpool_do_labelclear()
1915 "use '-f' to override the following error:\n" in zpool_do_labelclear()
1925 "use '-f' to override the following error:\n" in zpool_do_labelclear()
1952 * zpool create [-fnd] [-o property=value] ...
1953 * [-O file-system-property=value] ...
1954 * [-R root] [-m mountpoint] <pool> <dev> ...
1956 * -f Force creation, even if devices appear in use
1957 * -n Do not create the pool, but display the resulting layout if it
1959 * -R Create a pool under an alternate root
1960 * -m Set default mountpoint for the root dataset. By default it's
1962 * -o Set property=value.
1963 * -o Set feature@feature=enabled|disabled.
1964 * -d Don't automatically enable all supported pool features
1965 * (individual features can be enabled with -o).
1966 * -O Set fsproperty=value in the pool's root file system
1971 * contents (if '-n' was specified), or pass it to libzfs to do the creation.
1993 while ((c = getopt(argc, argv, ":fndR:m:o:O:t:")) != -1) { in zpool_do_create()
2014 /* Equivalent to -O mountpoint=optarg */ in zpool_do_create()
2020 "'=' for -o option\n")); in zpool_do_create()
2052 "'=' for -O option\n")); in zpool_do_create()
2061 * more than once, to avoid conflict with -m. in zpool_do_create()
2103 argc -= optind; in zpool_do_create()
2132 argc - 1, argv + 1); in zpool_do_create()
2152 * '-m' mountpoint option if it looks like its in use. in zpool_do_create()
2186 (void) fprintf(stderr, gettext("use '-m' " in zpool_do_create()
2199 (void) fprintf(stderr, gettext("use '-m' " in zpool_do_create()
2253 * - remove it if feature@name=disabled in zpool_do_create()
2254 * - leave it there if feature@name=enabled in zpool_do_create()
2255 * - add it if: in zpool_do_create()
2256 * - enable_pool_features (ie: no '-d' or '-o version') in zpool_do_create()
2257 * - it's supported by the kernel module in zpool_do_create()
2258 * - it's in the requested feature set in zpool_do_create()
2259 * - warn if it's enabled but not in compat in zpool_do_create()
2267 "feature@%s", feat->fi_uname); in zpool_do_create()
2281 feat->fi_uname); in zpool_do_create()
2285 feat->fi_zfs_mod_supported && in zpool_do_create()
2327 * -f Forcefully unmount any datasets
2341 while ((c = getopt(argc, argv, "f")) != -1) { in zpool_do_destroy()
2353 argc -= optind; in zpool_do_destroy()
2419 * zpool_disable_datasets() is not thread-safe for mnttab access. in zpool_export_one()
2420 * So we serialize access here for 'zpool export -a' parallel case. in zpool_export_one()
2422 if (cb->tpool != NULL) in zpool_export_one()
2423 pthread_mutex_lock(&cb->mnttab_lock); in zpool_export_one()
2425 int retval = zpool_disable_datasets(zhp, cb->force); in zpool_export_one()
2427 if (cb->tpool != NULL) in zpool_export_one()
2428 pthread_mutex_unlock(&cb->mnttab_lock); in zpool_export_one()
2433 if (cb->hardforce) { in zpool_export_one()
2436 } else if (zpool_export(zhp, cb->force, history_str) != 0) { in zpool_export_one()
2451 zpool_handle_t *zhp = zpool_open(g_zfs, aea->aea_poolname); in zpool_export_task()
2453 int ret = zpool_export_one(zhp, aea->aea_cbdata); in zpool_export_task()
2455 aea->aea_cbdata->retval = ret; in zpool_export_task()
2458 aea->aea_cbdata->retval = 1; in zpool_export_task()
2461 free(aea->aea_poolname); in zpool_export_task()
2471 tpool_t *tpool = ((export_cbdata_t *)data)->tpool; in zpool_export_one_async()
2475 aea->aea_poolname = strdup(zpool_get_name(zhp)); in zpool_export_one_async()
2476 aea->aea_cbdata = data; in zpool_export_one_async()
2486 * zpool export [-f] <pool> ...
2488 * -a Export all pools
2489 * -f Forcefully unmount datasets
2492 * unmount any active datasets within the pool. If the '-f' flag is specified,
2505 while ((c = getopt(argc, argv, "afF")) != -1) { in zpool_do_export()
2527 argc -= optind; in zpool_do_export()
2637 for (i = 0; i < vcdl->count; i++) { in zpool_nvlist_cmd()
2638 if ((strcmp(vcdl->data[i].path, path) != 0) || in zpool_nvlist_cmd()
2639 (strcmp(vcdl->data[i].pool, pool) != 0)) in zpool_nvlist_cmd()
2642 data = &vcdl->data[i]; in zpool_nvlist_cmd()
2643 for (j = 0; j < vcdl->uniq_cols_cnt; j++) { in zpool_nvlist_cmd()
2645 for (int k = 0; k < data->cols_cnt; k++) { in zpool_nvlist_cmd()
2646 if (strcmp(data->cols[k], in zpool_nvlist_cmd()
2647 vcdl->uniq_cols[j]) == 0) { in zpool_nvlist_cmd()
2648 val = data->lines[k]; in zpool_nvlist_cmd()
2653 val = "-"; in zpool_nvlist_cmd()
2654 fnvlist_add_string(item, vcdl->uniq_cols[j], val); in zpool_nvlist_cmd()
2657 for (j = data->cols_cnt; j < data->lines_cnt; j++) { in zpool_nvlist_cmd()
2658 if (data->lines[j]) { in zpool_nvlist_cmd()
2661 data->lines[j]); in zpool_nvlist_cmd()
2676 for (i = 0; i < vcdl->count; i++) { in zpool_print_cmd()
2677 if ((strcmp(vcdl->data[i].path, path) != 0) || in zpool_print_cmd()
2678 (strcmp(vcdl->data[i].pool, pool) != 0)) { in zpool_print_cmd()
2683 data = &vcdl->data[i]; in zpool_print_cmd()
2685 for (j = 0; j < vcdl->uniq_cols_cnt; j++) { in zpool_print_cmd()
2688 for (int k = 0; k < data->cols_cnt; k++) { in zpool_print_cmd()
2689 if (strcmp(data->cols[k], in zpool_print_cmd()
2690 vcdl->uniq_cols[j]) == 0) { in zpool_print_cmd()
2692 val = data->lines[k]; in zpool_print_cmd()
2698 * awk-able. in zpool_print_cmd()
2701 val = "-"; in zpool_print_cmd()
2703 printf("%*s", vcdl->uniq_cols_width[j], val); in zpool_print_cmd()
2704 if (j < vcdl->uniq_cols_cnt - 1) in zpool_print_cmd()
2709 for (j = data->cols_cnt; j < data->lines_cnt; j++) { in zpool_print_cmd()
2711 if (vcdl->uniq_cols_cnt > 0) in zpool_print_cmd()
2714 val = data->lines[j]; in zpool_print_cmd()
2728 if ((vs->vs_initialize_state == VDEV_INITIALIZE_ACTIVE || in print_status_initialize()
2729 vs->vs_initialize_state == VDEV_INITIALIZE_SUSPENDED || in print_status_initialize()
2730 vs->vs_initialize_state == VDEV_INITIALIZE_COMPLETE) && in print_status_initialize()
2731 !vs->vs_scan_removing) { in print_status_initialize()
2735 time_t t = vs->vs_initialize_action_time; in print_status_initialize()
2737 if (vs->vs_initialize_state != in print_status_initialize()
2739 initialize_pct = (vs->vs_initialize_bytes_done * in print_status_initialize()
2740 100 / (vs->vs_initialize_bytes_est + 1)); in print_status_initialize()
2746 switch (vs->vs_initialize_state) { in print_status_initialize()
2766 } else if (vs->vs_initialize_state == VDEV_INITIALIZE_ACTIVE) { in print_status_initialize()
2778 if ((vs->vs_trim_state == VDEV_TRIM_ACTIVE || in print_status_trim()
2779 vs->vs_trim_state == VDEV_TRIM_SUSPENDED || in print_status_trim()
2780 vs->vs_trim_state == VDEV_TRIM_COMPLETE) && in print_status_trim()
2781 !vs->vs_scan_removing) { in print_status_trim()
2785 time_t t = vs->vs_trim_action_time; in print_status_trim()
2787 if (vs->vs_trim_state != VDEV_TRIM_COMPLETE) { in print_status_trim()
2788 trim_pct = (vs->vs_trim_bytes_done * in print_status_trim()
2789 100 / (vs->vs_trim_bytes_est + 1)); in print_status_trim()
2795 switch (vs->vs_trim_state) { in print_status_trim()
2812 } else if (vs->vs_trim_notsup) { in print_status_trim()
2817 } else if (vs->vs_trim_state == VDEV_TRIM_ACTIVE) { in print_status_trim()
2849 * 3) slow IO reporting was requested (-s) and there are slow IOs.
2863 if (vs->vs_checksum_errors || vs->vs_read_errors || in vdev_health_check_cb()
2864 vs->vs_write_errors || vs->vs_state != VDEV_STATE_HEALTHY) in vdev_health_check_cb()
2867 if (cb->cb_print_slow_ios && vs->vs_slow_ios) in vdev_health_check_cb()
2906 state = zpool_state_to_name(vs->vs_state, vs->vs_aux); in print_status_config()
2913 if (vs->vs_aux == VDEV_AUX_SPARED) in print_status_config()
2915 else if (vs->vs_state == VDEV_STATE_HEALTHY) in print_status_config()
2920 * If '-e' is specified then top-level vdevs and their children in print_status_config()
2923 if (cb->cb_print_unhealthy && depth > 0 && in print_status_config()
2929 "\t%*s%-*s %-8s", depth, "", cb->cb_namewidth - depth, in print_status_config()
2933 if (vs->vs_read_errors) in print_status_config()
2936 if (vs->vs_write_errors) in print_status_config()
2939 if (vs->vs_checksum_errors) in print_status_config()
2942 if (vs->vs_slow_ios) in print_status_config()
2945 if (cb->cb_literal) { in print_status_config()
2948 (u_longlong_t)vs->vs_read_errors); in print_status_config()
2951 (u_longlong_t)vs->vs_write_errors); in print_status_config()
2954 (u_longlong_t)vs->vs_checksum_errors); in print_status_config()
2956 zfs_nicenum(vs->vs_read_errors, rbuf, sizeof (rbuf)); in print_status_config()
2957 zfs_nicenum(vs->vs_write_errors, wbuf, sizeof (wbuf)); in print_status_config()
2958 zfs_nicenum(vs->vs_checksum_errors, cbuf, in print_status_config()
2967 if (cb->cb_print_slow_ios) { in print_status_config()
2970 zfs_nicenum(vs->vs_slow_ios, rbuf, in print_status_config()
2973 snprintf(rbuf, sizeof (rbuf), "-"); in print_status_config()
2976 if (cb->cb_literal) in print_status_config()
2978 (u_longlong_t)vs->vs_slow_ios); in print_status_config()
2982 if (cb->cb_print_power) { in print_status_config()
2996 printf(" %5s", "-"); in print_status_config()
2999 printf(" %5s", "-"); in print_status_config()
3003 cb->cb_print_dio_verify) { in print_status_config()
3004 zfs_nicenum(vs->vs_dio_verify_errors, dbuf, in print_status_config()
3007 if (cb->cb_literal) in print_status_config()
3009 (u_longlong_t)vs->vs_dio_verify_errors); in print_status_config()
3019 } else if (vs->vs_aux != 0) { in print_status_config()
3022 switch (vs->vs_aux) { in print_status_config()
3066 if (vs->vs_read_errors + vs->vs_write_errors + in print_status_config()
3067 vs->vs_checksum_errors == 0 && children == 0 && in print_status_config()
3068 vs->vs_slow_ios > 0) { in print_status_config()
3111 vs->vs_configured_ashift < vs->vs_physical_ashift) { in print_status_config()
3114 1 << vs->vs_configured_ashift, 1 << vs->vs_physical_ashift); in print_status_config()
3117 if (vs->vs_scan_removing != 0) { in print_status_config()
3119 } else if (VDEV_STAT_VALID(vs_noalloc, vsc) && vs->vs_noalloc != 0) { in print_status_config()
3120 (void) printf(gettext(" (non-allocating)")); in print_status_config()
3135 if (ps != NULL && ps->pss_state == DSS_SCANNING && children == 0 && in print_status_config()
3136 vs->vs_state == VDEV_STATE_HEALTHY) { in print_status_config()
3137 if (vs->vs_scan_processed != 0) { in print_status_config()
3139 (ps->pss_func == POOL_SCAN_RESILVER) ? in print_status_config()
3141 } else if (vs->vs_resilver_deferred) { in print_status_config()
3146 /* The top-level vdevs have the rebuild stats */ in print_status_config()
3147 if (vrs != NULL && vrs->vrs_state == VDEV_REBUILD_ACTIVE && in print_status_config()
3148 children == 0 && vs->vs_state == VDEV_STATE_HEALTHY) { in print_status_config()
3149 if (vs->vs_rebuild_processed != 0) { in print_status_config()
3154 if (cb->vcdl != NULL) { in print_status_config()
3157 zpool_print_cmd(cb->vcdl, zpool_get_name(zhp), path); in print_status_config()
3163 print_status_initialize(vs, cb->cb_print_vdev_init); in print_status_config()
3164 print_status_trim(vs, cb->cb_print_vdev_trim); in print_status_config()
3191 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in print_status_config()
3220 (void) printf("\t%*s%-*s", depth, "", cb->cb_namewidth - depth, name); in print_import_config()
3221 (void) printf(" %s", zpool_state_to_name(vs->vs_state, vs->vs_aux)); in print_import_config()
3223 if (vs->vs_aux != 0) { in print_import_config()
3226 switch (vs->vs_aux) { in print_import_config()
3285 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in print_import_config()
3295 cb->cb_name_flags); in print_import_config()
3306 cb->cb_name_flags); in print_import_config()
3320 * recursively - which works because only the top level vdev is marked.
3330 assert(zhp != NULL || !cb->cb_verbose); in print_class_vdevs()
3364 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in print_class_vdevs()
3365 if (cb->cb_print_status) in print_class_vdevs()
3408 health = zpool_state_to_name(vs->vs_state, vs->vs_aux); in show_import()
3468 "a legacy on-disk version.\n")); in show_import()
3507 "accessed in read-only mode on this system. It\n" in show_import()
3508 "\t%scannot be accessed in read-write mode because it uses " in show_import()
3559 "configured to use a non-native block size.\n" in show_import()
3573 if (vs->vs_state != VDEV_STATE_HEALTHY || in show_import()
3578 if (vs->vs_state == VDEV_STATE_HEALTHY) { in show_import()
3595 "\t%sthe '-f' flag.\n"), indent); in show_import()
3619 "datasets contain an on-disk " in show_import()
3630 "on-disk\n" in show_import()
3632 "on-disk corruption if they are used\n" in show_import()
3639 "\t%srequired, use a non-raw send to " in show_import()
3655 } else if (vs->vs_state == VDEV_STATE_DEGRADED) { in show_import()
3676 "read-write mode. Import the pool with\n" in show_import()
3677 "\t%s'-o readonly=on', access the pool on a system " in show_import()
3724 if ((vs->vs_state == VDEV_STATE_CLOSED || in show_import()
3725 vs->vs_state == VDEV_STATE_CANT_OPEN) && in show_import()
3726 vs->vs_aux == VDEV_AUX_CORRUPT_DATA) { in show_import()
3729 "but can be imported using the '-Df' flags.\n"), in show_import()
3734 "\t%sthe '-f' flag.\n"), indent, indent); in show_import()
3739 "https://openzfs.github.io/openzfs-docs/msg/%s\n"), in show_import()
3880 "The pool can be imported, use 'zpool import -f' " in do_import()
3934 *ip->ip_err |= do_import(ip->ip_config, NULL, ip->ip_mntopts, in do_import_task()
3935 ip->ip_props, ip->ip_flags, ip->ip_mntthreads); in do_import_task()
3947 boolean_t pool_specified = (import->poolname != NULL || in import_pools()
3948 import->guid != 0); in import_pools()
3953 if (import->do_all) { in import_pools()
3961 * post-process the list to deal with pool state and possible in import_pools()
3967 if (!pool_specified && import->do_all) { in import_pools()
3977 if (!import->do_destroyed && in import_pools()
3980 if (import->do_destroyed && in import_pools()
3985 import->policy) == 0); in import_pools()
3990 else if (!import->do_all) in import_pools()
3993 if (import->do_all) { in import_pools()
3997 ip->ip_config = config; in import_pools()
3998 ip->ip_mntopts = mntopts; in import_pools()
3999 ip->ip_props = props; in import_pools()
4000 ip->ip_flags = flags; in import_pools()
4001 ip->ip_mntthreads = mount_tp_nthr / npools; in import_pools()
4002 ip->ip_err = &err; in import_pools()
4014 if (import->cachefile && !import->scan) in import_pools()
4019 } else if (import->poolname != NULL) { in import_pools()
4028 if (strcmp(name, import->poolname) == 0) { in import_pools()
4033 import->poolname); in import_pools()
4049 if (guid == import->guid) in import_pools()
4053 if (import->do_all) { in import_pools()
4098 if (args->poolname != NULL) { in name_or_guid_exists()
4103 if (strcmp(pool_name, args->poolname) == 0) in name_or_guid_exists()
4110 if (pool_guid == args->poolguid) in name_or_guid_exists()
4119 * checkpoint --discard <pool>
4121 * -d Discard the checkpoint from a checkpointed
4122 * --discard pool.
4124 * -w Wait for discarding a checkpoint to complete.
4125 * --wait
4146 while ((c = getopt_long(argc, argv, ":dw", long_options, NULL)) != -1) { in zpool_do_checkpoint()
4162 (void) fprintf(stderr, gettext("--wait only valid when " in zpool_do_checkpoint()
4163 "--discard also specified\n")); in zpool_do_checkpoint()
4167 argc -= optind; in zpool_do_checkpoint()
4222 while ((c = getopt(argc, argv, "t:")) != -1) { in zpool_do_prefetch()
4238 argc -= optind; in zpool_do_prefetch()
4253 argc--; in zpool_do_prefetch()
4274 * zpool import [-d dir] [-D]
4275 * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l]
4276 * [-d dir | -c cachefile | -s] [-f] -a
4277 * import [-o mntopts] [-o prop=value] ... [-R root] [-D] [-l]
4278 * [-d dir | -c cachefile | -s] [-f] [-n] [-F] <pool | id>
4281 * -c Read pool information from a cachefile instead of searching
4286 * -d Scan in a specific directory, other than /dev/. More than
4287 * one directory can be specified using multiple '-d' options.
4289 * -D Scan for previously destroyed pools or import all or only
4292 * -R Temporarily import the pool, with all mountpoints relative to
4296 * -V Import even in the presence of faulted vdevs. This is an
4302 * -f Force import, even if it appears that the pool is active.
4304 * -F Attempt rewind if necessary.
4306 * -n See if rewind would work, but don't actually rewind.
4308 * -N Import the pool but don't mount datasets.
4310 * -T Specify a starting txg to use for import. This option is
4313 * -a Import all pools found.
4315 * -l Load encryption keys while importing.
4317 * -o Set property=value and/or temporary mount options (without '=').
4319 * -s Scan using the default search path, the libblkid cache will
4322 * --rewind-to-checkpoint
4352 uint64_t txg = -1ULL; in zpool_do_import()
4358 {"rewind-to-checkpoint", no_argument, NULL, CHECKPOINT_OPT}, in zpool_do_import()
4364 long_options, NULL)) != -1) { in zpool_do_import()
4458 argc -= optind; in zpool_do_import()
4462 (void) fprintf(stderr, gettext("-c is incompatible with -d\n")); in zpool_do_import()
4467 (void) fprintf(stderr, gettext("-c is incompatible with -s\n")); in zpool_do_import()
4472 (void) fprintf(stderr, gettext("-l is incompatible with -N\n")); in zpool_do_import()
4477 (void) fprintf(stderr, gettext("-l is only meaningful during " in zpool_do_import()
4484 gettext("-n or -X only meaningful with -F\n")); in zpool_do_import()
4534 * -a Iterate through all pools and try to import each one. in zpool_do_import()
4539 * -D Above options applies only to destroyed pools. in zpool_do_import()
4662 * zpool sync [-f] [pool] ...
4664 * -f (undocumented) force uberblock (and config including zpool cache file)
4679 while ((ret = getopt(argc, argv, "f")) != -1) { in zpool_do_sync()
4691 argc -= optind; in zpool_do_sync()
4738 /* Shorthand - if "columns" field not set, default to 1 column */
4763 * Return the number of labels in a null-terminated name_and_columns_t
4779 * Return the number of strings in a null-terminated string array.
4817 if (cb->cb_literal) in default_column_width()
4838 uint64_t flags = cb->cb_flags; in print_iostat_labels()
4844 idx = lowbit64(f) - 1; in print_iostat_labels()
4859 (2 * (columns - 1)); in print_iostat_labels()
4861 text_start = (int)((rw_column_width) / columns - in print_iostat_labels()
4875 spaces_to_end = rw_column_width - text_start - slen; in print_iostat_labels()
4887 * print_cmd_columns - Print custom column titles from -c
4889 * If the user specified the "zpool status|iostat -c" then print their custom
4893 * $ zpool iostat -vc 'echo col1=val1; echo col2=val2'
4897 * ---------- ----- ----- ----- ----- ----- ----- ---- ----
4900 * sdb - - 0 0 102 473 val1 val2
4901 * sdc - - 0 0 5 473 val1 val2
4902 * ---------- ----- ----- ----- ----- ----- ----- ---- ----
4908 vdev_cmd_data_t *data = &vcdl->data[0]; in print_cmd_columns()
4910 if (vcdl->count == 0 || data == NULL) in print_cmd_columns()
4918 for (i = 0; i < vcdl->uniq_cols_cnt; i++) { in print_cmd_columns()
4921 for (j = 0; j < vcdl->uniq_cols_width[i]; j++) in print_cmd_columns()
4922 printf("-"); in print_cmd_columns()
4924 printf_color(ANSI_BOLD, "%*s", vcdl->uniq_cols_width[i], in print_cmd_columns()
4925 vcdl->uniq_cols[i]); in print_cmd_columns()
4934 * -------------------------------- ----- ----- ----- ----- -----
4936 * ...or a dashed named-row line like:
4938 * logs - - - - -
4942 * @force_column_width If non-zero, use the value as the column width.
4945 * @name: Print a dashed named-row line starting
4955 uint64_t flags = cb->cb_flags; in print_iostat_dashes()
4962 if (cb->cb_flags & IOS_ANYHISTO_M) { in print_iostat_dashes()
4963 title = histo_to_title[IOS_HISTO_IDX(cb->cb_flags)]; in print_iostat_dashes()
4964 } else if (cb->cb_vdevs.cb_names_count) { in print_iostat_dashes()
4970 namewidth = MAX(MAX(strlen(title), cb->cb_namewidth), in print_iostat_dashes()
4975 printf("%-*s", namewidth, name); in print_iostat_dashes()
4978 (void) printf("-"); in print_iostat_dashes()
4984 idx = lowbit64(f) - 1; in print_iostat_dashes()
4993 printf(" %*s-", column_width - 1, " "); in print_iostat_dashes()
4996 "--------------------"); in print_iostat_dashes()
5024 if (cb->cb_flags & IOS_ANYHISTO_M) { in print_iostat_header_impl()
5025 title = histo_to_title[IOS_HISTO_IDX(cb->cb_flags)]; in print_iostat_header_impl()
5026 } else if (cb->cb_vdevs.cb_names_count) { in print_iostat_header_impl()
5032 namewidth = MAX(MAX(strlen(title), cb->cb_namewidth), in print_iostat_header_impl()
5036 printf("%-*s", namewidth, histo_vdev_name); in print_iostat_header_impl()
5044 printf("%-*s", namewidth, title); in print_iostat_header_impl()
5047 if (cb->vcdl != NULL) in print_iostat_header_impl()
5048 print_cmd_columns(cb->vcdl, 0); in print_iostat_header_impl()
5054 if (cb->vcdl != NULL) in print_iostat_header_impl()
5055 print_cmd_columns(cb->vcdl, 1); in print_iostat_header_impl()
5079 column_size--; in print_stat_color()
5093 if (--column_size <= 0) in print_stat_color()
5130 for (i = 0; i < ARRAY_SIZE(calcvs->vs_ops); i++) in calc_default_iostats()
5131 calcvs->vs_ops[i] = (newvs->vs_ops[i] - oldvs->vs_ops[i]); in calc_default_iostats()
5133 for (i = 0; i < ARRAY_SIZE(calcvs->vs_bytes); i++) in calc_default_iostats()
5134 calcvs->vs_bytes[i] = (newvs->vs_bytes[i] - oldvs->vs_bytes[i]); in calc_default_iostats()
5178 ret = nvpair_value_uint64_array(tmp, &nva->data, &nva->count); in nvpair64_to_stat_array()
5181 ret = nvpair_value_uint64(tmp, &nva->__data); in nvpair64_to_stat_array()
5182 nva->data = &nva->__data; in nvpair64_to_stat_array()
5183 nva->count = 1; in nvpair64_to_stat_array()
5236 calcnva[j].data[i] -= oldnva[j].data[i]; in calc_and_alloc_stats_ex()
5266 if (cb->cb_literal) in print_iostat_histo()
5274 if (cb->cb_flags & IOS_RQ_HISTO_M) { in print_iostat_histo()
5275 /* Start at 512 - req size should never be lower than this */ in print_iostat_histo()
5283 if (cb->cb_flags & IOS_L_HISTO_M) { in print_iostat_histo()
5285 val = (1UL << (j + 1)) - 1; in print_iostat_histo()
5293 if (cb->cb_scripted) in print_iostat_histo()
5296 printf("%-*s", namewidth, buf); in print_iostat_histo()
5301 column_width, cb->cb_scripted); in print_iostat_histo()
5310 while (length--) in print_solid_separator()
5311 printf("-"); in print_solid_separator()
5328 type = IOS_HISTO_IDX(cb->cb_flags); in print_iostat_histos()
5330 /* Get NULL-terminated array of nvlist names for our histo */ in print_iostat_histos()
5336 if (cb->cb_literal) { in print_iostat_histos()
5343 namewidth = MAX(cb->cb_namewidth, in print_iostat_histos()
5344 strlen(histo_to_title[IOS_HISTO_IDX(cb->cb_flags)])); in print_iostat_histos()
5351 /* ----- ----- */ in print_iostat_histos()
5352 /* |___| <---------- column_width */ in print_iostat_histos()
5354 /* |__________| <--- entire_width */ in print_iostat_histos()
5359 if (cb->cb_scripted) in print_iostat_histos()
5368 if (!cb->cb_scripted) in print_iostat_histos()
5373 * Calculate the average latency of a power-of-two latency histogram
5383 * Our buckets are power-of-two latency ranges. Use the in single_histo_average()
5388 * 8ns-15ns: 12ns in single_histo_average()
5389 * 16ns-31ns: 24ns in single_histo_average()
5429 if (cb->cb_literal) in print_iostat_queues()
5436 print_one_stat(val, format, column_width, cb->cb_scripted); in print_iostat_queues()
5468 if (cb->cb_literal) in print_iostat_latency()
5477 print_one_stat(val, format, column_width, cb->cb_scripted); in print_iostat_latency()
5492 if (cb->cb_literal) { in print_iostat_default()
5497 na = '-'; in print_iostat_default()
5501 if (vs->vs_space == 0) { in print_iostat_default()
5502 if (cb->cb_scripted) in print_iostat_default()
5508 print_one_stat(vs->vs_alloc, format, column_width, in print_iostat_default()
5509 cb->cb_scripted); in print_iostat_default()
5510 print_one_stat(vs->vs_space - vs->vs_alloc, format, in print_iostat_default()
5511 column_width, cb->cb_scripted); in print_iostat_default()
5514 print_one_stat((uint64_t)(vs->vs_ops[ZIO_TYPE_READ] * scale), in print_iostat_default()
5515 format, column_width, cb->cb_scripted); in print_iostat_default()
5516 print_one_stat((uint64_t)(vs->vs_ops[ZIO_TYPE_WRITE] * scale), in print_iostat_default()
5517 format, column_width, cb->cb_scripted); in print_iostat_default()
5518 print_one_stat((uint64_t)(vs->vs_bytes[ZIO_TYPE_READ] * scale), in print_iostat_default()
5519 format, column_width, cb->cb_scripted); in print_iostat_default()
5520 print_one_stat((uint64_t)(vs->vs_bytes[ZIO_TYPE_WRITE] * scale), in print_iostat_default()
5521 format, column_width, cb->cb_scripted); in print_iostat_default()
5564 for (i = 0; i < cb->cb_vdevs.cb_names_count; i++) { in print_vdev_stats()
5566 if (strcmp(name, cb->cb_vdevs.cb_names[i]) == 0) { in print_vdev_stats()
5577 if (cb->cb_vdevs.cb_names_count && (i == cb->cb_vdevs.cb_names_count)) { in print_vdev_stats()
5590 if (!(cb->cb_flags & IOS_ANYHISTO_M)) { in print_vdev_stats()
5591 if (cb->cb_scripted) { in print_vdev_stats()
5594 if (strlen(name) + depth > cb->cb_namewidth) in print_vdev_stats()
5598 (int)(cb->cb_namewidth - strlen(name) - in print_vdev_stats()
5604 tdelta = newvs->vs_timestamp - oldvs->vs_timestamp; in print_vdev_stats()
5605 if ((oldvs->vs_timestamp == 0) && (cb->cb_flags & IOS_ANYHISTO_M)) { in print_vdev_stats()
5619 if (cb->cb_flags & IOS_DEFAULT_M) { in print_vdev_stats()
5623 if (cb->cb_flags & IOS_LATENCY_M) in print_vdev_stats()
5625 if (cb->cb_flags & IOS_QUEUES_M) in print_vdev_stats()
5627 if (cb->cb_flags & IOS_ANYHISTO_M) { in print_vdev_stats()
5632 if (cb->vcdl != NULL) { in print_vdev_stats()
5637 zpool_print_cmd(cb->vcdl, zpool_get_name(zhp), path); in print_vdev_stats()
5641 if (!(cb->cb_flags & IOS_ANYHISTO_M)) in print_vdev_stats()
5650 if (!cb->cb_verbose) in print_vdev_stats()
5666 * print normal top-level devices in print_vdev_stats()
5684 cb->cb_vdevs.cb_name_flags | VDEV_NAME_TYPE_ID); in print_vdev_stats()
5691 * print all other top-level devices in print_vdev_stats()
5717 if ((!(cb->cb_flags & IOS_ANYHISTO_M)) && in print_vdev_stats()
5718 !cb->cb_scripted && in print_vdev_stats()
5719 !cb->cb_vdevs.cb_names) { in print_vdev_stats()
5728 cb->cb_vdevs.cb_name_flags | VDEV_NAME_TYPE_ID); in print_vdev_stats()
5751 if ((!(cb->cb_flags & IOS_ANYHISTO_M)) && !cb->cb_scripted && in print_vdev_stats()
5752 !cb->cb_vdevs.cb_names) { in print_vdev_stats()
5759 cb->cb_vdevs.cb_name_flags); in print_vdev_stats()
5779 return (-1); in refresh_iostat()
5782 pool_list_remove(cb->cb_list, zhp); in refresh_iostat()
5800 if (cb->cb_iteration == 1) in print_iostat()
5814 if ((ret != 0) && !(cb->cb_flags & IOS_ANYHISTO_M) && in print_iostat()
5815 !cb->cb_scripted && cb->cb_verbose && in print_iostat()
5816 !cb->cb_vdevs.cb_names_count) { in print_iostat()
5818 if (cb->vcdl != NULL) { in print_iostat()
5819 print_cmd_columns(cb->vcdl, 1); in print_iostat()
5884 if (argc > 0 && zfs_isnumber(argv[argc - 1])) { in get_interval_count()
5888 interval = strtof(argv[argc - 1], &end); in get_interval_count()
5899 argc--; in get_interval_count()
5914 if (argc > 0 && zfs_isnumber(argv[argc - 1])) { in get_interval_count()
5919 interval = strtof(argv[argc - 1], &end); in get_interval_count()
5931 argc--; in get_interval_count()
6012 uint64_t mask = -1; in get_stat_flags()
6023 * Return 1 if cb_data->cb_names[0] is this vdev's name, 0 otherwise.
6035 return (guid == zpool_vdev_path_to_guid(zhp, cb->cb_names[0])); in is_vdev_cb()
6039 * Returns 1 if cb_data->cb_names[0] is a vdev name, 0 otherwise.
6069 tmp_name = cb->cb_names; in are_vdevs_in_pool()
6073 cb->cb_names = argv + i; in are_vdevs_in_pool()
6084 cb->cb_names = tmp_name; in are_vdevs_in_pool()
6116 while (--argc >= 0) in are_all_pools()
6163 if (*argc >= 1 && !are_vdevs_in_pool(1, &argv[*argc - 1], NULL, in get_interval_count_filter_guids()
6164 &cb->cb_vdevs)) { in get_interval_count_filter_guids()
6172 !are_vdevs_in_pool(1, &argv[*argc - 2], NULL, in get_interval_count_filter_guids()
6173 &cb->cb_vdevs)) { in get_interval_count_filter_guids()
6183 tmpargv = &argv[*argc - argc_for_interval]; in get_interval_count_filter_guids()
6185 *argc = *argc - argc_for_interval; in get_interval_count_filter_guids()
6191 * Terminal height, in rows. Returns -1 if stdout is not connected to a TTY or
6200 return (-1); in terminal_height()
6202 if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) != -1 && win.ws_row > 0) in terminal_height()
6205 return (-1); in terminal_height()
6209 * Run one of the zpool status/iostat -c scripts with the help (-h) option and
6218 char *argv[] = {path, (char *)"-h", NULL}; in print_zpool_script_help()
6233 printf(" %-14s %s\n", name, lines[i]); in print_zpool_script_help()
6239 * Go though the zpool status/iostat -c scripts in the user's path, run their
6240 * help option (-h), and print out the results.
6254 dirpath, ent->d_name) >= sizeof (fullpath)) { in print_zpool_dir_scripts()
6265 print_zpool_script_help(ent->d_name, in print_zpool_dir_scripts()
6273 * Print out help text for all zpool status/iostat -c scripts.
6280 printf(gettext("Available 'zpool %s -c' commands:\n"), subcommand); in print_zpool_script_list()
6296 * but may be as large as the column width - 42 so it still fits on one line.
6309 width = get_namewidth(zhp, cb->cb_namewidth, in get_namewidth_iostat()
6310 cb->cb_vdevs.cb_name_flags | VDEV_NAME_TYPE_ID, cb->cb_verbose); in get_namewidth_iostat()
6317 available_width = get_columns() - 42; in get_namewidth_iostat()
6339 cb->cb_namewidth = width; in get_namewidth_iostat()
6345 * zpool iostat [[-c [script1,script2,...]] [-lq]|[-rw]] [-ghHLpPvy] [-n name]
6346 * [-T d|u] [[ pool ...]|[pool vdev ...]|[vdev ...]]
6349 * -c CMD For each vdev, run command CMD
6350 * -g Display guid for individual vdev name.
6351 * -L Follow links when resolving vdev path name.
6352 * -P Display full path for vdev name.
6353 * -v Display statistics for individual vdevs
6354 * -h Display help
6355 * -p Display values in parsable (exact) format.
6356 * -H Scripted mode. Don't display headers, and separate properties
6358 * -l Display average latency
6359 * -q Display queue depths
6360 * -w Display latency histograms
6361 * -r Display request size histogram
6362 * -T Display a timestamp in date(1) or Unix format
6363 * -n Only print headers once
6399 while ((c = getopt(argc, argv, "c:gLPT:vyhplqrwnH")) != -1) { in zpool_do_iostat()
6404 gettext("Can't set -c flag twice\n")); in zpool_do_iostat()
6411 "Can't run -c, disabled by " in zpool_do_iostat()
6419 "Can't run -c with root privileges " in zpool_do_iostat()
6480 argc -= optind; in zpool_do_iostat()
6515 if (are_vdevs_in_pool(argc - 1, argv + 1, argv[0], in zpool_do_iostat()
6519 cb.cb_vdevs.cb_names_count = argc - 1; in zpool_do_iostat()
6526 error_list_unresolved_vdevs(argc - 1, argv + 1, in zpool_do_iostat()
6571 gettext("[-r|-w] isn't allowed with [-c|-l|-q]\n")); in zpool_do_iostat()
6579 gettext("Only one of [-r|-w] can be passed at a time\n")); in zpool_do_iostat()
6618 idx = lowbit64(f) - 1; in zpool_do_iostat()
6619 fprintf(stderr, " -%c", flag_to_arg[idx]); in zpool_do_iostat()
6633 * If this is the first iteration and -y was supplied in zpool_do_iostat()
6685 * or either skip or verbose mode, print the header. in zpool_do_iostat()
6708 * verbose mode (which prints a separator for us), in zpool_do_iostat()
6733 if (count != 0 && --count == 0) in zpool_do_iostat()
6765 zprop_list_t *pl = cb->cb_proplist; in print_header()
6772 for (; pl != NULL; pl = pl->pl_next) { in print_header()
6773 width = pl->pl_width; in print_header()
6774 if (first && cb->cb_verbose) { in print_header()
6779 width = cb->cb_namewidth; in print_header()
6788 if (pl->pl_prop != ZPROP_USERPROP) { in print_header()
6789 header = zpool_prop_column_name(pl->pl_prop); in print_header()
6790 right_justify = zpool_prop_align_right(pl->pl_prop); in print_header()
6794 for (i = 0; pl->pl_user_prop[i] != '\0'; i++) in print_header()
6795 headerbuf[i] = toupper(pl->pl_user_prop[i]); in print_header()
6800 if (pl->pl_next == NULL && !right_justify) in print_header()
6805 (void) printf("%-*s", (int)width, header); in print_header()
6818 zprop_list_t *pl = cb->cb_proplist; in collect_pool()
6828 if (cb->cb_json) { in collect_pool()
6831 d = fnvlist_lookup_nvlist(cb->cb_jsobj, "pools"); in collect_pool()
6836 fill_pool_info(item, zhp, B_TRUE, cb->cb_json_as_int); in collect_pool()
6839 for (; pl != NULL; pl = pl->pl_next) { in collect_pool()
6841 width = pl->pl_width; in collect_pool()
6842 if (first && cb->cb_verbose) { in collect_pool()
6847 width = cb->cb_namewidth; in collect_pool()
6850 if (!cb->cb_json && !first) { in collect_pool()
6851 if (cb->cb_scripted) in collect_pool()
6860 if (pl->pl_prop != ZPROP_USERPROP) { in collect_pool()
6861 if (zpool_get_prop(zhp, pl->pl_prop, property, in collect_pool()
6863 cb->cb_literal) != 0) in collect_pool()
6864 propstr = "-"; in collect_pool()
6868 right_justify = zpool_prop_align_right(pl->pl_prop); in collect_pool()
6869 } else if ((zpool_prop_feature(pl->pl_user_prop) || in collect_pool()
6870 zpool_prop_unsupported(pl->pl_user_prop)) && in collect_pool()
6871 zpool_prop_get_feature(zhp, pl->pl_user_prop, property, in collect_pool()
6875 } else if (zfs_prop_user(pl->pl_user_prop) && in collect_pool()
6876 zpool_get_userprop(zhp, pl->pl_user_prop, property, in collect_pool()
6880 propstr = "-"; in collect_pool()
6883 if (cb->cb_json) { in collect_pool()
6884 if (pl->pl_prop == ZPOOL_PROP_NAME) in collect_pool()
6887 if (pl->pl_prop != ZPROP_USERPROP) in collect_pool()
6888 prop_name = zpool_prop_to_name(pl->pl_prop); in collect_pool()
6890 prop_name = pl->pl_user_prop; in collect_pool()
6893 sourcetype, NULL, NULL, props, cb->cb_json_as_int); in collect_pool()
6896 * If this is being called in scripted mode, or if this in collect_pool()
6897 * is the last column and it is left-justified, don't in collect_pool()
6900 if (cb->cb_scripted || (pl->pl_next == NULL && in collect_pool()
6906 (void) printf("%-*s", (int)width, propstr); in collect_pool()
6910 if (cb->cb_json) { in collect_pool()
6912 if (cb->cb_json_pool_key_guid) { in collect_pool()
6946 (void) strlcpy(propval, "-", sizeof (propval)); in collect_vdev_prop()
6953 (void) strlcpy(propval, "-", sizeof (propval)); in collect_vdev_prop()
6963 /* capacity value is in parts-per-10,000 (aka permyriad) */ in collect_vdev_prop()
6981 (void) strlcpy(propval, "-", sizeof (propval)); in collect_vdev_prop()
6996 * not compatible with '-o' <proplist> option
7006 boolean_t scripted = cb->cb_scripted; in collect_list_stats()
7010 const char *dashes = "%-*s - - - - " in collect_list_stats()
7011 "- - - - -\n"; in collect_list_stats()
7017 boolean_t toplevel = (vs->vs_space != 0); in collect_list_stats()
7022 if (cb->cb_literal) in collect_list_stats()
7030 if (cb->cb_json) { in collect_list_stats()
7034 cb->cb_json_as_int); in collect_list_stats()
7038 else if (strlen(name) + depth > cb->cb_namewidth) in collect_list_stats()
7042 (int)(cb->cb_namewidth - strlen(name) - in collect_list_stats()
7052 if (VDEV_STAT_VALID(vs_pspace, c) && vs->vs_pspace) { in collect_list_stats()
7053 collect_vdev_prop(ZPOOL_PROP_SIZE, vs->vs_pspace, NULL, in collect_list_stats()
7054 scripted, B_TRUE, format, cb->cb_json, props, in collect_list_stats()
7055 cb->cb_json_as_int); in collect_list_stats()
7057 collect_vdev_prop(ZPOOL_PROP_SIZE, vs->vs_space, NULL, in collect_list_stats()
7058 scripted, toplevel, format, cb->cb_json, props, in collect_list_stats()
7059 cb->cb_json_as_int); in collect_list_stats()
7061 collect_vdev_prop(ZPOOL_PROP_ALLOCATED, vs->vs_alloc, NULL, in collect_list_stats()
7062 scripted, toplevel, format, cb->cb_json, props, in collect_list_stats()
7063 cb->cb_json_as_int); in collect_list_stats()
7064 collect_vdev_prop(ZPOOL_PROP_FREE, vs->vs_space - vs->vs_alloc, in collect_list_stats()
7065 NULL, scripted, toplevel, format, cb->cb_json, props, in collect_list_stats()
7066 cb->cb_json_as_int); in collect_list_stats()
7068 vs->vs_checkpoint_space, NULL, scripted, toplevel, format, in collect_list_stats()
7069 cb->cb_json, props, cb->cb_json_as_int); in collect_list_stats()
7070 collect_vdev_prop(ZPOOL_PROP_EXPANDSZ, vs->vs_esize, NULL, in collect_list_stats()
7071 scripted, B_TRUE, format, cb->cb_json, props, in collect_list_stats()
7072 cb->cb_json_as_int); in collect_list_stats()
7074 vs->vs_fragmentation, NULL, scripted, in collect_list_stats()
7075 (vs->vs_fragmentation != ZFS_FRAG_INVALID && toplevel), in collect_list_stats()
7076 format, cb->cb_json, props, cb->cb_json_as_int); in collect_list_stats()
7077 cap = (vs->vs_space == 0) ? 0 : in collect_list_stats()
7078 (vs->vs_alloc * 10000 / vs->vs_space); in collect_list_stats()
7080 scripted, toplevel, format, cb->cb_json, props, in collect_list_stats()
7081 cb->cb_json_as_int); in collect_list_stats()
7083 scripted, toplevel, format, cb->cb_json, props, in collect_list_stats()
7084 cb->cb_json_as_int); in collect_list_stats()
7085 state = zpool_state_to_name(vs->vs_state, vs->vs_aux); in collect_list_stats()
7087 if (vs->vs_aux == VDEV_AUX_SPARED) in collect_list_stats()
7089 else if (vs->vs_state == VDEV_STATE_HEALTHY) in collect_list_stats()
7093 B_TRUE, format, cb->cb_json, props, cb->cb_json_as_int); in collect_list_stats()
7095 if (cb->cb_json) { in collect_list_stats()
7104 if (cb->cb_json) { in collect_list_stats()
7111 if (cb->cb_json) { in collect_list_stats()
7131 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in collect_list_stats()
7133 if (name == NULL || cb->cb_json != B_TRUE) in collect_list_stats()
7136 else if (cb->cb_json) { in collect_list_stats()
7143 if (cb->cb_json) { in collect_list_stats()
7152 if (cb->cb_json) in collect_list_stats()
7172 if (!printed && !cb->cb_json) { in collect_list_stats()
7174 (void) printf(dashes, cb->cb_namewidth, in collect_list_stats()
7179 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in collect_list_stats()
7184 if (cb->cb_json) { in collect_list_stats()
7193 if (cb->cb_json) { in collect_list_stats()
7197 (void) printf(dashes, cb->cb_namewidth, "cache"); in collect_list_stats()
7201 cb->cb_name_flags); in collect_list_stats()
7206 if (cb->cb_json) { in collect_list_stats()
7215 if (cb->cb_json) { in collect_list_stats()
7219 (void) printf(dashes, cb->cb_namewidth, "spare"); in collect_list_stats()
7223 cb->cb_name_flags); in collect_list_stats()
7228 if (cb->cb_json) { in collect_list_stats()
7235 if (name != NULL && cb->cb_json) { in collect_list_stats()
7256 if (cbp->cb_verbose) { in list_callback()
7261 if (cbp->cb_json) { in list_callback()
7262 d = fnvlist_lookup_nvlist(cbp->cb_jsobj, in list_callback()
7264 if (cbp->cb_json_pool_key_guid) { in list_callback()
7276 if (cbp->cb_json) { in list_callback()
7278 if (cbp->cb_json_pool_key_guid) in list_callback()
7282 fnvlist_add_nvlist(cbp->cb_jsobj, "pools", d); in list_callback()
7300 width = get_namewidth(zhp, cb->cb_namewidth, in get_namewidth_list()
7301 cb->cb_name_flags | VDEV_NAME_TYPE_ID, cb->cb_verbose); in get_namewidth_list()
7306 cb->cb_namewidth = width; in get_namewidth_list()
7312 * zpool list [-gHLpP] [-o prop[,prop]*] [-T d|u] [pool] ... [interval [count]]
7314 * -g Display guid for individual vdev name.
7315 * -H Scripted mode. Don't display headers, and separate properties
7317 * -L Follow links when resolving vdev path name.
7318 * -o List of properties to display. Defaults to
7321 * -p Display values in parsable (exact) format.
7322 * -P Display full path for vdev name.
7323 * -T Display a timestamp in date(1) or Unix format
7324 * -j Display the output in JSON format
7325 * --json-int Display the numbers as integer instead of strings.
7326 * --json-pool-key-guid Set pool GUID as key for pool objects.
7350 {"json-int", no_argument, NULL, ZPOOL_OPTION_JSON_NUMS_AS_INT}, in zpool_do_list()
7351 {"json-pool-key-guid", no_argument, NULL, in zpool_do_list()
7358 NULL)) != -1) { in zpool_do_list()
7407 argc -= optind; in zpool_do_list()
7411 (void) fprintf(stderr, gettext("'--json-int' only works with" in zpool_do_list()
7412 " '-j' option\n")); in zpool_do_list()
7417 (void) fprintf(stderr, gettext("'json-pool-key-guid' only" in zpool_do_list()
7418 " works with '-j' option\n")); in zpool_do_list()
7475 if (count != 0 && --count == 0) in zpool_do_list()
7510 while ((c = getopt(argc, argv, "fo:sw")) != -1) { in zpool_do_attach_or_replace()
7518 "'=' for -o option\n")); in zpool_do_attach_or_replace()
7541 argc -= optind; in zpool_do_attach_or_replace()
7567 argc -= 1; in zpool_do_attach_or_replace()
7571 argc -= 2; in zpool_do_attach_or_replace()
7638 * zpool replace [-fsw] [-o property=value] <pool> <device> <new_device>
7640 * -f Force attach, even if <new_device> appears to be in use.
7641 * -s Use sequential instead of healing reconstruction for resilver.
7642 * -o Set property=value.
7643 * -w Wait for replacing to complete before returning
7654 * zpool attach [-fsw] [-o property=value] <pool> <device>|<vdev> <new_device>
7656 * -f Force attach, even if <new_device> appears to be in use.
7657 * -s Use sequential instead of healing reconstruction for resilver.
7658 * -o Set property=value.
7659 * -w Wait for resilvering (mirror) or expansion (raidz) to complete
7677 * zpool detach [-f] <pool> <device>
7679 * -f Force detach of <device>, even if DTLs argue against it
7695 while ((c = getopt(argc, argv, "")) != -1) { in zpool_do_detach()
7704 argc -= optind; in zpool_do_detach()
7733 * zpool split [-gLnP] [-o prop=val] ...
7734 * [-o mntopt] ...
7735 * [-R altroot] <pool> <newpool> [<device> ...]
7737 * -g Display guid for individual vdev name.
7738 * -L Follow links when resolving vdev path name.
7739 * -n Do not split the pool, but display the resulting layout if
7741 * -o Set property=value, or set mount options.
7742 * -P Display full path for vdev name.
7743 * -R Mount the split-off pool under an alternate root.
7744 * -l Load encryption keys while importing.
7748 * per top-level vdev mirror. The newly split pool is left in an exported
7749 * state unless -R is specified.
7751 * Restrictions: the top-level of the pool pool must only be made up of
7772 while ((c = getopt(argc, argv, ":gLR:lno:P")) != -1) { in zpool_do_split()
7836 argc -= optind; in zpool_do_split()
7851 argc -= 2; in zpool_do_split()
7922 * zpool online [--power] <pool> <device> ...
7924 * --power: Power on the enclosure slot to the drive (if possible)
7942 while ((c = getopt_long(argc, argv, "e", long_options, NULL)) != -1) { in zpool_do_online()
7960 argc -= optind; in zpool_do_online()
8006 ZPOOL_CONFIG_VDEV_STATS, &vsc))->vs_state; in zpool_do_online()
8047 * zpool offline [-ft]|[--power] <pool> <device> ...
8050 * -f Force the device into a faulted state.
8052 * -t Only take the device off-line temporarily. The offline/faulted
8055 * --power Power off the enclosure slot to the drive (if possible)
8074 while ((c = getopt_long(argc, argv, "ft", long_options, NULL)) != -1) { in zpool_do_offline()
8094 gettext("-0 and -f cannot be used together\n")); in zpool_do_offline()
8101 gettext("-0 and -t cannot be used together\n")); in zpool_do_offline()
8106 argc -= optind; in zpool_do_offline()
8166 * zpool clear [-nF]|[--power] <pool> [device]
8191 NULL)) != -1) { in zpool_do_clear()
8215 argc -= optind; in zpool_do_clear()
8230 gettext("-n or -X only meaningful with -F\n")); in zpool_do_clear()
8274 * zpool reguid [-g <guid>] <pool>
8288 while ((c = getopt(argc, argv, "g:")) != -1) { in zpool_do_reguid()
8307 argc -= optind; in zpool_do_reguid()
8345 while ((c = getopt(argc, argv, "n")) != -1) { in zpool_do_reopen()
8357 argc -= optind; in zpool_do_reopen()
8387 if (pcs == NULL || pcs->pcs_state == CS_NONE) in zpool_has_checkpoint()
8390 assert(pcs->pcs_state == CS_CHECKPOINT_EXISTS || in zpool_has_checkpoint()
8391 pcs->pcs_state == CS_CHECKPOINT_DISCARDING); in zpool_has_checkpoint()
8413 err = zpool_scan(zhp, cb->cb_type, cb->cb_scrub_cmd); in scrub_callback()
8416 cb->cb_type == POOL_SCAN_SCRUB) { in scrub_callback()
8433 * zpool scrub [-e | -s | -p | -C] [-w] <pool> ...
8435 * -e Only scrub blocks in the error log.
8436 * -s Stop. Stops any in-progress scrub.
8437 * -p Pause. Pause in-progress scrub.
8438 * -w Wait. Blocks until scrub has completed.
8439 * -C Scrub from last saved txg.
8458 while ((c = getopt(argc, argv, "spweC")) != -1) { in zpool_do_scrub()
8484 "combination :-s and -p are mutually exclusive\n")); in zpool_do_scrub()
8488 "combination :-p and -C are mutually exclusive\n")); in zpool_do_scrub()
8492 "combination :-s and -C are mutually exclusive\n")); in zpool_do_scrub()
8496 "combination :-e and -C are mutually exclusive\n")); in zpool_do_scrub()
8516 "-w cannot be used with -p or -s\n")); in zpool_do_scrub()
8520 argc -= optind; in zpool_do_scrub()
8543 * Restarts any in-progress resilver
8555 while ((c = getopt(argc, argv, "")) != -1) { in zpool_do_resilver()
8564 argc -= optind; in zpool_do_resilver()
8577 * zpool trim [-d] [-r <rate>] [-c | -s] <pool> [<device> ...]
8579 * -c Cancel. Ends any in-progress trim.
8580 * -d Secure trim. Requires kernel and device support.
8581 * -r <rate> Sets the TRIM rate in bytes (per second). Supports
8583 * -s Suspend. TRIM can then be restarted with no flags.
8584 * -w Wait. Blocks until trimming has completed.
8604 while ((c = getopt_long(argc, argv, "cdr:sw", long_options, NULL)) in zpool_do_trim()
8605 != -1) { in zpool_do_trim()
8610 (void) fprintf(stderr, gettext("-c cannot be " in zpool_do_trim()
8618 (void) fprintf(stderr, gettext("-d cannot be " in zpool_do_trim()
8619 "combined with the -c or -s options\n")); in zpool_do_trim()
8626 (void) fprintf(stderr, gettext("-r cannot be " in zpool_do_trim()
8627 "combined with the -c or -s options\n")); in zpool_do_trim()
8630 if (zfs_nicestrtonum(g_zfs, optarg, &rate) == -1) { in zpool_do_trim()
8640 (void) fprintf(stderr, gettext("-s cannot be " in zpool_do_trim()
8656 argv[optind - 1]); in zpool_do_trim()
8662 argc -= optind; in zpool_do_trim()
8668 return (-1); in zpool_do_trim()
8672 (void) fprintf(stderr, gettext("-w cannot be used with -c or " in zpool_do_trim()
8673 "-s\n")); in zpool_do_trim()
8680 return (-1); in zpool_do_trim()
8745 if (ps == NULL || ps->pss_error_scrub_func != POOL_SCAN_ERRORSCRUB) { in print_err_scrub_status()
8751 start = ps->pss_error_scrub_start; in print_err_scrub_status()
8752 end = ps->pss_error_scrub_end; in print_err_scrub_status()
8753 pause = ps->pss_pass_error_scrub_pause; in print_err_scrub_status()
8754 examined = ps->pss_error_scrub_examined; in print_err_scrub_status()
8755 to_be_examined = ps->pss_error_scrub_to_be_examined; in print_err_scrub_status()
8757 assert(ps->pss_error_scrub_func == POOL_SCAN_ERRORSCRUB); in print_err_scrub_status()
8759 if (ps->pss_error_scrub_state == DSS_FINISHED) { in print_err_scrub_status()
8760 total_secs_left = end - start; in print_err_scrub_status()
8773 } else if (ps->pss_error_scrub_state == DSS_CANCELED) { in print_err_scrub_status()
8778 assert(ps->pss_error_scrub_state == DSS_ERRORSCRUBBING); in print_err_scrub_status()
8816 if (ps == NULL || ps->pss_func == POOL_SCAN_NONE || in print_scan_scrub_resilver_status()
8817 ps->pss_func >= POOL_SCAN_FUNCS) { in print_scan_scrub_resilver_status()
8822 start = ps->pss_start_time; in print_scan_scrub_resilver_status()
8823 end = ps->pss_end_time; in print_scan_scrub_resilver_status()
8824 pause = ps->pss_pass_scrub_pause; in print_scan_scrub_resilver_status()
8826 zfs_nicebytes(ps->pss_processed, processed_buf, sizeof (processed_buf)); in print_scan_scrub_resilver_status()
8828 int is_resilver = ps->pss_func == POOL_SCAN_RESILVER; in print_scan_scrub_resilver_status()
8829 int is_scrub = ps->pss_func == POOL_SCAN_SCRUB; in print_scan_scrub_resilver_status()
8833 if (ps->pss_state == DSS_FINISHED) { in print_scan_scrub_resilver_status()
8834 secs_to_dhms(end - start, time_buf); in print_scan_scrub_resilver_status()
8839 time_buf, (u_longlong_t)ps->pss_errors, in print_scan_scrub_resilver_status()
8844 time_buf, (u_longlong_t)ps->pss_errors, in print_scan_scrub_resilver_status()
8848 } else if (ps->pss_state == DSS_CANCELED) { in print_scan_scrub_resilver_status()
8859 assert(ps->pss_state == DSS_SCANNING); in print_scan_scrub_resilver_status()
8877 scanned = ps->pss_examined; in print_scan_scrub_resilver_status()
8878 pass_scanned = ps->pss_pass_exam; in print_scan_scrub_resilver_status()
8879 issued = ps->pss_issued; in print_scan_scrub_resilver_status()
8880 pass_issued = ps->pss_pass_issued; in print_scan_scrub_resilver_status()
8881 total_s = ps->pss_to_examine; in print_scan_scrub_resilver_status()
8882 total_i = ps->pss_to_examine - ps->pss_skipped; in print_scan_scrub_resilver_status()
8888 elapsed = time(NULL) - ps->pss_pass_start; in print_scan_scrub_resilver_status()
8889 elapsed -= ps->pss_pass_scrub_spent_paused; in print_scan_scrub_resilver_status()
8932 ((is_resilver && ps->pss_processed > 0) || in print_scan_scrub_resilver_status()
8934 secs_to_dhms((total_i - issued) / issue_rate, time_buf); in print_scan_scrub_resilver_status()
8948 if (vrs == NULL || vrs->vrs_state == VDEV_REBUILD_NONE) in print_rebuild_status_impl()
8955 uint64_t bytes_scanned = vrs->vrs_bytes_scanned; in print_rebuild_status_impl()
8956 uint64_t bytes_issued = vrs->vrs_bytes_issued; in print_rebuild_status_impl()
8957 uint64_t bytes_rebuilt = vrs->vrs_bytes_rebuilt; in print_rebuild_status_impl()
8958 uint64_t bytes_est_s = vrs->vrs_bytes_est; in print_rebuild_status_impl()
8959 uint64_t bytes_est_i = vrs->vrs_bytes_est; in print_rebuild_status_impl()
8961 bytes_est_i -= vrs->vrs_pass_bytes_skipped; in print_rebuild_status_impl()
8962 uint64_t scan_rate = (vrs->vrs_pass_bytes_scanned / in print_rebuild_status_impl()
8963 (vrs->vrs_pass_time_ms + 1)) * 1000; in print_rebuild_status_impl()
8964 uint64_t issue_rate = (vrs->vrs_pass_bytes_issued / in print_rebuild_status_impl()
8965 (vrs->vrs_pass_time_ms + 1)) * 1000; in print_rebuild_status_impl()
8982 time_t start = vrs->vrs_start_time; in print_rebuild_status_impl()
8983 time_t end = vrs->vrs_end_time; in print_rebuild_status_impl()
8986 if (vrs->vrs_state == VDEV_REBUILD_COMPLETE) { in print_rebuild_status_impl()
8987 secs_to_dhms(vrs->vrs_scan_time_ms / 1000, time_buf); in print_rebuild_status_impl()
8990 time_buf, (u_longlong_t)vrs->vrs_errors, ctime(&end)); in print_rebuild_status_impl()
8992 } else if (vrs->vrs_state == VDEV_REBUILD_CANCELED) { in print_rebuild_status_impl()
8996 } else if (vrs->vrs_state == VDEV_REBUILD_ACTIVE) { in print_rebuild_status_impl()
9001 assert(vrs->vrs_state == VDEV_REBUILD_ACTIVE); in print_rebuild_status_impl()
9021 if (vrs->vrs_state == VDEV_REBUILD_ACTIVE) { in print_rebuild_status_impl()
9024 secs_to_dhms((bytes_est_s - bytes_scanned) / scan_rate, in print_rebuild_status_impl()
9037 * Print rebuild status for top-level vdevs.
9076 if (pcs->pcs_state == CS_NONE || in print_checkpoint_scan_warning()
9077 pcs->pcs_state == CS_CHECKPOINT_DISCARDING) in print_checkpoint_scan_warning()
9080 assert(pcs->pcs_state == CS_CHECKPOINT_EXISTS); in print_checkpoint_scan_warning()
9082 if (ps->pss_state == DSS_NONE) in print_checkpoint_scan_warning()
9085 if ((ps->pss_state == DSS_FINISHED || ps->pss_state == DSS_CANCELED) && in print_checkpoint_scan_warning()
9086 ps->pss_end_time < pcs->pcs_start_time) in print_checkpoint_scan_warning()
9089 if (ps->pss_state == DSS_FINISHED || ps->pss_state == DSS_CANCELED) { in print_checkpoint_scan_warning()
9093 assert(ps->pss_state == DSS_SCANNING); in print_checkpoint_scan_warning()
9123 if (vrs->vrs_end_time > end_time) in check_rebuilding()
9124 end_time = vrs->vrs_end_time; in check_rebuilding()
9126 if (vrs->vrs_state == VDEV_REBUILD_ACTIVE) { in check_rebuilding()
9160 if (cb->cb_print_unhealthy && depth > 0 && in vdev_stats_nvlist()
9165 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in vdev_stats_nvlist()
9167 fill_vdev_info(vds, zhp, vname, B_FALSE, cb->cb_json_as_int); in vdev_stats_nvlist()
9168 if (cb->cb_flat_vdevs && parent != NULL) { in vdev_stats_nvlist()
9173 if (vs->vs_aux == VDEV_AUX_SPARED) { in vdev_stats_nvlist()
9176 } else if (vs->vs_state == VDEV_STATE_HEALTHY) in vdev_stats_nvlist()
9179 if (vs->vs_alloc) { in vdev_stats_nvlist()
9180 nice_num_str_nvlist(vds, "alloc_space", vs->vs_alloc, in vdev_stats_nvlist()
9181 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9184 if (vs->vs_space) { in vdev_stats_nvlist()
9185 nice_num_str_nvlist(vds, "total_space", vs->vs_space, in vdev_stats_nvlist()
9186 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9189 if (vs->vs_dspace) { in vdev_stats_nvlist()
9190 nice_num_str_nvlist(vds, "def_space", vs->vs_dspace, in vdev_stats_nvlist()
9191 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9194 if (vs->vs_rsize) { in vdev_stats_nvlist()
9195 nice_num_str_nvlist(vds, "rep_dev_size", vs->vs_rsize, in vdev_stats_nvlist()
9196 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9199 if (vs->vs_esize) { in vdev_stats_nvlist()
9200 nice_num_str_nvlist(vds, "ex_dev_size", vs->vs_esize, in vdev_stats_nvlist()
9201 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9204 if (vs->vs_self_healed) { in vdev_stats_nvlist()
9206 vs->vs_self_healed, cb->cb_literal, in vdev_stats_nvlist()
9207 cb->cb_json_as_int, ZFS_NICENUM_BYTES); in vdev_stats_nvlist()
9209 if (vs->vs_pspace) { in vdev_stats_nvlist()
9210 nice_num_str_nvlist(vds, "phys_space", vs->vs_pspace, in vdev_stats_nvlist()
9211 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9214 nice_num_str_nvlist(vds, "read_errors", vs->vs_read_errors, in vdev_stats_nvlist()
9215 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9216 nice_num_str_nvlist(vds, "write_errors", vs->vs_write_errors, in vdev_stats_nvlist()
9217 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9219 vs->vs_checksum_errors, cb->cb_literal, in vdev_stats_nvlist()
9220 cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9221 if (vs->vs_scan_processed) { in vdev_stats_nvlist()
9223 vs->vs_scan_processed, cb->cb_literal, in vdev_stats_nvlist()
9224 cb->cb_json_as_int, ZFS_NICENUM_BYTES); in vdev_stats_nvlist()
9226 if (vs->vs_checkpoint_space) { in vdev_stats_nvlist()
9228 vs->vs_checkpoint_space, cb->cb_literal, in vdev_stats_nvlist()
9229 cb->cb_json_as_int, ZFS_NICENUM_BYTES); in vdev_stats_nvlist()
9231 if (vs->vs_resilver_deferred) { in vdev_stats_nvlist()
9233 vs->vs_resilver_deferred, B_TRUE, in vdev_stats_nvlist()
9234 cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9237 nice_num_str_nvlist(vds, "slow_ios", vs->vs_slow_ios, in vdev_stats_nvlist()
9238 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9241 if (cb->cb_print_power) { in vdev_stats_nvlist()
9257 "-"); in vdev_stats_nvlist()
9260 fnvlist_add_string(vds, "power_state", "-"); in vdev_stats_nvlist()
9265 if (cb->cb_print_dio_verify) { in vdev_stats_nvlist()
9267 vs->vs_dio_verify_errors, cb->cb_literal, in vdev_stats_nvlist()
9268 cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9274 1, B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in vdev_stats_nvlist()
9277 } else if (vs->vs_aux != VDEV_AUX_NONE) { in vdev_stats_nvlist()
9278 fnvlist_add_string(vds, "aux", vdev_aux_str[vs->vs_aux]); in vdev_stats_nvlist()
9282 vs->vs_configured_ashift < vs->vs_physical_ashift) { in vdev_stats_nvlist()
9284 vs->vs_configured_ashift, B_TRUE, cb->cb_json_as_int, in vdev_stats_nvlist()
9287 vs->vs_physical_ashift, B_TRUE, cb->cb_json_as_int, in vdev_stats_nvlist()
9290 if (vs->vs_scan_removing != 0) { in vdev_stats_nvlist()
9291 nice_num_str_nvlist(vds, "removing", vs->vs_scan_removing, in vdev_stats_nvlist()
9292 B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9293 } else if (VDEV_STAT_VALID(vs_noalloc, vsc) && vs->vs_noalloc != 0) { in vdev_stats_nvlist()
9294 nice_num_str_nvlist(vds, "noalloc", vs->vs_noalloc, in vdev_stats_nvlist()
9295 B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9298 if (cb->vcdl != NULL) { in vdev_stats_nvlist()
9300 zpool_nvlist_cmd(cb->vcdl, zpool_get_name(zhp), in vdev_stats_nvlist()
9306 if (cb->cb_print_vdev_init) { in vdev_stats_nvlist()
9307 if (vs->vs_initialize_state != 0) { in vdev_stats_nvlist()
9308 uint64_t st = vs->vs_initialize_state; in vdev_stats_nvlist()
9312 vs->vs_initialize_bytes_done, in vdev_stats_nvlist()
9313 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9316 vs->vs_initialize_bytes_est, in vdev_stats_nvlist()
9317 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9320 vs->vs_initialize_action_time, in vdev_stats_nvlist()
9321 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9324 vs->vs_initialize_errors, in vdev_stats_nvlist()
9325 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9332 if (cb->cb_print_vdev_trim) { in vdev_stats_nvlist()
9333 if (vs->vs_trim_notsup == 0) { in vdev_stats_nvlist()
9334 if (vs->vs_trim_state != 0) { in vdev_stats_nvlist()
9335 uint64_t st = vs->vs_trim_state; in vdev_stats_nvlist()
9339 vs->vs_trim_bytes_done, in vdev_stats_nvlist()
9340 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9343 vs->vs_trim_bytes_est, in vdev_stats_nvlist()
9344 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9347 vs->vs_trim_action_time, in vdev_stats_nvlist()
9348 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9351 vs->vs_trim_errors, in vdev_stats_nvlist()
9352 cb->cb_literal, cb->cb_json_as_int, in vdev_stats_nvlist()
9359 vs->vs_trim_notsup, B_TRUE, in vdev_stats_nvlist()
9360 cb->cb_json_as_int, ZFS_NICENUM_1024); in vdev_stats_nvlist()
9366 if (cb->cb_flat_vdevs && children == 0) { in vdev_stats_nvlist()
9380 if (cb->cb_flat_vdevs) { in vdev_stats_nvlist()
9406 if (!cb->cb_flat_vdevs) in class_vdevs_nvlist()
9409 assert(zhp != NULL || !cb->cb_verbose); in class_vdevs_nvlist()
9420 cb->cb_name_flags | VDEV_NAME_TYPE_ID); in class_vdevs_nvlist()
9439 if (cb->cb_flat_vdevs) { in class_vdevs_nvlist()
9448 if (!cb->cb_flat_vdevs) { in class_vdevs_nvlist()
9465 if (!cb->cb_flat_vdevs) in l2cache_nvlist()
9468 if (cb->cb_flat_vdevs) { in l2cache_nvlist()
9477 if (!cb->cb_flat_vdevs) { in l2cache_nvlist()
9494 if (!cb->cb_flat_vdevs) in spares_nvlist()
9497 if (cb->cb_flat_vdevs) { in spares_nvlist()
9506 if (!cb->cb_flat_vdevs) { in spares_nvlist()
9521 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in errors_nvlist()
9522 if (nerr != 0 && cb->cb_verbose) { in errors_nvlist()
9569 nice_num_str_nvlist(item, "blocks", dds->dds_blocks, in ddt_stats_nvlist()
9570 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in ddt_stats_nvlist()
9571 nice_num_str_nvlist(item, "logical_size", dds->dds_lsize, in ddt_stats_nvlist()
9572 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9573 nice_num_str_nvlist(item, "physical_size", dds->dds_psize, in ddt_stats_nvlist()
9574 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9575 nice_num_str_nvlist(item, "deflated_size", dds->dds_dsize, in ddt_stats_nvlist()
9576 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9577 nice_num_str_nvlist(item, "ref_blocks", dds->dds_ref_blocks, in ddt_stats_nvlist()
9578 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in ddt_stats_nvlist()
9579 nice_num_str_nvlist(item, "ref_lsize", dds->dds_ref_lsize, in ddt_stats_nvlist()
9580 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9581 nice_num_str_nvlist(item, "ref_psize", dds->dds_ref_psize, in ddt_stats_nvlist()
9582 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9583 nice_num_str_nvlist(item, "ref_dsize", dds->dds_ref_dsize, in ddt_stats_nvlist()
9584 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in ddt_stats_nvlist()
9591 if (cb->cb_dedup_stats) { in dedup_stats_nvlist()
9606 nice_num_str_nvlist(dedup, "obj_count", ddo->ddo_count, in dedup_stats_nvlist()
9607 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in dedup_stats_nvlist()
9608 if (ddo->ddo_count == 0) { in dedup_stats_nvlist()
9616 nice_num_str_nvlist(dedup, "dspace", ddo->ddo_dspace, in dedup_stats_nvlist()
9617 cb->cb_literal, cb->cb_json_as_int, in dedup_stats_nvlist()
9619 nice_num_str_nvlist(dedup, "mspace", ddo->ddo_mspace, in dedup_stats_nvlist()
9620 cb->cb_literal, cb->cb_json_as_int, in dedup_stats_nvlist()
9623 * Squash cached size into in-core size to handle race. in dedup_stats_nvlist()
9628 cspace_prop = MIN(cspace_prop, ddo->ddo_mspace); in dedup_stats_nvlist()
9630 cb->cb_literal, cb->cb_json_as_int, in dedup_stats_nvlist()
9638 if (dds->dds_blocks == 0) in dedup_stats_nvlist()
9651 if (ddh->ddh_stat[h].dds_blocks != 0) { in dedup_stats_nvlist()
9653 ddt_stats_nvlist(&ddh->ddh_stat[h], cb, in dedup_stats_nvlist()
9694 assert(pres->pres_expanding_vdev < children); in raidz_expand_status_nvlist()
9697 child[pres->pres_expanding_vdev], 0); in raidz_expand_status_nvlist()
9698 fill_vdev_info(nv, zhp, name, B_FALSE, cb->cb_json_as_int); in raidz_expand_status_nvlist()
9700 pool_scan_state_str[pres->pres_state]); in raidz_expand_status_nvlist()
9702 pres->pres_expanding_vdev, B_TRUE, cb->cb_json_as_int, in raidz_expand_status_nvlist()
9704 nice_num_str_nvlist(nv, "start_time", pres->pres_start_time, in raidz_expand_status_nvlist()
9705 cb->cb_literal, cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in raidz_expand_status_nvlist()
9706 nice_num_str_nvlist(nv, "end_time", pres->pres_end_time, in raidz_expand_status_nvlist()
9707 cb->cb_literal, cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in raidz_expand_status_nvlist()
9708 nice_num_str_nvlist(nv, "to_reflow", pres->pres_to_reflow, in raidz_expand_status_nvlist()
9709 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in raidz_expand_status_nvlist()
9710 nice_num_str_nvlist(nv, "reflowed", pres->pres_reflowed, in raidz_expand_status_nvlist()
9711 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in raidz_expand_status_nvlist()
9713 pres->pres_waiting_for_resilver, B_TRUE, in raidz_expand_status_nvlist()
9714 cb->cb_json_as_int, ZFS_NICENUM_1024); in raidz_expand_status_nvlist()
9731 checkpoint_state_str[pcs->pcs_state]); in checkpoint_status_nvlist()
9733 pcs->pcs_start_time, cb->cb_literal, cb->cb_json_as_int, in checkpoint_status_nvlist()
9736 pcs->pcs_space, cb->cb_literal, cb->cb_json_as_int, in checkpoint_status_nvlist()
9751 if (prs->prs_state != DSS_NONE) { in removal_status_nvlist()
9756 assert(prs->prs_removing_vdev < children); in removal_status_nvlist()
9758 child[prs->prs_removing_vdev], B_TRUE); in removal_status_nvlist()
9761 cb->cb_json_as_int); in removal_status_nvlist()
9763 pool_scan_state_str[prs->prs_state]); in removal_status_nvlist()
9765 prs->prs_removing_vdev, B_TRUE, cb->cb_json_as_int, in removal_status_nvlist()
9768 prs->prs_start_time, cb->cb_literal, in removal_status_nvlist()
9769 cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in removal_status_nvlist()
9770 nice_num_str_nvlist(nv, "end_time", prs->prs_end_time, in removal_status_nvlist()
9771 cb->cb_literal, cb->cb_json_as_int, in removal_status_nvlist()
9773 nice_num_str_nvlist(nv, "to_copy", prs->prs_to_copy, in removal_status_nvlist()
9774 cb->cb_literal, cb->cb_json_as_int, in removal_status_nvlist()
9776 nice_num_str_nvlist(nv, "copied", prs->prs_copied, in removal_status_nvlist()
9777 cb->cb_literal, cb->cb_json_as_int, in removal_status_nvlist()
9780 prs->prs_mapping_memory, cb->cb_literal, in removal_status_nvlist()
9781 cb->cb_json_as_int, ZFS_NICENUM_BYTES); in removal_status_nvlist()
9803 pool_scan_func_str[ps->pss_func]); in scan_status_nvlist()
9805 pool_scan_state_str[ps->pss_state]); in scan_status_nvlist()
9806 nice_num_str_nvlist(scan, "start_time", ps->pss_start_time, in scan_status_nvlist()
9807 cb->cb_literal, cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in scan_status_nvlist()
9808 nice_num_str_nvlist(scan, "end_time", ps->pss_end_time, in scan_status_nvlist()
9809 cb->cb_literal, cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in scan_status_nvlist()
9810 nice_num_str_nvlist(scan, "to_examine", ps->pss_to_examine, in scan_status_nvlist()
9811 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9812 nice_num_str_nvlist(scan, "examined", ps->pss_examined, in scan_status_nvlist()
9813 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9814 nice_num_str_nvlist(scan, "skipped", ps->pss_skipped, in scan_status_nvlist()
9815 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9816 nice_num_str_nvlist(scan, "processed", ps->pss_processed, in scan_status_nvlist()
9817 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9818 nice_num_str_nvlist(scan, "errors", ps->pss_errors, in scan_status_nvlist()
9819 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_1024); in scan_status_nvlist()
9820 nice_num_str_nvlist(scan, "bytes_per_scan", ps->pss_pass_exam, in scan_status_nvlist()
9821 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9822 nice_num_str_nvlist(scan, "pass_start", ps->pss_pass_start, in scan_status_nvlist()
9823 B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_1024); in scan_status_nvlist()
9825 ps->pss_pass_scrub_pause, cb->cb_literal, in scan_status_nvlist()
9826 cb->cb_json_as_int, ZFS_NICE_TIMESTAMP); in scan_status_nvlist()
9828 ps->pss_pass_scrub_spent_paused, in scan_status_nvlist()
9829 B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_1024); in scan_status_nvlist()
9831 ps->pss_pass_issued, cb->cb_literal, in scan_status_nvlist()
9832 cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9833 nice_num_str_nvlist(scan, "issued", ps->pss_issued, in scan_status_nvlist()
9834 cb->cb_literal, cb->cb_json_as_int, ZFS_NICENUM_BYTES); in scan_status_nvlist()
9835 if (ps->pss_error_scrub_func == POOL_SCAN_ERRORSCRUB && in scan_status_nvlist()
9836 ps->pss_error_scrub_start > ps->pss_start_time) { in scan_status_nvlist()
9838 pool_scan_func_str[ps->pss_error_scrub_func]); in scan_status_nvlist()
9840 pool_scan_state_str[ps->pss_error_scrub_state]); in scan_status_nvlist()
9842 ps->pss_error_scrub_start, in scan_status_nvlist()
9843 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9846 ps->pss_error_scrub_end, in scan_status_nvlist()
9847 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9850 ps->pss_error_scrub_examined, in scan_status_nvlist()
9851 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9854 ps->pss_error_scrub_to_be_examined, in scan_status_nvlist()
9855 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9858 ps->pss_pass_error_scrub_pause, in scan_status_nvlist()
9859 B_TRUE, cb->cb_json_as_int, ZFS_NICENUM_1024); in scan_status_nvlist()
9875 if (vrs->vrs_state != VDEV_REBUILD_NONE) { in scan_status_nvlist()
9880 cb->cb_json_as_int); in scan_status_nvlist()
9881 st = vrs->vrs_state; in scan_status_nvlist()
9885 vrs->vrs_start_time, cb->cb_literal, in scan_status_nvlist()
9886 cb->cb_json_as_int, in scan_status_nvlist()
9889 vrs->vrs_end_time, cb->cb_literal, in scan_status_nvlist()
9890 cb->cb_json_as_int, in scan_status_nvlist()
9893 vrs->vrs_scan_time_ms * 1000000, in scan_status_nvlist()
9894 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9897 vrs->vrs_bytes_scanned, in scan_status_nvlist()
9898 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9901 vrs->vrs_bytes_issued, in scan_status_nvlist()
9902 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9905 vrs->vrs_bytes_rebuilt, in scan_status_nvlist()
9906 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9909 vrs->vrs_bytes_est, cb->cb_literal, in scan_status_nvlist()
9910 cb->cb_json_as_int, in scan_status_nvlist()
9913 vrs->vrs_errors, cb->cb_literal, in scan_status_nvlist()
9914 cb->cb_json_as_int, in scan_status_nvlist()
9917 vrs->vrs_pass_time_ms * 1000000, in scan_status_nvlist()
9918 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9921 vrs->vrs_pass_bytes_scanned, in scan_status_nvlist()
9922 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9925 vrs->vrs_pass_bytes_issued, in scan_status_nvlist()
9926 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9929 vrs->vrs_pass_bytes_skipped, in scan_status_nvlist()
9930 cb->cb_literal, cb->cb_json_as_int, in scan_status_nvlist()
9964 if (ps->pss_func == POOL_SCAN_RESILVER) { in print_scan_status()
9965 resilver_end_time = ps->pss_end_time; in print_scan_status()
9966 active_resilver = (ps->pss_state == DSS_SCANNING); in print_scan_status()
9969 have_resilver = (ps->pss_func == POOL_SCAN_RESILVER); in print_scan_status()
9970 have_scrub = (ps->pss_func == POOL_SCAN_SCRUB); in print_scan_status()
9971 scrub_start = ps->pss_start_time; in print_scan_status()
9974 have_errorscrub = (ps->pss_error_scrub_func == in print_scan_status()
9976 errorscrub_start = ps->pss_error_scrub_start; in print_scan_status()
10019 if (prs == NULL || prs->prs_state == DSS_NONE) in print_removal_status()
10030 assert(prs->prs_removing_vdev < children); in print_removal_status()
10032 child[prs->prs_removing_vdev], B_TRUE); in print_removal_status()
10036 start = prs->prs_start_time; in print_removal_status()
10037 end = prs->prs_end_time; in print_removal_status()
10038 zfs_nicenum(prs->prs_copied, copied_buf, sizeof (copied_buf)); in print_removal_status()
10043 if (prs->prs_state == DSS_FINISHED) { in print_removal_status()
10044 uint64_t minutes_taken = (end - start) / 60; in print_removal_status()
10048 (longlong_t)prs->prs_removing_vdev, in print_removal_status()
10053 } else if (prs->prs_state == DSS_CANCELED) { in print_removal_status()
10060 assert(prs->prs_state == DSS_SCANNING); in print_removal_status()
10069 copied = prs->prs_copied > 0 ? prs->prs_copied : 1; in print_removal_status()
10070 total = prs->prs_to_copy; in print_removal_status()
10074 elapsed = time(NULL) - prs->prs_start_time; in print_removal_status()
10078 mins_left = ((total - copied) / rate) / 60; in print_removal_status()
10102 if (prs->prs_mapping_memory > 0) { in print_removal_status()
10104 zfs_nicenum(prs->prs_mapping_memory, mem_buf, sizeof (mem_buf)); in print_removal_status()
10119 if (pres == NULL || pres->pres_state == DSS_NONE) in print_raidz_expand_status()
10132 assert(pres->pres_expanding_vdev < children); in print_raidz_expand_status()
10136 time_t start = pres->pres_start_time; in print_raidz_expand_status()
10137 time_t end = pres->pres_end_time; in print_raidz_expand_status()
10139 zpool_vdev_name(g_zfs, zhp, child[pres->pres_expanding_vdev], 0); in print_raidz_expand_status()
10140 zfs_nicenum(pres->pres_reflowed, copied_buf, sizeof (copied_buf)); in print_raidz_expand_status()
10145 if (pres->pres_state == DSS_FINISHED) { in print_raidz_expand_status()
10147 secs_to_dhms(end - start, time_buf); in print_raidz_expand_status()
10149 (void) printf(gettext("expanded %s-%u copied %s in %s, " in print_raidz_expand_status()
10150 "on %s"), vname, (int)pres->pres_expanding_vdev, in print_raidz_expand_status()
10157 assert(pres->pres_state == DSS_SCANNING); in print_raidz_expand_status()
10163 "expansion of %s-%u in progress since %s"), in print_raidz_expand_status()
10164 vname, (int)pres->pres_expanding_vdev, ctime(&start)); in print_raidz_expand_status()
10166 copied = pres->pres_reflowed > 0 ? pres->pres_reflowed : 1; in print_raidz_expand_status()
10167 total = pres->pres_to_reflow; in print_raidz_expand_status()
10171 elapsed = time(NULL) - pres->pres_start_time; in print_raidz_expand_status()
10175 secs_left = (total - copied) / rate; in print_raidz_expand_status()
10187 if (pres->pres_waiting_for_resilver) { in print_raidz_expand_status()
10207 if (pcs == NULL || pcs->pcs_state == CS_NONE) in print_checkpoint_status()
10212 start = pcs->pcs_start_time; in print_checkpoint_status()
10213 zfs_nicenum(pcs->pcs_space, space_buf, sizeof (space_buf)); in print_checkpoint_status()
10215 if (pcs->pcs_state == CS_CHECKPOINT_EXISTS) { in print_checkpoint_status()
10224 (int)(strlen(date) - 1), date, space_buf); in print_checkpoint_status()
10228 assert(pcs->pcs_state == CS_CHECKPOINT_DISCARDING); in print_checkpoint_status()
10280 cb->cb_name_flags); in print_spares()
10300 cb->cb_name_flags); in print_l2cache()
10331 if (ddo->ddo_count == 0) { in print_dedup_stats()
10337 * Squash cached size into in-core size to handle race. in print_dedup_stats()
10341 cspace_prop = MIN(cspace_prop, ddo->ddo_mspace); in print_dedup_stats()
10344 zfs_nicenum_format(ddo->ddo_dspace, dspace, sizeof (dspace), format); in print_dedup_stats()
10345 zfs_nicenum_format(ddo->ddo_mspace, mspace, sizeof (mspace), format); in print_dedup_stats()
10347 (u_longlong_t)ddo->ddo_count, in print_dedup_stats()
10353 (double)cspace_prop / (double)ddo->ddo_mspace * 100.0); in print_dedup_stats()
10479 "a legacy on-disk format. The pool can\n\tstill be used, " in print_status_reason()
10489 "to a newer, incompatible on-disk version.\n\tThe pool " in print_status_reason()
10504 "the features. See zpool-features(7) for details.\n")); in print_status_reason()
10541 "accessed in read-only mode on this system. It\n\tcannot be" in print_status_reason()
10542 " accessed in read-write mode because it uses the " in print_status_reason()
10547 "in read-write mode. Import the pool with\n" in print_status_reason()
10548 "\t\"-o readonly=on\", access the pool from a system that " in print_status_reason()
10567 snprintf(action, AC_SIZE, gettext("Destroy and re-create the " in print_status_reason()
10603 "configured to use a non-native block size.\n" in print_status_reason()
10635 "datasets contain an on-disk incompatibility\n\t " in print_status_reason()
10640 "'zfs mount -o ro' can\n\tbe used to temporarily " in print_status_reason()
10646 "snapshots and bookmarks contain an on-disk\n\t" in print_status_reason()
10647 "incompatibility. This may cause on-disk " in print_status_reason()
10655 " use\n\ta non-raw send to backup and restore them." in print_status_reason()
10677 if (cbp->cb_json) in print_status_reason()
10686 if (cbp->cb_json) in print_status_reason()
10712 if (cbp->cb_dedup_stats > 1) in status_callback_json()
10716 * If we were given 'zpool status -x', only report those pools with in status_callback_json()
10719 if (cbp->cb_explain && in status_callback_json()
10728 d = fnvlist_lookup_nvlist(cbp->cb_jsobj, "pools"); in status_callback_json()
10731 fill_pool_info(item, zhp, B_FALSE, cbp->cb_json_as_int); in status_callback_json()
10738 if (cbp->cb_json_pool_key_guid) { in status_callback_json()
10743 cbp->cb_count++; in status_callback_json()
10748 "https://openzfs.github.io/openzfs-docs/msg/%s", in status_callback_json()
10765 if (cbp->cb_flat_vdevs) { in status_callback_json()
10793 if (cbp->cb_json_pool_key_guid) { in status_callback_json()
10809 * see: https://openzfs.github.io/openzfs-docs/msg/ZFS-xxxx-01
10815 * When given the '-v' option, we print out the complete config. If the '-e'
10831 if (cbp->cb_dedup_stats > 1) in status_callback()
10837 cbp->cb_count++; in status_callback()
10840 * If we were given 'zpool status -x', only report those pools with in status_callback()
10843 if (cbp->cb_explain && in status_callback()
10849 if (!cbp->cb_allpools) { in status_callback()
10852 if (cbp->cb_first) in status_callback()
10853 cbp->cb_first = B_FALSE; in status_callback()
10858 if (cbp->cb_first) in status_callback()
10859 cbp->cb_first = B_FALSE; in status_callback()
10884 " https://openzfs.github.io/openzfs-docs/msg/%s\n"), in status_callback()
10910 cbp->cb_namewidth = max_width(zhp, nvroot, 0, 0, in status_callback()
10911 cbp->cb_name_flags | VDEV_NAME_TYPE_ID); in status_callback()
10912 if (cbp->cb_namewidth < 10) in status_callback()
10913 cbp->cb_namewidth = 10; in status_callback()
10917 (void) printf(gettext("\t%-*s %-8s %5s %5s %5s"), in status_callback()
10918 cbp->cb_namewidth, "NAME", "STATE", "READ", "WRITE", in status_callback()
10922 if (cbp->cb_print_slow_ios) { in status_callback()
10926 if (cbp->cb_print_power) { in status_callback()
10930 if (cbp->cb_print_dio_verify) { in status_callback()
10934 if (cbp->vcdl != NULL) in status_callback()
10935 print_cmd_columns(cbp->vcdl, 0); in status_callback()
10960 } else if (!cbp->cb_verbose) { in status_callback()
10963 "errors, use '-v' for a list\n"), in status_callback()
10971 if (cbp->cb_dedup_stats) in status_callback()
10972 print_dedup_stats(zhp, config, cbp->cb_literal); in status_callback()
10982 * zpool status [-c [script1,script2,...]] [-dDegiLpPstvx] [--power] ...
10983 * [-T d|u] [pool] [interval [count]]
10985 * -c CMD For each vdev, run command CMD
10986 * -d Display Direct I/O write verify errors
10987 * -D Display dedup status (undocumented)
10988 * -e Display only unhealthy vdevs
10989 * -g Display guid for individual vdev name.
10990 * -i Display vdev initialization status.
10991 * -L Follow links when resolving vdev path name.
10992 * -p Display values in parsable (exact) format.
10993 * -P Display full path for vdev name.
10994 * -s Display slow IOs column.
10995 * -t Display vdev TRIM status.
10996 * -T Display a timestamp in date(1) or Unix format
10997 * -v Display complete error logs
10998 * -x Display only pools with potential problems
10999 * -j Display output in JSON format
11000 * --power Display vdev enclosure slot power status
11001 * --json-int Display numbers in inteeger format instead of string
11002 * --json-flat-vdevs Display vdevs in flat hierarchy
11003 * --json-pool-key-guid Use pool GUID as key for pool objects
11021 {"json-int", no_argument, NULL, ZPOOL_OPTION_JSON_NUMS_AS_INT}, in zpool_do_status()
11022 {"json-flat-vdevs", no_argument, NULL, in zpool_do_status()
11024 {"json-pool-key-guid", no_argument, NULL, in zpool_do_status()
11031 NULL)) != -1) { in zpool_do_status()
11036 gettext("Can't set -c flag twice\n")); in zpool_do_status()
11043 "Can't run -c, disabled by " in zpool_do_status()
11051 "Can't run -c with root privileges " in zpool_do_status()
11125 argc -= optind; in zpool_do_status()
11137 fprintf(stderr, gettext("'--json-flat-vdevs' only works with" in zpool_do_status()
11138 " '-j' option\n")); in zpool_do_status()
11143 (void) fprintf(stderr, gettext("'--json-int' only works with" in zpool_do_status()
11144 " '-j' option\n")); in zpool_do_status()
11149 (void) fprintf(stderr, gettext("'json-pool-key-guid' only" in zpool_do_status()
11150 " works with '-j' option\n")); in zpool_do_status()
11216 if (count != 0 && --count == 0) in zpool_do_status()
11324 return (-1); in upgrade_enable_all()
11336 verify(-1 != asprintf(&propname, "feature@%s", fname)); in upgrade_enable_all()
11376 if (version < cbp->cb_version) { in upgrade_cb()
11377 cbp->cb_first = B_FALSE; in upgrade_cb()
11378 ret = upgrade_version(zhp, cbp->cb_version); in upgrade_cb()
11384 * If they did "zpool upgrade -a", then we could in upgrade_cb()
11393 if (cbp->cb_version >= SPA_VERSION_FEATURES) { in upgrade_cb()
11400 cbp->cb_first = B_FALSE; in upgrade_cb()
11427 if (cbp->cb_first) { in upgrade_list_older_cb()
11438 (void) printf(gettext("--- ------------\n")); in upgrade_list_older_cb()
11439 cbp->cb_first = B_FALSE; in upgrade_list_older_cb()
11473 if (cbp->cb_first) { in upgrade_list_disabled_cb()
11481 "zpool-features(7) for " in upgrade_list_disabled_cb()
11489 (void) printf(gettext("------" in upgrade_list_disabled_cb()
11490 "---------\n")); in upgrade_list_disabled_cb()
11491 cbp->cb_first = B_FALSE; in upgrade_list_disabled_cb()
11503 * If they did "zpool upgrade -a", then we could in upgrade_list_disabled_cb()
11532 if (cur_version > cbp->cb_version) { in upgrade_one()
11539 if (cbp->cb_version != SPA_VERSION && cur_version == cbp->cb_version) { in upgrade_one()
11542 (u_longlong_t)cbp->cb_version); in upgrade_one()
11546 if (cur_version != cbp->cb_version) { in upgrade_one()
11548 ret = upgrade_version(zhp, cbp->cb_version); in upgrade_one()
11553 if (cbp->cb_version >= SPA_VERSION_FEATURES) { in upgrade_one()
11578 * zpool upgrade -v
11579 * zpool upgrade [-V version] <-a | pool ...>
11582 * Individual pools can be upgraded by specifying the pool, and '-a' will
11597 while ((c = getopt(argc, argv, ":avV:")) != -1) { in zpool_do_upgrade()
11628 argc -= optind; in zpool_do_upgrade()
11634 (void) fprintf(stderr, gettext("-V option is " in zpool_do_upgrade()
11641 (void) fprintf(stderr, gettext("-v option is " in zpool_do_upgrade()
11647 (void) fprintf(stderr, gettext("-a option should not " in zpool_do_upgrade()
11661 (void) printf("----------------------------------------------" in zpool_do_upgrade()
11662 "---------------\n"); in zpool_do_upgrade()
11665 if (!fi->fi_zfs_mod_supported) in zpool_do_upgrade()
11668 (fi->fi_flags & ZFEATURE_FLAG_READONLY_COMPAT) ? in zpool_do_upgrade()
11669 " (read-only compatible)" : ""; in zpool_do_upgrade()
11671 (void) printf("%-37s%s\n", fi->fi_uname, ro); in zpool_do_upgrade()
11672 (void) printf(" %s\n", fi->fi_desc); in zpool_do_upgrade()
11679 (void) printf("--- -----------------------------------------" in zpool_do_upgrade()
11680 "---------------\n"); in zpool_do_upgrade()
11685 "RAID-Z\n")); in zpool_do_upgrade()
11698 (void) printf(gettext(" 14 passthrough-x aclinherit\n")); in zpool_do_upgrade()
11701 (void) printf(gettext(" 17 Triple-parity RAID-Z\n")); in zpool_do_upgrade()
11705 "(zero-length encoding)\n")); in zpool_do_upgrade()
11744 (void) printf(gettext("\nUse 'zpool upgrade -v' " in zpool_do_upgrade()
11799 sizeof (tbuf) - strlen(tbuf), in print_history_records()
11809 if (!cb->internal) in print_history_records()
11823 if (!cb->internal) in print_history_records()
11839 if (!cb->internal) in print_history_records()
11865 if (!cb->internal) in print_history_records()
11871 if (!cb->longfmt) { in print_history_records()
11881 (void) printf("(%s) ", pwd->pw_name); in print_history_records()
11909 cb->first = B_FALSE; in get_history_one()
11939 while ((c = getopt(argc, argv, "li")) != -1) { in zpool_do_history()
11953 argc -= optind; in zpool_do_history()
11990 if (opts->scripted) in zpool_do_events_short()
12268 if (!opts->scripted) in zpool_do_events_next()
12269 (void) printf(gettext("%-30s %s\n"), "TIME", "CLASS"); in zpool_do_events_next()
12273 (opts->follow ? ZEVENT_NONE : ZEVENT_NONBLOCK), zevent_fd); in zpool_do_events_next()
12280 if (strlen(opts->poolname) > 0 && in zpool_do_events_next()
12282 strcmp(opts->poolname, pool) != 0) in zpool_do_events_next()
12287 if (opts->verbose) { in zpool_do_events_next()
12314 * zpool events [-vHf [pool] | -c]
12326 while ((c = getopt(argc, argv, "vHfc")) != -1) { in zpool_do_events()
12346 argc -= optind; in zpool_do_events()
12364 gettext("invalid options combined with -c\n")); in zpool_do_events()
12385 if (cbp->cb_json) { in get_callback_vdev()
12386 d = fnvlist_lookup_nvlist(cbp->cb_jsobj, "vdevs"); in get_callback_vdev()
12394 for (zprop_list_t *pl = cbp->cb_proplist; pl != NULL; in get_callback_vdev()
12395 pl = pl->pl_next) { in get_callback_vdev()
12402 if (pl->pl_prop == ZPOOL_PROP_NAME && in get_callback_vdev()
12403 pl == cbp->cb_proplist) in get_callback_vdev()
12406 if (pl->pl_prop == ZPROP_INVAL) { in get_callback_vdev()
12407 prop_name = pl->pl_user_prop; in get_callback_vdev()
12409 prop_name = (char *)vdev_prop_to_name(pl->pl_prop); in get_callback_vdev()
12411 if (zpool_get_vdev_prop(zhp, vdevname, pl->pl_prop, in get_callback_vdev()
12413 cbp->cb_literal) == 0) { in get_callback_vdev()
12419 if (cbp->cb_json) { in get_callback_vdev()
12423 cbp->cb_json_as_int); in get_callback_vdev()
12426 fnvlist_add_nvlist(cbp->cb_jsobj, "vdevs", d); in get_callback_vdev()
12445 * zpool_vdev_name() transforms the root vdev name (i.e., root-0) to the in get_callback_vdev_cb()
12451 vdevname = strdup("root-0"); in get_callback_vdev_cb()
12454 cbp->cb_vdevs.cb_name_flags); in get_callback_vdev_cb()
12456 (void) vdev_expand_proplist(zhp, vdevname, &cbp->cb_proplist); in get_callback_vdev_cb()
12477 if (cbp->cb_type == ZFS_TYPE_VDEV) { in get_callback()
12478 if (cbp->cb_json) { in get_callback()
12480 fill_pool_info(pool, zhp, B_FALSE, cbp->cb_json_as_int); in get_callback()
12481 fnvlist_add_nvlist(cbp->cb_jsobj, "pool", pool); in get_callback()
12485 if (strcmp(cbp->cb_vdevs.cb_names[0], "all-vdevs") == 0) { in get_callback()
12489 for (vid = 0; vid < cbp->cb_vdevs.cb_names_count; in get_callback()
12492 cbp->cb_vdevs.cb_names[vid], in get_callback()
12493 &cbp->cb_proplist); in get_callback()
12496 for (vid = 0; vid < cbp->cb_vdevs.cb_names_count; in get_callback()
12499 cbp->cb_vdevs.cb_names[vid], data); in get_callback()
12503 assert(cbp->cb_type == ZFS_TYPE_POOL); in get_callback()
12504 if (cbp->cb_json) { in get_callback()
12505 d = fnvlist_lookup_nvlist(cbp->cb_jsobj, "pools"); in get_callback()
12512 for (pl = cbp->cb_proplist; pl != NULL; pl = pl->pl_next) { in get_callback()
12517 if (pl->pl_prop == ZPOOL_PROP_NAME && in get_callback()
12518 pl == cbp->cb_proplist) in get_callback()
12521 if (pl->pl_prop == ZPROP_INVAL && in get_callback()
12522 zfs_prop_user(pl->pl_user_prop)) { in get_callback()
12525 if (zpool_get_userprop(zhp, pl->pl_user_prop, in get_callback()
12530 zpool_get_name(zhp), cbp, pl->pl_user_prop, in get_callback()
12532 } else if (pl->pl_prop == ZPROP_INVAL && in get_callback()
12533 (zpool_prop_feature(pl->pl_user_prop) || in get_callback()
12534 zpool_prop_unsupported(pl->pl_user_prop))) { in get_callback()
12538 pl->pl_user_prop, value, in get_callback()
12542 pl->pl_user_prop, value, srctype, in get_callback()
12546 if (zpool_get_prop(zhp, pl->pl_prop, value, in get_callback()
12548 cbp->cb_literal) != 0) in get_callback()
12553 zpool_prop_to_name(pl->pl_prop), in get_callback()
12560 if (cbp->cb_json) { in get_callback()
12564 cbp->cb_json_as_int); in get_callback()
12566 if (cbp->cb_json_pool_key_guid) { in get_callback()
12578 fnvlist_add_nvlist(cbp->cb_jsobj, "pools", d); in get_callback()
12589 * zpool get [-Hp] [-o "all" | field[,...]] <"all" | property[,...]> <pool> ...
12591 * -H Scripted mode. Don't display headers, and separate properties
12593 * -o List of columns to display. Defaults to
12595 * -p Display values in parsable (exact) format.
12596 * -j Display output in JSON format.
12597 * --json-int Display numbers as integers instead of strings.
12598 * --json-pool-key-guid Set pool GUID as key for pool objects.
12630 {"json-int", no_argument, NULL, ZPOOL_OPTION_JSON_NUMS_AS_INT}, in zpool_do_get()
12631 {"json-pool-key-guid", no_argument, NULL, in zpool_do_get()
12638 NULL)) != -1) { in zpool_do_get()
12670 if (i == ZFS_GET_NCOLS - 1) { in zpool_do_get()
12672 "many fields given to -o " in zpool_do_get()
12691 "given to -o option\n")); in zpool_do_get()
12697 i = ZFS_GET_NCOLS - 1; in zpool_do_get()
12709 argc -= optind; in zpool_do_get()
12713 (void) fprintf(stderr, gettext("'--json-int' only works with" in zpool_do_get()
12714 " '-j' option\n")); in zpool_do_get()
12719 (void) fprintf(stderr, gettext("'json-pool-key-guid' only" in zpool_do_get()
12720 " works with '-j' option\n")); in zpool_do_get()
12733 argc--; in zpool_do_get()
12742 if ((argc == 2 && strcmp(argv[1], "all-vdevs") == 0) || in zpool_do_get()
12744 are_vdevs_in_pool(argc - 1, argv + 1, argv[0], in zpool_do_get()
12748 vdev = strdup("root-0"); in zpool_do_get()
12754 cb.cb_vdevs.cb_names_count = argc - 1; in zpool_do_get()
12764 error_list_unresolved_vdevs(argc - 1, argv + 1, in zpool_do_get()
12837 /* Check if we have out-of-bounds features */ in set_pool_callback()
12838 if (strcmp(cb->cb_propname, ZPOOL_CONFIG_COMPATIBILITY) == 0) { in set_pool_callback()
12840 if (zpool_do_load_compat(cb->cb_value, features) != in set_pool_callback()
12842 return (-1); in set_pool_callback()
12859 if (zpool_prop_feature(cb->cb_propname) && in set_pool_callback()
12860 strcmp(cb->cb_value, ZFS_FEATURE_ENABLED) == 0) { in set_pool_callback()
12861 char *fname = strchr(cb->cb_propname, '@') + 1; in set_pool_callback()
12878 return (-1); in set_pool_callback()
12889 return (-1); in set_pool_callback()
12894 error = zpool_set_prop(zhp, cb->cb_propname, cb->cb_value); in set_pool_callback()
12905 if (cb->cb_type == ZFS_TYPE_VDEV) { in set_callback()
12906 error = zpool_set_vdev_prop(zhp, *cb->cb_vdevs.cb_names, in set_callback()
12907 cb->cb_propname, cb->cb_value); in set_callback()
12909 assert(cb->cb_type == ZFS_TYPE_POOL); in set_callback()
12913 cb->cb_any_successful = !error; in set_callback()
12925 if (argc > 1 && argv[1][0] == '-') { in zpool_do_set()
12959 argc -= 2; in zpool_do_set()
12973 vdev = strdup("root-0"); in zpool_do_set()
13014 vs->vs_initialize_state == VDEV_INITIALIZE_ACTIVE) in vdev_activity_remaining()
13015 bytes_remaining = vs->vs_initialize_bytes_est - in vdev_activity_remaining()
13016 vs->vs_initialize_bytes_done; in vdev_activity_remaining()
13018 vs->vs_trim_state == VDEV_TRIM_ACTIVE) in vdev_activity_remaining()
13019 bytes_remaining = vs->vs_trim_bytes_est - in vdev_activity_remaining()
13020 vs->vs_trim_bytes_done; in vdev_activity_remaining()
13034 /* Add up the total number of bytes left to rebuild across top-level vdevs */
13054 if (vrs->vrs_state == VDEV_REBUILD_ACTIVE) { in vdev_activity_top_remaining()
13055 bytes_remaining += (vrs->vrs_bytes_est - in vdev_activity_top_remaining()
13056 vrs->vrs_bytes_rebuilt); in vdev_activity_top_remaining()
13127 * Make sure we have enough space in the col for pretty-printed in print_wait_status_row()
13139 boolean_t reprint_header = (!wd->wd_headers_once && term_height > 0 && in print_wait_status_row()
13140 row % (term_height-1) == 0); in print_wait_status_row()
13141 if (!wd->wd_scripted && (row == 0 || reprint_header)) { in print_wait_status_row()
13143 if (wd->wd_enabled[i]) in print_wait_status_row()
13160 if (pcs != NULL && pcs->pcs_state == CS_CHECKPOINT_DISCARDING) in print_wait_status_row()
13161 bytes_rem[ZPOOL_WAIT_CKPT_DISCARD] = pcs->pcs_space; in print_wait_status_row()
13165 if (prs != NULL && prs->prs_state == DSS_SCANNING) in print_wait_status_row()
13166 bytes_rem[ZPOOL_WAIT_REMOVE] = prs->prs_to_copy - in print_wait_status_row()
13167 prs->prs_copied; in print_wait_status_row()
13171 if (pss != NULL && pss->pss_state == DSS_SCANNING && in print_wait_status_row()
13172 pss->pss_pass_scrub_pause == 0) { in print_wait_status_row()
13173 int64_t rem = pss->pss_to_examine - pss->pss_issued; in print_wait_status_row()
13174 if (pss->pss_func == POOL_SCAN_SCRUB) in print_wait_status_row()
13185 if (pres != NULL && pres->pres_state == DSS_SCANNING) { in print_wait_status_row()
13186 int64_t rem = pres->pres_to_reflow - pres->pres_reflowed; in print_wait_status_row()
13213 if (!wd->wd_enabled[i]) in print_wait_status_row()
13216 if (wd->wd_exact) { in print_wait_status_row()
13223 if (wd->wd_scripted) in print_wait_status_row()
13226 (void) printf(" %*s", col_widths[i] - 1, buf); in print_wait_status_row()
13238 if ((zhp = zpool_open(g_zfs, wd->wd_poolname)) == NULL) in wait_status_thread()
13255 timeout.tv_sec += floor(wd->wd_interval); in wait_status_thread()
13257 (wd->wd_interval - floor(wd->wd_interval)) * NANOSEC; in wait_status_thread()
13260 timeout.tv_nsec = nanos - NANOSEC; in wait_status_thread()
13264 pthread_mutex_lock(&wd->wd_mutex); in wait_status_thread()
13265 if (!wd->wd_should_exit) in wait_status_thread()
13266 ret = pthread_cond_timedwait(&wd->wd_cv, &wd->wd_mutex, in wait_status_thread()
13268 pthread_mutex_unlock(&wd->wd_mutex); in wait_status_thread()
13306 while ((c = getopt(argc, argv, "HpT:t:")) != -1) { in zpool_do_wait()
13349 argc -= optind; in zpool_do_wait()
13439 * zpool ddtprune -d|-p <amount> <pool>
13441 * -d <days> Prune entries <days> old and older
13442 * -p <percent> Prune <percent> amount of entries
13455 while ((c = getopt(argc, argv, "d:p:")) != -1) { in zpool_do_ddt_prune()
13459 (void) fprintf(stderr, gettext("-d cannot be " in zpool_do_ddt_prune()
13460 "combined with -p option\n")); in zpool_do_ddt_prune()
13475 (void) fprintf(stderr, gettext("-p cannot be " in zpool_do_ddt_prune()
13476 "combined with -d option\n")); in zpool_do_ddt_prune()
13495 argc -= optind; in zpool_do_ddt_prune()
13500 gettext("missing amount option (-d|-p <value>)\n")); in zpool_do_ddt_prune()
13511 return (-1); in zpool_do_ddt_prune()
13549 while ((c = getopt_long(argc, argv, "j", long_options, NULL)) != -1) { in zpool_do_version()
13562 argc -= optind; in zpool_do_version()
13576 return (-1); in zpool_do_version()
13592 snprintf(page, sizeof (page), "zpool-%s", argv[2]); in zpool_do_help()
13597 return (-1); in zpool_do_help()
13656 * Special case '-?' in main()
13658 if ((strcmp(cmdname, "-?") == 0) || strcmp(cmdname, "--help") == 0) in main()
13662 * Special case '-V|--version' in main()
13664 if ((strcmp(cmdname, "-V") == 0) || (strcmp(cmdname, "--version") == 0)) in main()
13696 ret = command_table[i].func(argc - 1, newargv + 1); in main()