summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2015-08-14 20:28:06 +0100
committerBryn M. Reeves <bmr@redhat.com>2015-08-14 22:03:37 +0100
commit77fae3d8522ffb1077dcb0e2e9ebfba86cf19daf (patch)
treebed1763f509747e19432aab2859584a6d95cd2f2
parent16ff2d927f6ce2f8c2ad8f7e6ec8fb52bd2a066c (diff)
downloadlvm2-77fae3d8522ffb1077dcb0e2e9ebfba86cf19daf.tar.gz
libdm: ensure dm_stats_get_area_start includes region offset
The dm_stats_get_area_start (and its '_current_' variant) methods are expected to return the start sector of the area in the containing device. Make sure the call adds region->start to the returned value.
-rw-r--r--libdm/libdm-stats.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index ea4feefaa..51aba793e 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -1328,9 +1328,10 @@ uint64_t dm_stats_get_current_region_area_len(const struct dm_stats *dms,
uint64_t dm_stats_get_area_start(const struct dm_stats *dms, uint64_t *start,
uint64_t region_id, uint64_t area_id)
{
+ struct dm_stats_region *region = &dms->regions[region_id];
if (!dms || !dms->regions)
return_0;
- *start = dms->regions[region_id].step * area_id;
+ *start = region->start + region->step * area_id;
return 1;
}