blob: always use uint64_t to represent page_idx
4KiB page size * UINT32_MAX = 16TiB - so we must use a uint64_t for any blobstores on backing devices of 16TiB or greater. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: Ief13cf06d413477dc8ab4f9fe0ff4c0631566c00 Reviewed-on: https://review.gerrithub.io/416448 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
89426e9bb5
commit
f300130872
@ -173,7 +173,7 @@ struct spdk_blob_store {
|
||||
uint64_t total_clusters;
|
||||
uint64_t total_data_clusters;
|
||||
uint64_t num_free_clusters;
|
||||
uint32_t pages_per_cluster;
|
||||
uint64_t pages_per_cluster;
|
||||
|
||||
spdk_blob_id super_blob;
|
||||
struct spdk_bs_type bstype;
|
||||
@ -405,7 +405,7 @@ _spdk_bs_dev_page_to_lba(struct spdk_bs_dev *bs_dev, uint64_t page)
|
||||
return page * SPDK_BS_PAGE_SIZE / bs_dev->blocklen;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
static inline uint64_t
|
||||
_spdk_bs_lba_to_page(struct spdk_blob_store *bs, uint64_t lba)
|
||||
{
|
||||
uint64_t lbas_per_page;
|
||||
@ -471,7 +471,7 @@ _spdk_bs_blob_lba_from_back_dev_lba(struct spdk_blob *blob, uint64_t lba)
|
||||
|
||||
/* End basic conversions */
|
||||
|
||||
static inline uint32_t
|
||||
static inline uint64_t
|
||||
_spdk_bs_blobid_to_page(spdk_blob_id id)
|
||||
{
|
||||
return id & 0xFFFFFFFF;
|
||||
@ -482,8 +482,11 @@ _spdk_bs_blobid_to_page(spdk_blob_id id)
|
||||
* code assumes blob id == page_idx.
|
||||
*/
|
||||
static inline spdk_blob_id
|
||||
_spdk_bs_page_to_blobid(uint32_t page_idx)
|
||||
_spdk_bs_page_to_blobid(uint64_t page_idx)
|
||||
{
|
||||
if (page_idx > UINT32_MAX) {
|
||||
return SPDK_BLOBID_INVALID;
|
||||
}
|
||||
return SPDK_BLOB_BLOBID_HIGH_BIT | page_idx;
|
||||
}
|
||||
|
||||
@ -491,10 +494,10 @@ _spdk_bs_page_to_blobid(uint32_t page_idx)
|
||||
* start of that page.
|
||||
*/
|
||||
static inline uint64_t
|
||||
_spdk_bs_blob_page_to_lba(struct spdk_blob *blob, uint32_t page)
|
||||
_spdk_bs_blob_page_to_lba(struct spdk_blob *blob, uint64_t page)
|
||||
{
|
||||
uint64_t lba;
|
||||
uint32_t pages_per_cluster;
|
||||
uint64_t pages_per_cluster;
|
||||
|
||||
pages_per_cluster = blob->bs->pages_per_cluster;
|
||||
|
||||
@ -510,9 +513,9 @@ _spdk_bs_blob_page_to_lba(struct spdk_blob *blob, uint32_t page)
|
||||
* next cluster boundary.
|
||||
*/
|
||||
static inline uint32_t
|
||||
_spdk_bs_num_pages_to_cluster_boundary(struct spdk_blob *blob, uint32_t page)
|
||||
_spdk_bs_num_pages_to_cluster_boundary(struct spdk_blob *blob, uint64_t page)
|
||||
{
|
||||
uint32_t pages_per_cluster;
|
||||
uint64_t pages_per_cluster;
|
||||
|
||||
pages_per_cluster = blob->bs->pages_per_cluster;
|
||||
|
||||
@ -521,9 +524,9 @@ _spdk_bs_num_pages_to_cluster_boundary(struct spdk_blob *blob, uint32_t page)
|
||||
|
||||
/* Given a page offset into a blob, look up the number of pages into blob to beginning of current cluster */
|
||||
static inline uint32_t
|
||||
_spdk_bs_page_to_cluster_start(struct spdk_blob *blob, uint32_t page)
|
||||
_spdk_bs_page_to_cluster_start(struct spdk_blob *blob, uint64_t page)
|
||||
{
|
||||
uint32_t pages_per_cluster;
|
||||
uint64_t pages_per_cluster;
|
||||
|
||||
pages_per_cluster = blob->bs->pages_per_cluster;
|
||||
|
||||
@ -532,10 +535,10 @@ _spdk_bs_page_to_cluster_start(struct spdk_blob *blob, uint32_t page)
|
||||
|
||||
/* Given a page offset into a blob, look up if it is from allocated cluster. */
|
||||
static inline bool
|
||||
_spdk_bs_page_is_allocated(struct spdk_blob *blob, uint32_t page)
|
||||
_spdk_bs_page_is_allocated(struct spdk_blob *blob, uint64_t page)
|
||||
{
|
||||
uint64_t lba;
|
||||
uint32_t pages_per_cluster;
|
||||
uint64_t pages_per_cluster;
|
||||
|
||||
pages_per_cluster = blob->bs->pages_per_cluster;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user