bdev/raid: Use helper function to get config in destroy_raid_bdev RPC
Use helper function raid_bdev_config_find_by_name() in destroy_raid_bdev RPC. Besides, unify two iterator variables in construct_raid_bdev RPC. This is too small to add in a separate patch. Change-Id: If0bbae8993af4e402a82299db378e89245b8966e Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-on: https://review.gerrithub.io/424150 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Kunal Sablok <kunal.sablok@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
dbc4e5094a
commit
7f78f68ec8
@ -661,7 +661,7 @@ raid_bdev_free(void)
|
||||
* params:
|
||||
* raid_name - name for raid bdev.
|
||||
*/
|
||||
static struct raid_bdev_config *
|
||||
struct raid_bdev_config *
|
||||
raid_bdev_config_find_by_name(const char *raid_name)
|
||||
{
|
||||
struct raid_bdev_config *raid_cfg;
|
||||
|
@ -212,5 +212,6 @@ int raid_bdev_config_add(const char *raid_name, int strip_size, int num_base_bde
|
||||
int raid_bdev_config_add_base_bdev(struct raid_bdev_config *raid_cfg,
|
||||
const char *base_bdev_name, uint32_t slot);
|
||||
void raid_bdev_config_cleanup(struct raid_bdev_config *raid_cfg);
|
||||
struct raid_bdev_config *raid_bdev_config_find_by_name(const char *raid_name);
|
||||
|
||||
#endif // SPDK_BDEV_RAID_INTERNAL_H
|
||||
|
@ -385,13 +385,7 @@ spdk_rpc_destroy_raid_bdev(struct spdk_jsonrpc_request *request, const struct sp
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find raid bdev config for this raid bdev */
|
||||
TAILQ_FOREACH(raid_cfg, &g_spdk_raid_config.raid_bdev_config_head, link) {
|
||||
if (strcmp(raid_cfg->name, req.name) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
raid_cfg = raid_bdev_config_find_by_name(req.name);
|
||||
if (raid_cfg == NULL) {
|
||||
spdk_jsonrpc_send_error_response_fmt(request, SPDK_JSONRPC_ERROR_INVALID_PARAMS,
|
||||
"raid bdev %s is not found in config", req.name);
|
||||
|
Loading…
Reference in New Issue
Block a user