module/raid: replace hardcoded "0" with #define for RAID0
Small cleanup in prep for future RAID levels and to improve readability. Change-Id: I66ae64320593ee5b242ccdc50a0041a4ec8207fb Signed-off-by: paul luse <paul.e.luse@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/469742 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
7fc89387da
commit
75cb691c97
@ -1128,7 +1128,7 @@ raid_bdev_config_add(const char *raid_name, uint32_t strip_size, uint8_t num_bas
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (raid_level != 0) {
|
||||
if (raid_level != RAID0) {
|
||||
SPDK_ERRLOG("invalid raid level %u, only raid level 0 is supported\n",
|
||||
raid_level);
|
||||
return -EINVAL;
|
||||
@ -1564,7 +1564,7 @@ raid_bdev_create(struct raid_bdev_config *raid_cfg)
|
||||
raid_bdev->raid_level = raid_cfg->raid_level;
|
||||
|
||||
switch (raid_bdev->raid_level) {
|
||||
case 0:
|
||||
case RAID0:
|
||||
raid_bdev->fn_table = &g_raid0_fn_table;
|
||||
break;
|
||||
default:
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include "spdk/bdev_module.h"
|
||||
|
||||
#define RAID0 0
|
||||
|
||||
/*
|
||||
* Raid state describes the state of the raid. This raid bdev can be either in
|
||||
* configured list or configuring list
|
||||
|
@ -386,7 +386,7 @@ int spdk_json_write_named_uint32(struct spdk_json_write_ctx *w, const char *name
|
||||
CU_ASSERT(req->strip_size_kb == val);
|
||||
} else if (strcmp(name, "blocklen_shift") == 0) {
|
||||
CU_ASSERT(spdk_u32log2(g_block_len) == val);
|
||||
} else if (strcmp(name, "raid_level") == 0) {
|
||||
} else if (strcmp(name, "raid_level") == RAID0) {
|
||||
CU_ASSERT(req->raid_level == val);
|
||||
} else if (strcmp(name, "num_base_bdevs") == 0) {
|
||||
CU_ASSERT(req->base_bdevs.num_base_bdevs == val);
|
||||
@ -1067,7 +1067,7 @@ create_test_req(struct rpc_bdev_raid_create *r, const char *raid_name,
|
||||
r->name = strdup(raid_name);
|
||||
SPDK_CU_ASSERT_FATAL(r->name != NULL);
|
||||
r->strip_size_kb = (g_strip_size * g_block_len) / 1024;
|
||||
r->raid_level = 0;
|
||||
r->raid_level = RAID0;
|
||||
r->base_bdevs.num_base_bdevs = g_max_base_drives;
|
||||
for (i = 0; i < g_max_base_drives; i++, bbdev_idx++) {
|
||||
snprintf(name, 16, "%s%u%s", "Nvme", bbdev_idx, "n1");
|
||||
|
Loading…
Reference in New Issue
Block a user