diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2016-07-07 09:47:19 +0100 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2016-07-08 17:27:52 +0100 |
commit | 4bb57341bd99a7d1af1a6a9ed84122369f362ba0 (patch) | |
tree | 008c697edc8fbfe34f71676a133d010b38262371 /libdm | |
parent | c3caf4b80bbade402ba57c32090222214a9bc177 (diff) | |
download | lvm2-4bb57341bd99a7d1af1a6a9ed84122369f362ba0.tar.gz |
libdm: enable creation of filemap regions with histograms
Diffstat (limited to 'libdm')
-rw-r--r-- | libdm/libdm-stats.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c index 55f10104b..6504289f0 100644 --- a/libdm/libdm-stats.c +++ b/libdm/libdm-stats.c @@ -4247,6 +4247,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd, { struct _extent *extents = NULL; uint64_t *regions = NULL, i; + char *hist_arg = NULL; struct statfs fsbuf; struct stat buf; @@ -4279,6 +4280,12 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd, if (!(extents = _stats_get_extents_for_file(dms->mem, fd, count))) return_0; + if (bounds) { + /* _build_histogram_arg enables precise if vals < 1ms. */ + if (!(hist_arg = _build_histogram_arg(bounds, &precise))) + goto_out; + } + /* make space for end-of-table marker */ if (!(regions = dm_malloc((1 + *count) * sizeof(*regions)))) { log_error("Could not allocate memory for region IDs."); @@ -4286,9 +4293,9 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd, } for (i = 0; i < *count; i++) { - if (!_stats_create_region(dms, regions + i, - extents[i].start, extents[i].len, -1, - precise, NULL, dms->program_id, "")) { + if (!_stats_create_region(dms, regions + i, extents[i].start, + extents[i].len, -1, precise, hist_arg, + dms->program_id, "")) { log_error("Failed to create region " FMTu64 " of " FMTu64 " at " FMTu64 ".", i, *count, extents[i].start); @@ -4321,12 +4328,6 @@ uint64_t *dm_stats_create_regions_from_fd(struct dm_stats *dms, int fd, { uint64_t *regions, count = 0; - if (bounds) { - log_error("File mapped groups with histograms are not " - "yet supported."); - return NULL; - } - if (alias && !group) { log_error("Cannot set alias without grouping regions."); return NULL; |