From 7a867c4fdb292b040bd0c9556d1fefb57ec709fb Mon Sep 17 00:00:00 2001 From: Mateusz Kozlowski Date: Thu, 4 Jul 2019 14:51:10 +0200 Subject: [PATCH] lib/ftl: Pass ftl conf to write_config rpc function Changed write_config to use the ftl configuration file instead of allow_open_bands directly. This allows for easier expansion of saved fields. Signed-off-by: Mateusz Kozlowski Change-Id: Ie1d480983636f26840dba9a3a6c93b2883903bdb Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/460519 Reviewed-by: Konrad Sztyber Reviewed-by: Wojciech Malikowski Reviewed-by: Darek Stojaczyk Reviewed-by: Shuhei Matsumoto Tested-by: SPDK CI Jenkins --- include/spdk/ftl.h | 4 ++-- lib/bdev/nvme/bdev_ftl.c | 2 +- lib/ftl/ftl_core.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/spdk/ftl.h b/include/spdk/ftl.h index 21dcbc0e7..774b6b40f 100644 --- a/include/spdk/ftl.h +++ b/include/spdk/ftl.h @@ -150,12 +150,12 @@ struct spdk_ftl_attrs { size_t lbk_size; /* Write buffer cache */ struct spdk_bdev_desc *cache_bdev_desc; - /* Allow partial recovery after dirty shutdown */ - bool allow_open_bands; /* Number of chunks per parallel unit in the underlying device (including any offline ones) */ size_t num_chunks; /* Number of sectors per chunk */ size_t chunk_size; + /* Device specific configuration */ + struct spdk_ftl_conf conf; }; struct ftl_module_init_opts { diff --git a/lib/bdev/nvme/bdev_ftl.c b/lib/bdev/nvme/bdev_ftl.c index 793366441..7095c4e2f 100644 --- a/lib/bdev/nvme/bdev_ftl.c +++ b/lib/bdev/nvme/bdev_ftl.c @@ -441,7 +441,7 @@ bdev_ftl_write_config_json(struct spdk_bdev *bdev, struct spdk_json_write_ctx *w spdk_json_write_named_object_begin(w, "params"); spdk_json_write_named_string(w, "name", ftl_bdev->bdev.name); - spdk_json_write_named_bool(w, "allow_open_bands", attrs.allow_open_bands); + spdk_json_write_named_bool(w, "allow_open_bands", attrs.conf.allow_open_bands); spdk_uuid_fmt_lower(uuid, sizeof(uuid), &attrs.uuid); spdk_json_write_named_string(w, "uuid", uuid); diff --git a/lib/ftl/ftl_core.c b/lib/ftl/ftl_core.c index f0f095c9b..fc294d43c 100644 --- a/lib/ftl/ftl_core.c +++ b/lib/ftl/ftl_core.c @@ -1872,9 +1872,9 @@ spdk_ftl_dev_get_attrs(const struct spdk_ftl_dev *dev, struct spdk_ftl_attrs *at attrs->lbk_size = FTL_BLOCK_SIZE; attrs->range = dev->range; attrs->cache_bdev_desc = dev->nv_cache.bdev_desc; - attrs->allow_open_bands = dev->conf.allow_open_bands; attrs->num_chunks = dev->geo.num_chk; attrs->chunk_size = dev->geo.clba; + attrs->conf = dev->conf; } static void