blob: change lba to uint64_t in serialize_extent
Make sure we don't truncate the LBA when using it to serialize the cluster array into an extent list. We also need to add an explicit cast in _spdk_bs_cluster_to_lba to ensure the conversion doesn't get truncated. While here, do the same cast for _spdk_bs_cluster_to_page. Change-Id: If4e65ed86550e39dfa39826930dfafac158d519c Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Signed-off-by: Jim Harris <james.r.harris@intel.com> Reviewed-on: https://review.gerrithub.io/416231 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
841f0beae5
commit
89426e9bb5
@ -665,7 +665,7 @@ _spdk_blob_serialize_extent(const struct spdk_blob *blob,
|
||||
struct spdk_blob_md_descriptor_extent *desc;
|
||||
size_t cur_sz;
|
||||
uint64_t i, extent_idx;
|
||||
uint32_t lba, lba_per_cluster, lba_count;
|
||||
uint64_t lba, lba_per_cluster, lba_count;
|
||||
|
||||
/* The buffer must have room for at least one extent */
|
||||
cur_sz = sizeof(struct spdk_blob_md_descriptor) + sizeof(desc->extents[0]);
|
||||
|
@ -432,7 +432,7 @@ _spdk_bs_dev_lba_to_page(struct spdk_bs_dev *bs_dev, uint64_t lba)
|
||||
static inline uint64_t
|
||||
_spdk_bs_cluster_to_page(struct spdk_blob_store *bs, uint32_t cluster)
|
||||
{
|
||||
return cluster * bs->pages_per_cluster;
|
||||
return (uint64_t)cluster * bs->pages_per_cluster;
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
@ -446,7 +446,7 @@ _spdk_bs_page_to_cluster(struct spdk_blob_store *bs, uint64_t page)
|
||||
static inline uint64_t
|
||||
_spdk_bs_cluster_to_lba(struct spdk_blob_store *bs, uint32_t cluster)
|
||||
{
|
||||
return cluster * (bs->cluster_sz / bs->dev->blocklen);
|
||||
return (uint64_t)cluster * (bs->cluster_sz / bs->dev->blocklen);
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
|
Loading…
Reference in New Issue
Block a user