From b62bfbf6a9204b0aa93085360da8f1ea4592f389 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 3 Jun 2020 07:13:48 +0900 Subject: [PATCH] lib/vhost: Remove and inline spdk_vhost_blk_get_dev Having spdk_vhost_blk_get_dev required us to bump up the SO version the vhost library when we updated bdev.h but spdk_vhost_blk_get_dev has not been used publicly, and can be inlined very simply. So remove spdk_vhost_blk_get_dev from include/spdk/vhost.h and inline it to the place which had used it. Signed-off-by: Shuhei Matsumoto Change-Id: I98c233b81d7980d4e2c5bd3c0a65d747f183e1e9 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2747 Tested-by: SPDK CI Jenkins Community-CI: Broadcom CI Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Aleksey Marchuk --- CHANGELOG.md | 4 ++++ include/spdk/vhost.h | 10 ---------- lib/vhost/Makefile | 2 +- lib/vhost/spdk_vhost.map | 1 - lib/vhost/vhost_blk.c | 16 ++++------------ 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d2120cd1..ec8dec2c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,10 @@ options. Options can be set independently for each implementation. Added `recv_buf_size` and 'send_buf_size' socket layer options. They are used only in posix implementation. +### vhost + +The function `spdk_vhost_blk_get_dev` has been removed. + ## v20.04: IDXD engine support for compare has been added. diff --git a/include/spdk/vhost.h b/include/spdk/vhost.h index 0bea83b01..211c2d337 100644 --- a/include/spdk/vhost.h +++ b/include/spdk/vhost.h @@ -330,16 +330,6 @@ int spdk_vhost_blk_construct(const char *name, const char *cpumask, const char * */ int spdk_vhost_dev_remove(struct spdk_vhost_dev *vdev); -/** - * Get underlying SPDK bdev from vhost blk device. The bdev might be NULL, as it - * could have been hotremoved. - * - * \param ctrlr vhost blk device. - * - * \return SPDK bdev associated with given vdev. - */ -struct spdk_bdev *spdk_vhost_blk_get_dev(struct spdk_vhost_dev *ctrlr); - #ifdef __cplusplus } #endif diff --git a/lib/vhost/Makefile b/lib/vhost/Makefile index d887c9aaf..1fe9b6e40 100644 --- a/lib/vhost/Makefile +++ b/lib/vhost/Makefile @@ -34,7 +34,7 @@ SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..) include $(SPDK_ROOT_DIR)/mk/spdk.common.mk -SO_VER := 3 +SO_VER := 4 SO_MINOR := 0 CFLAGS += -I. diff --git a/lib/vhost/spdk_vhost.map b/lib/vhost/spdk_vhost.map index 83eb518e5..de38e5a5e 100644 --- a/lib/vhost/spdk_vhost.map +++ b/lib/vhost/spdk_vhost.map @@ -22,7 +22,6 @@ spdk_vhost_scsi_dev_remove_tgt; spdk_vhost_blk_construct; spdk_vhost_dev_remove; - spdk_vhost_blk_get_dev; local: *; }; diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c index 91201f7f4..e722823c2 100644 --- a/lib/vhost/vhost_blk.c +++ b/lib/vhost/vhost_blk.c @@ -801,15 +801,6 @@ to_blk_dev(struct spdk_vhost_dev *vdev) return SPDK_CONTAINEROF(vdev, struct spdk_vhost_blk_dev, vdev); } -struct spdk_bdev * -spdk_vhost_blk_get_dev(struct spdk_vhost_dev *vdev) -{ - struct spdk_vhost_blk_dev *bvdev = to_blk_dev(vdev); - - assert(bvdev != NULL); - return bvdev->bdev; -} - static void vhost_dev_bdev_remove_cpl_cb(struct spdk_vhost_dev *vdev, void *ctx) { @@ -1031,18 +1022,18 @@ vhost_blk_stop(struct spdk_vhost_session *vsession) static void vhost_blk_dump_info_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ctx *w) { - struct spdk_bdev *bdev = spdk_vhost_blk_get_dev(vdev); struct spdk_vhost_blk_dev *bvdev; bvdev = to_blk_dev(vdev); assert(bvdev != NULL); + spdk_json_write_named_object_begin(w, "block"); spdk_json_write_named_bool(w, "readonly", bvdev->readonly); spdk_json_write_name(w, "bdev"); - if (bdev) { - spdk_json_write_string(w, spdk_bdev_get_name(bdev)); + if (bvdev->bdev) { + spdk_json_write_string(w, spdk_bdev_get_name(bvdev->bdev)); } else { spdk_json_write_null(w); } @@ -1057,6 +1048,7 @@ vhost_blk_write_config_json(struct spdk_vhost_dev *vdev, struct spdk_json_write_ bvdev = to_blk_dev(vdev); assert(bvdev != NULL); + if (!bvdev->bdev) { return; }