From 3d5934d65e4bfc83f83518fed91db6a14a349752 Mon Sep 17 00:00:00 2001 From: Isaac Huang Date: Tue, 1 May 2018 11:57:18 -0600 Subject: [PATCH] Use '%' as dRAID spare vdev prefix Changed dRAID spare vdev prefix from '$' to '%'. Fixed a few build and style warnings. Fixed rebuild status report (thegreatgazoo/zfs/issues/10). Signed-off-by: Isaac Huang --- cmd/zpool/zpool_main.c | 2 +- cmd/zpool/zpool_vdev.c | 2 +- include/sys/spa_impl.h | 3 +-- include/sys/vdev_draid_impl.h | 6 +++++- module/zfs/vdev_draid.c | 13 +++++++++++-- module/zfs/vdev_removal.c | 4 ++-- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index aafde8f37a67..1a6e38dac122 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -6198,7 +6198,7 @@ print_scan_status(pool_scan_stat_t *ps) (void) printf(gettext("\t%s repaired, %.2f%% done"), processed_buf, 100 * fraction_done); } else if (ps->pss_func == POOL_SCAN_REBUILD) { - (void) printf(gettext("\t%s rebuilt, %.2f%% done\n"), + (void) printf(gettext("\t%s rebuilt, %.2f%% done"), processed_buf, 100 * fraction_done); } diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index b7738aa242e9..c9c10f1f013a 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -592,7 +592,7 @@ is_spare(nvlist_t *config, const char *path) * /dev/xxx Complete disk path * /xxx Full path to file * xxx Shorthand for /xxx - * $draidxxx dRAID spare, see VDEV_DRAID_SPARE_PATH_FMT + * %draidxxx dRAID spare, see VDEV_DRAID_SPARE_PATH_FMT */ static nvlist_t * make_leaf_vdev(nvlist_t *props, const char *arg, uint64_t is_log) diff --git a/include/sys/spa_impl.h b/include/sys/spa_impl.h index fbdcc35ac2dc..7be8021a6db8 100644 --- a/include/sys/spa_impl.h +++ b/include/sys/spa_impl.h @@ -34,6 +34,7 @@ #include #include #include +#include #include #include #include @@ -184,8 +185,6 @@ typedef enum spa_all_vdev_zap_action { AVZ_ACTION_INITIALIZE } spa_avz_action_t; -typedef struct spa_vdev_scan spa_vdev_scan_t; - struct spa { /* * Fields protected by spa_namespace_lock. diff --git a/include/sys/vdev_draid_impl.h b/include/sys/vdev_draid_impl.h index 58d00d9f8b34..1cf3826ee0de 100644 --- a/include/sys/vdev_draid_impl.h +++ b/include/sys/vdev_draid_impl.h @@ -73,7 +73,11 @@ extern uint64_t vdev_draid_max_rebuildable_asize(vdev_t *, uint64_t); #define VDEV_DRAID_MAX_CHILDREN 255 #define VDEV_DRAID_U8_MAX ((uint8_t)-1) -#define VDEV_DRAID_SPARE_PATH_FMT "$"VDEV_TYPE_DRAID"%lu-%lu-s%lu" +/* + * Double '%' characters in the front because it's used as format string in + * scanf()/printf() family of functions + */ +#define VDEV_DRAID_SPARE_PATH_FMT "%%"VDEV_TYPE_DRAID"%lu-%lu-s%lu" #ifdef _KERNEL #define U64FMT "%llu" diff --git a/module/zfs/vdev_draid.c b/module/zfs/vdev_draid.c index a423b7b21eea..0eb909100793 100644 --- a/module/zfs/vdev_draid.c +++ b/module/zfs/vdev_draid.c @@ -1108,6 +1108,15 @@ vdev_draid_need_resilver(vdev_t *vd, uint64_t offset, size_t psize) return (vdev_draid_group_degraded(vd, NULL, offset, psize, mirror)); } +static void +vdev_draid_skip_io_done(zio_t *zio) +{ + /* + * HH: handle skip IO error + * raidz_col_t *rc = zio->io_private; + */ +} + /* * Start an IO operation on a dRAID VDev * @@ -1174,7 +1183,7 @@ vdev_draid_io_start(zio_t *zio) zio_nowait(zio_vdev_child_io(zio, NULL, cvd, rc->rc_offset + rc->rc_size, cfg->dcf_zero_abd, 1ULL << ashift, zio->io_type, zio->io_priority, - 0, NULL, NULL)); /* HH: handle skip write error */ + 0, vdev_draid_skip_io_done, rc)); } zio_execute(zio); @@ -1258,7 +1267,7 @@ vdev_draid_io_start(zio_t *zio) zio_nowait(zio_vdev_child_io(zio, NULL, cvd, rc->rc_offset + rc->rc_size, abd, 1ULL << ashift, ZIO_TYPE_READ, - zio->io_priority, 0, NULL, NULL)); + zio->io_priority, 0, vdev_draid_skip_io_done, rc)); } } diff --git a/module/zfs/vdev_removal.c b/module/zfs/vdev_removal.c index 8e52357b837f..539b4a83b5f4 100644 --- a/module/zfs/vdev_removal.c +++ b/module/zfs/vdev_removal.c @@ -1864,8 +1864,8 @@ spa_vdev_remove(spa_t *spa, uint64_t guid, boolean_t unspare) char *nvstr = fnvlist_lookup_string(nv, ZPOOL_CONFIG_PATH); - spa_history_log_internal(spa, "vdev remove", NULL, - "%s vdev (%s) %s", spa_name(spa), + spa_history_log_internal(spa, "vdev remove", + NULL, "%s vdev (%s) %s", spa_name(spa), VDEV_TYPE_SPARE, nvstr); spa_vdev_remove_aux(spa->spa_spares.sav_config, ZPOOL_CONFIG_SPARES, spares, nspares, nv);