mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
libdm: enable creation of filemap regions with histograms
This commit is contained in:
parent
c3caf4b80b
commit
4bb57341bd
@ -4247,6 +4247,7 @@ static uint64_t *_stats_create_file_regions(struct dm_stats *dms, int fd,
|
|||||||
{
|
{
|
||||||
struct _extent *extents = NULL;
|
struct _extent *extents = NULL;
|
||||||
uint64_t *regions = NULL, i;
|
uint64_t *regions = NULL, i;
|
||||||
|
char *hist_arg = NULL;
|
||||||
struct statfs fsbuf;
|
struct statfs fsbuf;
|
||||||
struct stat buf;
|
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)))
|
if (!(extents = _stats_get_extents_for_file(dms->mem, fd, count)))
|
||||||
return_0;
|
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 */
|
/* make space for end-of-table marker */
|
||||||
if (!(regions = dm_malloc((1 + *count) * sizeof(*regions)))) {
|
if (!(regions = dm_malloc((1 + *count) * sizeof(*regions)))) {
|
||||||
log_error("Could not allocate memory for region IDs.");
|
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++) {
|
for (i = 0; i < *count; i++) {
|
||||||
if (!_stats_create_region(dms, regions + i,
|
if (!_stats_create_region(dms, regions + i, extents[i].start,
|
||||||
extents[i].start, extents[i].len, -1,
|
extents[i].len, -1, precise, hist_arg,
|
||||||
precise, NULL, dms->program_id, "")) {
|
dms->program_id, "")) {
|
||||||
log_error("Failed to create region " FMTu64 " of "
|
log_error("Failed to create region " FMTu64 " of "
|
||||||
FMTu64 " at " FMTu64 ".", i, *count,
|
FMTu64 " at " FMTu64 ".", i, *count,
|
||||||
extents[i].start);
|
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;
|
uint64_t *regions, count = 0;
|
||||||
|
|
||||||
if (bounds) {
|
|
||||||
log_error("File mapped groups with histograms are not "
|
|
||||||
"yet supported.");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (alias && !group) {
|
if (alias && !group) {
|
||||||
log_error("Cannot set alias without grouping regions.");
|
log_error("Cannot set alias without grouping regions.");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user