From e1ce55158a2e965f0b45ac29e9364500098b2c87 Mon Sep 17 00:00:00 2001 From: Tomasz Zawadzki Date: Thu, 17 Oct 2019 06:36:33 -0400 Subject: [PATCH] lib/blob: require SPDK_EXTENTS_PER_EP to be power of 2 Force number of Extents to fit into Extent Page to be power of 2, in order to simplify calculations on cluster allocations. At this time SPDK_BS_PAGE_SIZE is 4k, which would results in SPDK_EXTENTS_PER_EP to be 512. Signed-off-by: Tomasz Zawadzki Change-Id: I7e09d92b00dfe5c12d7dd10ac0fc5a9a10d526ac Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472041 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker Reviewed-by: Paul Luse --- lib/blob/blobstore.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/blob/blobstore.h b/lib/blob/blobstore.h index c8d98b2db..61829b2e8 100644 --- a/lib/blob/blobstore.h +++ b/lib/blob/blobstore.h @@ -385,9 +385,10 @@ SPDK_STATIC_ASSERT(SPDK_BS_PAGE_SIZE == sizeof(struct spdk_blob_md_page), "Inval #define SPDK_BS_MAX_DESC_SIZE sizeof(((struct spdk_blob_md_page*)0)->descriptors) -/* TODO: Set to low amount for purpose of testing */ -/* Maximum number of LBA's a single Extent Page can fit */ -#define SPDK_EXTENTS_PER_EP 100 +/* Maximum number of extents a single Extent Page can fit. + * For an SPDK_BS_PAGE_SIZE of 4K SPDK_EXTENTS_PER_EP would be 512. */ +#define SPDK_EXTENTS_PER_EP_MAX ((SPDK_BS_MAX_DESC_SIZE - sizeof(struct spdk_blob_md_descriptor_extent_page)) / sizeof(uint32_t)) +#define SPDK_EXTENTS_PER_EP (spdk_align64pow2(SPDK_EXTENTS_PER_EP_MAX + 1) >> 1u) #define SPDK_BS_SUPER_BLOCK_SIG "SPDKBLOB"