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 <tomasz.zawadzki@intel.com>
Change-Id: I7e09d92b00dfe5c12d7dd10ac0fc5a9a10d526ac
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/472041
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
This commit is contained in:
Tomasz Zawadzki 2019-10-17 06:36:33 -04:00
parent f4e58993f7
commit e1ce55158a

View File

@ -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"