aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2015-08-18 16:26:16 -0400
committerMike Snitzer <snitzer@redhat.com>2015-08-18 17:20:03 -0400
commitbd49784fd1e8f42c7600fbfa206361324857f373 (patch)
tree238d475c49cc50ba1543e6692553a6a0f3b384e8
parent84f8bd86cc8977c344df572169f7ec10b8188cfa (diff)
dm stats: report precise_timestamps and histogram in @stats_list output
If the user selected the precise_timestamps or histogram options, report it in the @stats_list message output. If the user didn't select these options, no extra tokens are reported, thus it is backward compatible with old software that doesn't know about precise timestamps and histogram. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Cc: stable@vger.kernel.org # 4.2
-rw-r--r--Documentation/device-mapper/statistics.txt4
-rw-r--r--drivers/md/dm-stats.c14
-rw-r--r--include/uapi/linux/dm-ioctl.h4
3 files changed, 19 insertions, 3 deletions
diff --git a/Documentation/device-mapper/statistics.txt b/Documentation/device-mapper/statistics.txt
index 4919b2dfd1b3..6f5ef944ca4c 100644
--- a/Documentation/device-mapper/statistics.txt
+++ b/Documentation/device-mapper/statistics.txt
@@ -121,6 +121,10 @@ Messages
121 121
122 Output format: 122 Output format:
123 <region_id>: <start_sector>+<length> <step> <program_id> <aux_data> 123 <region_id>: <start_sector>+<length> <step> <program_id> <aux_data>
124 precise_timestamps histogram:n1,n2,n3,...
125
126 The strings "precise_timestamps" and "histogram" are printed only
127 if they were specified when creating the region.
124 128
125 @stats_print <region_id> [<starting_line> <number_of_lines>] 129 @stats_print <region_id> [<starting_line> <number_of_lines>]
126 130
diff --git a/drivers/md/dm-stats.c b/drivers/md/dm-stats.c
index 8a8b48fa901a..8289804ccd99 100644
--- a/drivers/md/dm-stats.c
+++ b/drivers/md/dm-stats.c
@@ -457,12 +457,24 @@ static int dm_stats_list(struct dm_stats *stats, const char *program,
457 list_for_each_entry(s, &stats->list, list_entry) { 457 list_for_each_entry(s, &stats->list, list_entry) {
458 if (!program || !strcmp(program, s->program_id)) { 458 if (!program || !strcmp(program, s->program_id)) {
459 len = s->end - s->start; 459 len = s->end - s->start;
460 DMEMIT("%d: %llu+%llu %llu %s %s\n", s->id, 460 DMEMIT("%d: %llu+%llu %llu %s %s", s->id,
461 (unsigned long long)s->start, 461 (unsigned long long)s->start,
462 (unsigned long long)len, 462 (unsigned long long)len,
463 (unsigned long long)s->step, 463 (unsigned long long)s->step,
464 s->program_id, 464 s->program_id,
465 s->aux_data); 465 s->aux_data);
466 if (s->stat_flags & STAT_PRECISE_TIMESTAMPS)
467 DMEMIT(" precise_timestamps");
468 if (s->n_histogram_entries) {
469 unsigned i;
470 DMEMIT(" histogram:");
471 for (i = 0; i < s->n_histogram_entries; i++) {
472 if (i)
473 DMEMIT(",");
474 DMEMIT("%llu", s->histogram_boundaries[i]);
475 }
476 }
477 DMEMIT("\n");
466 } 478 }
467 } 479 }
468 mutex_unlock(&stats->mutex); 480 mutex_unlock(&stats->mutex);
diff --git a/include/uapi/linux/dm-ioctl.h b/include/uapi/linux/dm-ioctl.h
index 061aca3a962d..d34611e35a30 100644
--- a/include/uapi/linux/dm-ioctl.h
+++ b/include/uapi/linux/dm-ioctl.h
@@ -267,9 +267,9 @@ enum {
267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl) 267#define DM_DEV_SET_GEOMETRY _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
268 268
269#define DM_VERSION_MAJOR 4 269#define DM_VERSION_MAJOR 4
270#define DM_VERSION_MINOR 32 270#define DM_VERSION_MINOR 33
271#define DM_VERSION_PATCHLEVEL 0 271#define DM_VERSION_PATCHLEVEL 0
272#define DM_VERSION_EXTRA "-ioctl (2015-6-26)" 272#define DM_VERSION_EXTRA "-ioctl (2015-8-18)"
273 273
274/* Status bits */ 274/* Status bits */
275#define DM_READONLY_FLAG (1 << 0) /* In/Out */ 275#define DM_READONLY_FLAG (1 << 0) /* In/Out */