From 2c9674556344aa6864541631659a7e512df4ecb3 Mon Sep 17 00:00:00 2001 From: Konrad Sztyber Date: Wed, 12 Jun 2019 14:48:02 +0200 Subject: [PATCH] lib/ftl: check non-volatile cache's DIF type Check the type of DIF used by the bdev specified as the non-volatile write cache. If it's anything other than SPDK_DIF_DISABLE, fail the initialization, as we don't support any other type yet. Change-Id: Ie8bc1729558e055989d7925bc55f6307ee738f0e Signed-off-by: Konrad Sztyber Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/458096 Tested-by: SPDK CI Jenkins Reviewed-by: Darek Stojaczyk Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Mateusz Kozlowski Reviewed-by: Wojciech Malikowski --- lib/ftl/ftl_init.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ftl/ftl_init.c b/lib/ftl/ftl_init.c index ef2dae551..837951fce 100644 --- a/lib/ftl/ftl_init.c +++ b/lib/ftl/ftl_init.c @@ -524,6 +524,12 @@ ftl_dev_init_nv_cache(struct spdk_ftl_dev *dev, struct spdk_bdev_desc *bdev_desc return -1; } + if (spdk_bdev_get_dif_type(bdev) != SPDK_DIF_DISABLE) { + SPDK_ERRLOG("Unsupported DIF type used by bdev %s\n", + spdk_bdev_get_name(bdev)); + return -1; + } + /* The cache needs to be capable of storing at least two full bands. This requirement comes * from the fact that cache works as a protection against power loss, so before the data * inside the cache can be overwritten, the band it's stored on has to be closed. Plus one