From a0f982bb0a00aa32360d0c18caf15cf7e595e4a3 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Wed, 29 Jan 2020 09:23:15 -0500 Subject: [PATCH] lib/blob: add invalid flag for extent table With recent changes to extent on-disk metadata format, new format (Extent Pages) is not backwards compatible. Meanwhile old format (Extent RLE) is backwards compatible with older SPDK applications. Summing up: Blobstore created pre SPDK 20.01 can only use Extent RLE. Blobstore created starting with SPDK 20.01 can use both, Extent Pages and Extent RLE specified by use_extent_table opts. When use_extent_table is set to true, invalid flag for it is set. SPDK application pre 20.01, will not load such blob. Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483220 (master) (cherry picked from commit dc24539c40f28f0c85ca80b823ba3f17d005b172) Change-Id: If14ebd03f19eb581d71dcb46191e099336655189 Signed-off-by: Tomasz Zawadzki Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/483395 Reviewed-by: Darek Stojaczyk Reviewed-by: Shuhei Matsumoto Reviewed-by: Ben Walker Community-CI: SPDK CI Jenkins Tested-by: SPDK CI Jenkins --- lib/blob/blobstore.c | 3 +++ lib/blob/blobstore.h | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 6df2706af..37c0460bb 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -5129,6 +5129,9 @@ _spdk_bs_create_blob(struct spdk_blob_store *bs, } blob->use_extent_table = opts->use_extent_table; + if (blob->use_extent_table) { + blob->invalid_flags |= SPDK_BLOB_EXTENT_TABLE; + } if (!internal_xattrs) { _spdk_blob_xattrs_init(&internal_xattrs_default); diff --git a/lib/blob/blobstore.h b/lib/blob/blobstore.h index de1d4a31b..29c30f8db 100644 --- a/lib/blob/blobstore.h +++ b/lib/blob/blobstore.h @@ -331,7 +331,8 @@ struct spdk_blob_md_descriptor_extent_page { #define SPDK_BLOB_THIN_PROV (1ULL << 0) #define SPDK_BLOB_INTERNAL_XATTR (1ULL << 1) -#define SPDK_BLOB_INVALID_FLAGS_MASK (SPDK_BLOB_THIN_PROV | SPDK_BLOB_INTERNAL_XATTR) +#define SPDK_BLOB_EXTENT_TABLE (1ULL << 2) +#define SPDK_BLOB_INVALID_FLAGS_MASK (SPDK_BLOB_THIN_PROV | SPDK_BLOB_INTERNAL_XATTR | SPDK_BLOB_EXTENT_TABLE) #define SPDK_BLOB_READ_ONLY (1ULL << 0) #define SPDK_BLOB_DATA_RO_FLAGS_MASK SPDK_BLOB_READ_ONLY