lib/vhost: remove legacy config support
This patch removes legacy config support in vhost_blk/scsi library. All options through the legacy config are already reflected in JSON. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: Ia63651cdb7433267d1a8839a1739e68b436e5d08 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4621 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
6bd7bd0da2
commit
b1f76f512f
@ -1458,18 +1458,6 @@ spdk_vhost_init(spdk_vhost_init_cb init_cb)
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = vhost_scsi_controller_construct();
|
|
||||||
if (ret != 0) {
|
|
||||||
SPDK_ERRLOG("Cannot construct vhost controllers\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = vhost_blk_controller_construct();
|
|
||||||
if (ret != 0) {
|
|
||||||
SPDK_ERRLOG("Cannot construct vhost block controllers\n");
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
spdk_cpuset_zero(&g_vhost_core_mask);
|
spdk_cpuset_zero(&g_vhost_core_mask);
|
||||||
|
|
||||||
/* iterate threads instead of using SPDK_ENV_FOREACH_CORE to ensure that threads are really
|
/* iterate threads instead of using SPDK_ENV_FOREACH_CORE to ensure that threads are really
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "spdk/env.h"
|
#include "spdk/env.h"
|
||||||
#include "spdk/bdev.h"
|
#include "spdk/bdev.h"
|
||||||
#include "spdk/bdev_module.h"
|
#include "spdk/bdev_module.h"
|
||||||
#include "spdk/conf.h"
|
|
||||||
#include "spdk/thread.h"
|
#include "spdk/thread.h"
|
||||||
#include "spdk/likely.h"
|
#include "spdk/likely.h"
|
||||||
#include "spdk/string.h"
|
#include "spdk/string.h"
|
||||||
@ -1190,52 +1189,6 @@ static const struct spdk_vhost_dev_backend vhost_blk_device_backend = {
|
|||||||
.remove_device = vhost_blk_destroy,
|
.remove_device = vhost_blk_destroy,
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
|
||||||
vhost_blk_controller_construct(void)
|
|
||||||
{
|
|
||||||
struct spdk_conf_section *sp;
|
|
||||||
unsigned ctrlr_num;
|
|
||||||
char *bdev_name;
|
|
||||||
char *cpumask;
|
|
||||||
char *name;
|
|
||||||
bool readonly;
|
|
||||||
bool packed_ring;
|
|
||||||
|
|
||||||
for (sp = spdk_conf_first_section(NULL); sp != NULL; sp = spdk_conf_next_section(sp)) {
|
|
||||||
if (!spdk_conf_section_match_prefix(sp, "VhostBlk")) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sscanf(spdk_conf_section_get_name(sp), "VhostBlk%u", &ctrlr_num) != 1) {
|
|
||||||
SPDK_ERRLOG("Section '%s' has non-numeric suffix.\n",
|
|
||||||
spdk_conf_section_get_name(sp));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = spdk_conf_section_get_val(sp, "Name");
|
|
||||||
if (name == NULL) {
|
|
||||||
SPDK_ERRLOG("VhostBlk%u: missing Name\n", ctrlr_num);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cpumask = spdk_conf_section_get_val(sp, "Cpumask");
|
|
||||||
readonly = spdk_conf_section_get_boolval(sp, "ReadOnly", false);
|
|
||||||
packed_ring = spdk_conf_section_get_boolval(sp, "PackedRing", false);
|
|
||||||
|
|
||||||
bdev_name = spdk_conf_section_get_val(sp, "Dev");
|
|
||||||
if (bdev_name == NULL) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spdk_vhost_blk_construct(name, cpumask, bdev_name,
|
|
||||||
readonly, packed_ring) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_name,
|
spdk_vhost_blk_construct(const char *name, const char *cpumask, const char *dev_name,
|
||||||
bool readonly, bool packed_ring)
|
bool readonly, bool packed_ring)
|
||||||
|
@ -380,8 +380,6 @@ int vhost_dev_register(struct spdk_vhost_dev *vdev, const char *name, const char
|
|||||||
const struct spdk_vhost_dev_backend *backend);
|
const struct spdk_vhost_dev_backend *backend);
|
||||||
int vhost_dev_unregister(struct spdk_vhost_dev *vdev);
|
int vhost_dev_unregister(struct spdk_vhost_dev *vdev);
|
||||||
|
|
||||||
int vhost_scsi_controller_construct(void);
|
|
||||||
int vhost_blk_controller_construct(void);
|
|
||||||
void vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
void vhost_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
#include "spdk/thread.h"
|
#include "spdk/thread.h"
|
||||||
#include "spdk/scsi.h"
|
#include "spdk/scsi.h"
|
||||||
#include "spdk/scsi_spec.h"
|
#include "spdk/scsi_spec.h"
|
||||||
#include "spdk/conf.h"
|
|
||||||
#include "spdk/util.h"
|
#include "spdk/util.h"
|
||||||
#include "spdk/likely.h"
|
#include "spdk/likely.h"
|
||||||
|
|
||||||
@ -1295,74 +1294,6 @@ vhost_scsi_dev_param_changed(struct spdk_vhost_dev *vdev, unsigned scsi_tgt_num)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
|
||||||
vhost_scsi_controller_construct(void)
|
|
||||||
{
|
|
||||||
struct spdk_conf_section *sp = spdk_conf_first_section(NULL);
|
|
||||||
struct spdk_vhost_dev *vdev;
|
|
||||||
int i, dev_num;
|
|
||||||
unsigned ctrlr_num = 0;
|
|
||||||
char *bdev_name, *tgt_num_str;
|
|
||||||
char *cpumask;
|
|
||||||
char *name;
|
|
||||||
char *tgt = NULL;
|
|
||||||
|
|
||||||
while (sp != NULL) {
|
|
||||||
if (!spdk_conf_section_match_prefix(sp, "VhostScsi")) {
|
|
||||||
sp = spdk_conf_next_section(sp);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sscanf(spdk_conf_section_get_name(sp), "VhostScsi%u", &ctrlr_num) != 1) {
|
|
||||||
SPDK_ERRLOG("Section '%s' has non-numeric suffix.\n",
|
|
||||||
spdk_conf_section_get_name(sp));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = spdk_conf_section_get_val(sp, "Name");
|
|
||||||
cpumask = spdk_conf_section_get_val(sp, "Cpumask");
|
|
||||||
|
|
||||||
if (spdk_vhost_scsi_dev_construct(name, cpumask) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
vdev = spdk_vhost_dev_find(name);
|
|
||||||
assert(vdev);
|
|
||||||
|
|
||||||
for (i = 0; ; i++) {
|
|
||||||
|
|
||||||
tgt = spdk_conf_section_get_nval(sp, "Target", i);
|
|
||||||
if (tgt == NULL) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
tgt_num_str = spdk_conf_section_get_nmval(sp, "Target", i, 0);
|
|
||||||
if (tgt_num_str == NULL) {
|
|
||||||
SPDK_ERRLOG("%s: invalid or missing SCSI target number\n", name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_num = (int)strtol(tgt_num_str, NULL, 10);
|
|
||||||
bdev_name = spdk_conf_section_get_nmval(sp, "Target", i, 1);
|
|
||||||
if (bdev_name == NULL) {
|
|
||||||
SPDK_ERRLOG("%s: invalid or missing bdev name for SCSI target %d\n", name, dev_num);
|
|
||||||
return -1;
|
|
||||||
} else if (spdk_conf_section_get_nmval(sp, "Target", i, 2)) {
|
|
||||||
SPDK_ERRLOG("%s: only one LUN per SCSI target is supported\n", name);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (spdk_vhost_scsi_dev_add_tgt(vdev, dev_num, bdev_name) < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sp = spdk_conf_next_section(sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
free_task_pool(struct spdk_vhost_scsi_session *svsession)
|
free_task_pool(struct spdk_vhost_scsi_session *svsession)
|
||||||
{
|
{
|
||||||
|
@ -86,7 +86,7 @@ endif
|
|||||||
DEPDIRS-scsi := log util thread $(JSON_LIBS) trace bdev
|
DEPDIRS-scsi := log util thread $(JSON_LIBS) trace bdev
|
||||||
|
|
||||||
DEPDIRS-iscsi := log sock util conf thread $(JSON_LIBS) trace scsi
|
DEPDIRS-iscsi := log sock util conf thread $(JSON_LIBS) trace scsi
|
||||||
DEPDIRS-vhost = log util conf thread $(JSON_LIBS) bdev scsi
|
DEPDIRS-vhost = log util thread $(JSON_LIBS) bdev scsi
|
||||||
|
|
||||||
# ------------------------------------------------------------------------
|
# ------------------------------------------------------------------------
|
||||||
# Start module/ directory - This section extends the organizational pattern from
|
# Start module/ directory - This section extends the organizational pattern from
|
||||||
|
Loading…
Reference in New Issue
Block a user