Skip to content

Commit

Permalink
Use '%' as dRAID spare vdev prefix
Browse files Browse the repository at this point in the history
Changed dRAID spare vdev prefix from '$' to '%'. Fixed a few
build and style warnings. Fixed rebuild status report
(/issues/10).

Signed-off-by: Isaac Huang <[email protected]>
  • Loading branch information
huangheintel committed May 1, 2018
1 parent f458730 commit 3d5934d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/zpool/zpool_vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <zfs_vdev_paths>/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)
Expand Down
3 changes: 1 addition & 2 deletions include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include <sys/spa.h>
#include <sys/vdev.h>
#include <sys/vdev_removal.h>
#include <sys/vdev_scan.h>
#include <sys/metaslab.h>
#include <sys/dmu.h>
#include <sys/dsl_pool.h>
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion include/sys/vdev_draid_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 11 additions & 2 deletions module/zfs/vdev_draid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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));
}
}

Expand Down
4 changes: 2 additions & 2 deletions module/zfs/vdev_removal.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 3d5934d

Please sign in to comment.