lib/blob: count clusters starting from 0 when parsing EP
Previously part of function assumed that cluster count 1)means number of clusters in EP and another 2) that it is following the active.num_clusters (akin to extent_rle). This was incosistent and showed when using multiple extent pages to serialize metadata. This patch changes it to only go with 1), so it is clear that it means number clusters within particular EP. Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Change-Id: I155104cabc127ed47df04434032fb01e08948e13 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/482848 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:
parent
dd0a320cf9
commit
8b6df6fbab
@ -652,7 +652,7 @@ _spdk_blob_parse_page(const struct spdk_blob_md_page *page, struct spdk_blob *bl
|
|||||||
} else if (desc->type == SPDK_MD_DESCRIPTOR_TYPE_EXTENT_PAGE) {
|
} else if (desc->type == SPDK_MD_DESCRIPTOR_TYPE_EXTENT_PAGE) {
|
||||||
struct spdk_blob_md_descriptor_extent_page *desc_extent;
|
struct spdk_blob_md_descriptor_extent_page *desc_extent;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int cluster_count = blob->active.num_clusters;
|
unsigned int cluster_count = 0;
|
||||||
size_t cluster_idx_length;
|
size_t cluster_idx_length;
|
||||||
|
|
||||||
if (blob->extent_rle_found) {
|
if (blob->extent_rle_found) {
|
||||||
@ -689,12 +689,13 @@ _spdk_blob_parse_page(const struct spdk_blob_md_page *page, struct spdk_blob *bl
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = realloc(blob->active.clusters, cluster_count * sizeof(*blob->active.clusters));
|
tmp = realloc(blob->active.clusters,
|
||||||
|
(cluster_count + blob->active.num_clusters) * sizeof(*blob->active.clusters));
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
blob->active.clusters = tmp;
|
blob->active.clusters = tmp;
|
||||||
blob->active.cluster_array_size = cluster_count;
|
blob->active.cluster_array_size = (cluster_count + blob->active.num_clusters);
|
||||||
|
|
||||||
for (i = 0; i < cluster_idx_length / sizeof(desc_extent->cluster_idx[0]); i++) {
|
for (i = 0; i < cluster_idx_length / sizeof(desc_extent->cluster_idx[0]); i++) {
|
||||||
if (desc_extent->cluster_idx[i] != 0) {
|
if (desc_extent->cluster_idx[i] != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user