bdev/raid: Leave checking bdev duplication with spdk_bdev_register()
When the name of raid bdev is already used by any existing bdev, spdk_bdev_register() will fail. Hence checking if bdev is duplicated can be left with spdk_bdev_register(). Change-Id: I22f0c75b0e87c5bd71ece383d146ec61cfaf2627 Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/423617 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Kunal Sablok <kunal.sablok@intel.com>
This commit is contained in:
parent
432f8d9160
commit
3333ceb6af
@ -45,31 +45,6 @@ static void raid_bdev_config_destroy(struct raid_bdev_config *raid_cfg);
|
||||
|
||||
SPDK_LOG_REGISTER_COMPONENT("raidrpc", SPDK_LOG_RAID_RPC)
|
||||
|
||||
/*
|
||||
* brief:
|
||||
* check_raid_bdev_present function tells if the raid bdev with given name already
|
||||
* exists or not.
|
||||
* params:
|
||||
* name - raid bdev name
|
||||
* returns:
|
||||
* NULL - raid bdev not present
|
||||
* non NULL - raid bdev present, returns raid_bdev
|
||||
*/
|
||||
static struct raid_bdev *
|
||||
check_raid_bdev_present(char *raid_bdev_name)
|
||||
{
|
||||
struct raid_bdev *raid_bdev;
|
||||
|
||||
TAILQ_FOREACH(raid_bdev, &g_spdk_raid_bdev_list, global_link) {
|
||||
if (strcmp(raid_bdev->bdev.name, raid_bdev_name) == 0) {
|
||||
/* raid bdev found */
|
||||
return raid_bdev;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Input structure for get_raid_bdevs RPC
|
||||
*/
|
||||
@ -291,7 +266,6 @@ spdk_rpc_construct_raid_bdev(struct spdk_jsonrpc_request *request,
|
||||
struct rpc_construct_raid_bdev req = {};
|
||||
struct spdk_json_write_ctx *w;
|
||||
struct raid_bdev_config *raid_cfg;
|
||||
struct raid_bdev *raid_bdev;
|
||||
struct spdk_bdev *base_bdev;
|
||||
int rc;
|
||||
|
||||
@ -303,15 +277,6 @@ spdk_rpc_construct_raid_bdev(struct spdk_jsonrpc_request *request,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fail the command if raid bdev is already present */
|
||||
raid_bdev = check_raid_bdev_present(req.name);
|
||||
if (raid_bdev != NULL) {
|
||||
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"raid bdev already present");
|
||||
free_rpc_construct_raid_bdev(&req);
|
||||
return;
|
||||
}
|
||||
|
||||
rc = raid_bdev_config_add(req.name, req.strip_size, req.base_bdevs.num_base_bdevs, req.raid_level,
|
||||
&raid_cfg);
|
||||
if (rc != 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user