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.
Cherry-pick of commit 89426e9bb5
from master.
Change-Id: I4fff3ea8248b012bacfda92765088c868efcb218
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>
Reviewed-on: https://review.gerrithub.io/416562
This commit is contained in:
parent
5bf3a5f383
commit
001edfaabf
@ -566,7 +566,7 @@ _spdk_blob_serialize_extent(const struct spdk_blob *blob,
|
|||||||
struct spdk_blob_md_descriptor_extent *desc;
|
struct spdk_blob_md_descriptor_extent *desc;
|
||||||
size_t cur_sz;
|
size_t cur_sz;
|
||||||
uint64_t i, extent_idx;
|
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 */
|
/* The buffer must have room for at least one extent */
|
||||||
cur_sz = sizeof(struct spdk_blob_md_descriptor) + sizeof(desc->extents[0]);
|
cur_sz = sizeof(struct spdk_blob_md_descriptor) + sizeof(desc->extents[0]);
|
||||||
|
@ -426,7 +426,7 @@ _spdk_bs_dev_lba_to_page(struct spdk_bs_dev *bs_dev, uint64_t lba)
|
|||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
_spdk_bs_cluster_to_page(struct spdk_blob_store *bs, uint32_t cluster)
|
_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
|
static inline uint32_t
|
||||||
@ -440,7 +440,7 @@ _spdk_bs_page_to_cluster(struct spdk_blob_store *bs, uint64_t page)
|
|||||||
static inline uint64_t
|
static inline uint64_t
|
||||||
_spdk_bs_cluster_to_lba(struct spdk_blob_store *bs, uint32_t cluster)
|
_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
|
static inline uint32_t
|
||||||
|
Loading…
Reference in New Issue
Block a user