Lines Matching +full:1 +full:d +full:- +full:histogram

1 // SPDX-License-Identifier: GPL-2.0-only
12 #include <linux/device-mapper.h>
14 #include "dm-core.h"
15 #include "dm-stats.h"
22 * Using 64-bit values to avoid overflow (which is a
33 unsigned long long *histogram; member
62 #define STAT_PRECISE_TIMESTAMPS 1
75 * exhaust 1/4 of all memory or 1/2 of vmalloc space.
94 if (a > (VMALLOC_END - VMALLOC_START) / DM_STATS_VMALLOC_FACTOR) in __check_shared_memory()
141 shared_memory_amount -= alloc_size; in free_shared_memory()
177 kfree(s->histogram_boundaries); in dm_stat_free()
178 kfree(s->program_id); in dm_stat_free()
179 kfree(s->aux_data); in dm_stat_free()
181 dm_kvfree(s->stat_percpu[cpu][0].histogram, s->histogram_alloc_size); in dm_stat_free()
182 dm_kvfree(s->stat_percpu[cpu], s->percpu_alloc_size); in dm_stat_free()
184 dm_kvfree(s->stat_shared[0].tmp.histogram, s->histogram_alloc_size); in dm_stat_free()
185 dm_kvfree(s, s->shared_alloc_size); in dm_stat_free()
190 return atomic_read(&shared->in_flight[READ]) + in dm_stat_in_flight()
191 atomic_read(&shared->in_flight[WRITE]); in dm_stat_in_flight()
199 mutex_init(&stats->mutex); in dm_stats_init()
200 INIT_LIST_HEAD(&stats->list); in dm_stats_init()
201 stats->precise_timestamps = false; in dm_stats_init()
202 stats->last = alloc_percpu(struct dm_stats_last_position); in dm_stats_init()
203 if (!stats->last) in dm_stats_init()
204 return -ENOMEM; in dm_stats_init()
207 last = per_cpu_ptr(stats->last, cpu); in dm_stats_init()
208 last->last_sector = (sector_t)ULLONG_MAX; in dm_stats_init()
209 last->last_rw = UINT_MAX; in dm_stats_init()
221 while (!list_empty(&stats->list)) { in dm_stats_cleanup()
222 s = container_of(stats->list.next, struct dm_stat, list_entry); in dm_stats_cleanup()
223 list_del(&s->list_entry); in dm_stats_cleanup()
224 for (ni = 0; ni < s->n_entries; ni++) { in dm_stats_cleanup()
225 shared = &s->stat_shared[ni]; in dm_stats_cleanup()
227 DMCRIT("leaked in-flight counter at index %lu " in dm_stats_cleanup()
228 "(start %llu, end %llu, step %llu): reads %d, writes %d", in dm_stats_cleanup()
230 (unsigned long long)s->start, in dm_stats_cleanup()
231 (unsigned long long)s->end, in dm_stats_cleanup()
232 (unsigned long long)s->step, in dm_stats_cleanup()
233 atomic_read(&shared->in_flight[READ]), in dm_stats_cleanup()
234 atomic_read(&shared->in_flight[WRITE])); in dm_stats_cleanup()
238 dm_stat_free(&s->rcu_head); in dm_stats_cleanup()
240 free_percpu(stats->last); in dm_stats_cleanup()
241 mutex_destroy(&stats->mutex); in dm_stats_cleanup()
250 list_for_each(l, &stats->list) { in dm_stats_recalc_precise_timestamps()
252 if (tmp_s->stat_flags & STAT_PRECISE_TIMESTAMPS) { in dm_stats_recalc_precise_timestamps()
257 stats->precise_timestamps = precise_timestamps; in dm_stats_recalc_precise_timestamps()
282 return -EINVAL; in dm_stats_create()
284 n_entries = end - start; in dm_stats_create()
288 if (n_entries != (size_t)n_entries || !(size_t)(n_entries + 1)) in dm_stats_create()
289 return -EOVERFLOW; in dm_stats_create()
292 return -EOVERFLOW; in dm_stats_create()
295 if ((shared_alloc_size - sizeof(struct dm_stat)) / sizeof(struct dm_stat_shared) != n_entries) in dm_stats_create()
296 return -EOVERFLOW; in dm_stats_create()
300 return -EOVERFLOW; in dm_stats_create()
302 histogram_alloc_size = (n_histogram_entries + 1) * (size_t)n_entries * sizeof(unsigned long long); in dm_stats_create()
303 …if (histogram_alloc_size / (n_histogram_entries + 1) != (size_t)n_entries * sizeof(unsigned long l… in dm_stats_create()
304 return -EOVERFLOW; in dm_stats_create()
306 if ((n_histogram_entries + 1) * (size_t)n_entries > DM_STAT_MAX_HISTOGRAM_ENTRIES) in dm_stats_create()
307 return -EOVERFLOW; in dm_stats_create()
311 return -ENOMEM; in dm_stats_create()
315 return -ENOMEM; in dm_stats_create()
317 s->stat_flags = stat_flags; in dm_stats_create()
318 s->n_entries = n_entries; in dm_stats_create()
319 s->start = start; in dm_stats_create()
320 s->end = end; in dm_stats_create()
321 s->step = step; in dm_stats_create()
322 s->shared_alloc_size = shared_alloc_size; in dm_stats_create()
323 s->percpu_alloc_size = percpu_alloc_size; in dm_stats_create()
324 s->histogram_alloc_size = histogram_alloc_size; in dm_stats_create()
326 s->n_histogram_entries = n_histogram_entries; in dm_stats_create()
327 s->histogram_boundaries = kmemdup(histogram_boundaries, in dm_stats_create()
328 s->n_histogram_entries * sizeof(unsigned long long), GFP_KERNEL); in dm_stats_create()
329 if (!s->histogram_boundaries) { in dm_stats_create()
330 r = -ENOMEM; in dm_stats_create()
334 s->program_id = kstrdup(program_id, GFP_KERNEL); in dm_stats_create()
335 if (!s->program_id) { in dm_stats_create()
336 r = -ENOMEM; in dm_stats_create()
339 s->aux_data = kstrdup(aux_data, GFP_KERNEL); in dm_stats_create()
340 if (!s->aux_data) { in dm_stats_create()
341 r = -ENOMEM; in dm_stats_create()
346 atomic_set(&s->stat_shared[ni].in_flight[READ], 0); in dm_stats_create()
347 atomic_set(&s->stat_shared[ni].in_flight[WRITE], 0); in dm_stats_create()
351 if (s->n_histogram_entries) { in dm_stats_create()
354 hi = dm_kvzalloc(s->histogram_alloc_size, NUMA_NO_NODE); in dm_stats_create()
356 r = -ENOMEM; in dm_stats_create()
360 s->stat_shared[ni].tmp.histogram = hi; in dm_stats_create()
361 hi += s->n_histogram_entries + 1; in dm_stats_create()
369 r = -ENOMEM; in dm_stats_create()
372 s->stat_percpu[cpu] = p; in dm_stats_create()
373 if (s->n_histogram_entries) { in dm_stats_create()
376 hi = dm_kvzalloc(s->histogram_alloc_size, cpu_to_node(cpu)); in dm_stats_create()
378 r = -ENOMEM; in dm_stats_create()
382 p[ni].histogram = hi; in dm_stats_create()
383 hi += s->n_histogram_entries + 1; in dm_stats_create()
398 mutex_lock(&stats->mutex); in dm_stats_create()
399 s->id = 0; in dm_stats_create()
400 list_for_each(l, &stats->list) { in dm_stats_create()
402 if (WARN_ON(tmp_s->id < s->id)) { in dm_stats_create()
403 r = -EINVAL; in dm_stats_create()
406 if (tmp_s->id > s->id) in dm_stats_create()
408 if (unlikely(s->id == INT_MAX)) { in dm_stats_create()
409 r = -ENFILE; in dm_stats_create()
412 s->id++; in dm_stats_create()
414 ret_id = s->id; in dm_stats_create()
415 list_add_tail_rcu(&s->list_entry, l); in dm_stats_create()
422 mutex_unlock(&stats->mutex); in dm_stats_create()
429 mutex_unlock(&stats->mutex); in dm_stats_create()
432 dm_stat_free(&s->rcu_head); in dm_stats_create()
440 list_for_each_entry(s, &stats->list, list_entry) { in __dm_stats_find()
441 if (s->id > id) in __dm_stats_find()
443 if (s->id == id) in __dm_stats_find()
455 mutex_lock(&stats->mutex); in dm_stats_delete()
459 mutex_unlock(&stats->mutex); in dm_stats_delete()
460 return -ENOENT; in dm_stats_delete()
463 list_del_rcu(&s->list_entry); in dm_stats_delete()
467 mutex_unlock(&stats->mutex); in dm_stats_delete()
473 if (is_vmalloc_addr(s->stat_percpu) || in dm_stats_delete()
474 is_vmalloc_addr(s->stat_percpu[cpu][0].histogram)) in dm_stats_delete()
477 is_vmalloc_addr(s->stat_shared[0].tmp.histogram)) { in dm_stats_delete()
480 dm_stat_free(&s->rcu_head); in dm_stats_delete()
482 WRITE_ONCE(dm_stat_need_rcu_barrier, 1); in dm_stats_delete()
483 call_rcu(&s->rcu_head, dm_stat_free); in dm_stats_delete()
500 mutex_lock(&stats->mutex); in dm_stats_list()
501 list_for_each_entry(s, &stats->list, list_entry) { in dm_stats_list()
502 if (!program || !strcmp(program, s->program_id)) { in dm_stats_list()
503 len = s->end - s->start; in dm_stats_list()
504 DMEMIT("%d: %llu+%llu %llu %s %s", s->id, in dm_stats_list()
505 (unsigned long long)s->start, in dm_stats_list()
507 (unsigned long long)s->step, in dm_stats_list()
508 s->program_id, in dm_stats_list()
509 s->aux_data); in dm_stats_list()
510 if (s->stat_flags & STAT_PRECISE_TIMESTAMPS) in dm_stats_list()
512 if (s->n_histogram_entries) { in dm_stats_list()
515 DMEMIT(" histogram:"); in dm_stats_list()
516 for (i = 0; i < s->n_histogram_entries; i++) { in dm_stats_list()
519 DMEMIT("%llu", s->histogram_boundaries[i]); in dm_stats_list()
526 mutex_unlock(&stats->mutex); in dm_stats_list()
528 return 1; in dm_stats_list()
540 if (likely(!(s->stat_flags & STAT_PRECISE_TIMESTAMPS))) in dm_stat_round()
545 difference = now - shared->stamp; in dm_stat_round()
549 in_flight_read = (unsigned int)atomic_read(&shared->in_flight[READ]); in dm_stat_round()
550 in_flight_write = (unsigned int)atomic_read(&shared->in_flight[WRITE]); in dm_stat_round()
552 p->io_ticks[READ] += difference; in dm_stat_round()
554 p->io_ticks[WRITE] += difference; in dm_stat_round()
556 p->io_ticks_total += difference; in dm_stat_round()
557 p->time_in_queue += (in_flight_read + in_flight_write) * difference; in dm_stat_round()
559 shared->stamp = now; in dm_stat_round()
567 struct dm_stat_shared *shared = &s->stat_shared[entry]; in dm_stat_for_entry()
575 * from non-interrupt context as well as from interrupt context in dm_stat_for_entry()
578 * On 64-bit architectures the race only results in not counting some in dm_stat_for_entry()
579 * events, so it is acceptable. On 32-bit architectures the race could in dm_stat_for_entry()
592 p = &s->stat_percpu[smp_processor_id()][entry]; in dm_stat_for_entry()
596 atomic_inc(&shared->in_flight[idx]); in dm_stat_for_entry()
601 atomic_dec(&shared->in_flight[idx]); in dm_stat_for_entry()
602 p->sectors[idx] += len; in dm_stat_for_entry()
603 p->ios[idx] += 1; in dm_stat_for_entry()
604 p->merges[idx] += stats_aux->merged; in dm_stat_for_entry()
605 if (!(s->stat_flags & STAT_PRECISE_TIMESTAMPS)) { in dm_stat_for_entry()
606 p->ticks[idx] += duration_jiffies; in dm_stat_for_entry()
609 p->ticks[idx] += stats_aux->duration_ns; in dm_stat_for_entry()
610 duration = stats_aux->duration_ns; in dm_stat_for_entry()
612 if (s->n_histogram_entries) { in dm_stat_for_entry()
613 unsigned int lo = 0, hi = s->n_histogram_entries + 1; in dm_stat_for_entry()
615 while (lo + 1 < hi) { in dm_stat_for_entry()
618 if (s->histogram_boundaries[mid - 1] > duration) in dm_stat_for_entry()
623 p->histogram[lo]++; in dm_stat_for_entry()
642 if (end_sector <= s->start || bi_sector >= s->end) in __dm_stat_bio()
644 if (unlikely(bi_sector < s->start)) { in __dm_stat_bio()
646 todo = end_sector - s->start; in __dm_stat_bio()
648 rel_sector = bi_sector - s->start; in __dm_stat_bio()
649 todo = end_sector - bi_sector; in __dm_stat_bio()
651 if (unlikely(end_sector > s->end)) in __dm_stat_bio()
652 todo -= (end_sector - s->end); in __dm_stat_bio()
654 offset = dm_sector_div64(rel_sector, s->step); in __dm_stat_bio()
657 if (WARN_ON_ONCE(entry >= s->n_entries)) { in __dm_stat_bio()
658 DMCRIT("Invalid area access in region id %d", s->id); in __dm_stat_bio()
662 if (fragment_len > s->step - offset) in __dm_stat_bio()
663 fragment_len = s->step - offset; in __dm_stat_bio()
666 todo -= fragment_len; in __dm_stat_bio()
693 last = raw_cpu_ptr(stats->last); in dm_stats_account_io()
694 stats_aux->merged = in dm_stats_account_io()
695 (bi_sector == (READ_ONCE(last->last_sector) && in dm_stats_account_io()
697 (READ_ONCE(last->last_rw) == WRITE)) in dm_stats_account_io()
699 WRITE_ONCE(last->last_sector, end_sector); in dm_stats_account_io()
700 WRITE_ONCE(last->last_rw, bi_rw); in dm_stats_account_io()
702 duration_jiffies = jiffies - start_time; in dm_stats_account_io()
707 list_for_each_entry_rcu(s, &stats->list, list_entry) { in dm_stats_account_io()
708 if (s->stat_flags & STAT_PRECISE_TIMESTAMPS && !got_precise_time) { in dm_stats_account_io()
711 stats_aux->duration_ns = ktime_to_ns(ktime_get()) - stats_aux->duration_ns; in dm_stats_account_io()
727 p = &s->stat_percpu[smp_processor_id()][x]; in __dm_stat_init_temporary_percpu_totals()
731 shared->tmp.sectors[READ] = 0; in __dm_stat_init_temporary_percpu_totals()
732 shared->tmp.sectors[WRITE] = 0; in __dm_stat_init_temporary_percpu_totals()
733 shared->tmp.ios[READ] = 0; in __dm_stat_init_temporary_percpu_totals()
734 shared->tmp.ios[WRITE] = 0; in __dm_stat_init_temporary_percpu_totals()
735 shared->tmp.merges[READ] = 0; in __dm_stat_init_temporary_percpu_totals()
736 shared->tmp.merges[WRITE] = 0; in __dm_stat_init_temporary_percpu_totals()
737 shared->tmp.ticks[READ] = 0; in __dm_stat_init_temporary_percpu_totals()
738 shared->tmp.ticks[WRITE] = 0; in __dm_stat_init_temporary_percpu_totals()
739 shared->tmp.io_ticks[READ] = 0; in __dm_stat_init_temporary_percpu_totals()
740 shared->tmp.io_ticks[WRITE] = 0; in __dm_stat_init_temporary_percpu_totals()
741 shared->tmp.io_ticks_total = 0; in __dm_stat_init_temporary_percpu_totals()
742 shared->tmp.time_in_queue = 0; in __dm_stat_init_temporary_percpu_totals()
744 if (s->n_histogram_entries) in __dm_stat_init_temporary_percpu_totals()
745 memset(shared->tmp.histogram, 0, (s->n_histogram_entries + 1) * sizeof(unsigned long long)); in __dm_stat_init_temporary_percpu_totals()
748 p = &s->stat_percpu[cpu][x]; in __dm_stat_init_temporary_percpu_totals()
749 shared->tmp.sectors[READ] += READ_ONCE(p->sectors[READ]); in __dm_stat_init_temporary_percpu_totals()
750 shared->tmp.sectors[WRITE] += READ_ONCE(p->sectors[WRITE]); in __dm_stat_init_temporary_percpu_totals()
751 shared->tmp.ios[READ] += READ_ONCE(p->ios[READ]); in __dm_stat_init_temporary_percpu_totals()
752 shared->tmp.ios[WRITE] += READ_ONCE(p->ios[WRITE]); in __dm_stat_init_temporary_percpu_totals()
753 shared->tmp.merges[READ] += READ_ONCE(p->merges[READ]); in __dm_stat_init_temporary_percpu_totals()
754 shared->tmp.merges[WRITE] += READ_ONCE(p->merges[WRITE]); in __dm_stat_init_temporary_percpu_totals()
755 shared->tmp.ticks[READ] += READ_ONCE(p->ticks[READ]); in __dm_stat_init_temporary_percpu_totals()
756 shared->tmp.ticks[WRITE] += READ_ONCE(p->ticks[WRITE]); in __dm_stat_init_temporary_percpu_totals()
757 shared->tmp.io_ticks[READ] += READ_ONCE(p->io_ticks[READ]); in __dm_stat_init_temporary_percpu_totals()
758 shared->tmp.io_ticks[WRITE] += READ_ONCE(p->io_ticks[WRITE]); in __dm_stat_init_temporary_percpu_totals()
759 shared->tmp.io_ticks_total += READ_ONCE(p->io_ticks_total); in __dm_stat_init_temporary_percpu_totals()
760 shared->tmp.time_in_queue += READ_ONCE(p->time_in_queue); in __dm_stat_init_temporary_percpu_totals()
761 if (s->n_histogram_entries) { in __dm_stat_init_temporary_percpu_totals()
764 for (i = 0; i < s->n_histogram_entries + 1; i++) in __dm_stat_init_temporary_percpu_totals()
765 shared->tmp.histogram[i] += READ_ONCE(p->histogram[i]); in __dm_stat_init_temporary_percpu_totals()
778 shared = &s->stat_shared[x]; in __dm_stat_clear()
782 p = &s->stat_percpu[smp_processor_id()][x]; in __dm_stat_clear()
783 p->sectors[READ] -= shared->tmp.sectors[READ]; in __dm_stat_clear()
784 p->sectors[WRITE] -= shared->tmp.sectors[WRITE]; in __dm_stat_clear()
785 p->ios[READ] -= shared->tmp.ios[READ]; in __dm_stat_clear()
786 p->ios[WRITE] -= shared->tmp.ios[WRITE]; in __dm_stat_clear()
787 p->merges[READ] -= shared->tmp.merges[READ]; in __dm_stat_clear()
788 p->merges[WRITE] -= shared->tmp.merges[WRITE]; in __dm_stat_clear()
789 p->ticks[READ] -= shared->tmp.ticks[READ]; in __dm_stat_clear()
790 p->ticks[WRITE] -= shared->tmp.ticks[WRITE]; in __dm_stat_clear()
791 p->io_ticks[READ] -= shared->tmp.io_ticks[READ]; in __dm_stat_clear()
792 p->io_ticks[WRITE] -= shared->tmp.io_ticks[WRITE]; in __dm_stat_clear()
793 p->io_ticks_total -= shared->tmp.io_ticks_total; in __dm_stat_clear()
794 p->time_in_queue -= shared->tmp.time_in_queue; in __dm_stat_clear()
796 if (s->n_histogram_entries) { in __dm_stat_clear()
799 for (i = 0; i < s->n_histogram_entries + 1; i++) { in __dm_stat_clear()
801 p = &s->stat_percpu[smp_processor_id()][x]; in __dm_stat_clear()
802 p->histogram[i] -= shared->tmp.histogram[i]; in __dm_stat_clear()
814 mutex_lock(&stats->mutex); in dm_stats_clear()
818 mutex_unlock(&stats->mutex); in dm_stats_clear()
819 return -ENOENT; in dm_stats_clear()
822 __dm_stat_clear(s, 0, s->n_entries, true); in dm_stats_clear()
824 mutex_unlock(&stats->mutex); in dm_stats_clear()
826 return 1; in dm_stats_clear()
830 * This is like jiffies_to_msec, but works for 64-bit values.
837 if (s->stat_flags & STAT_PRECISE_TIMESTAMPS) in dm_jiffies_to_msec64()
843 if (j >= 1 << 22) { in dm_jiffies_to_msec64()
844 mult = jiffies_to_msecs(1 << 22); in dm_jiffies_to_msec64()
847 if (j >= 1ULL << 44) in dm_jiffies_to_msec64()
869 mutex_lock(&stats->mutex); in dm_stats_print()
873 mutex_unlock(&stats->mutex); in dm_stats_print()
874 return -ENOENT; in dm_stats_print()
879 idx_end > s->n_entries) in dm_stats_print()
880 idx_end = s->n_entries; in dm_stats_print()
885 step = s->step; in dm_stats_print()
886 start = s->start + (step * idx_start); in dm_stats_print()
889 shared = &s->stat_shared[x]; in dm_stats_print()
891 if (unlikely(end > s->end)) in dm_stats_print()
892 end = s->end; in dm_stats_print()
896 DMEMIT("%llu+%llu %llu %llu %llu %llu %llu %llu %llu %llu %d %llu %llu %llu %llu", in dm_stats_print()
899 shared->tmp.ios[READ], in dm_stats_print()
900 shared->tmp.merges[READ], in dm_stats_print()
901 shared->tmp.sectors[READ], in dm_stats_print()
902 dm_jiffies_to_msec64(s, shared->tmp.ticks[READ]), in dm_stats_print()
903 shared->tmp.ios[WRITE], in dm_stats_print()
904 shared->tmp.merges[WRITE], in dm_stats_print()
905 shared->tmp.sectors[WRITE], in dm_stats_print()
906 dm_jiffies_to_msec64(s, shared->tmp.ticks[WRITE]), in dm_stats_print()
908 dm_jiffies_to_msec64(s, shared->tmp.io_ticks_total), in dm_stats_print()
909 dm_jiffies_to_msec64(s, shared->tmp.time_in_queue), in dm_stats_print()
910 dm_jiffies_to_msec64(s, shared->tmp.io_ticks[READ]), in dm_stats_print()
911 dm_jiffies_to_msec64(s, shared->tmp.io_ticks[WRITE])); in dm_stats_print()
912 if (s->n_histogram_entries) { in dm_stats_print()
915 for (i = 0; i < s->n_histogram_entries + 1; i++) in dm_stats_print()
916 DMEMIT("%s%llu", !i ? " " : ":", shared->tmp.histogram[i]); in dm_stats_print()
920 if (unlikely(sz + 1 >= maxlen)) in dm_stats_print()
930 mutex_unlock(&stats->mutex); in dm_stats_print()
932 return 1; in dm_stats_print()
940 mutex_lock(&stats->mutex); in dm_stats_set_aux()
944 mutex_unlock(&stats->mutex); in dm_stats_set_aux()
945 return -ENOENT; in dm_stats_set_aux()
950 mutex_unlock(&stats->mutex); in dm_stats_set_aux()
951 return -ENOMEM; in dm_stats_set_aux()
954 kfree(s->aux_data); in dm_stats_set_aux()
955 s->aux_data = new_aux_data; in dm_stats_set_aux()
957 mutex_unlock(&stats->mutex); in dm_stats_set_aux()
969 *n_histogram_entries = 1; in parse_histogram()
978 return -ENOMEM; in parse_histogram()
982 while (1) { in parse_histogram()
989 return -EINVAL; in parse_histogram()
991 return -EINVAL; in parse_histogram()
994 if (s == 1) in parse_histogram()
996 h = strchr(h, ',') + 1; in parse_histogram()
1028 dm_consume_args(&as, 1); in message_stats_create()
1031 if (!strcmp(a, "-")) { in message_stats_create()
1035 len = 1; in message_stats_create()
1045 if (sscanf(a, "/%u%c", &divisor, &dummy) == 1) { in message_stats_create()
1047 return -EINVAL; in message_stats_create()
1048 step = end - start; in message_stats_create()
1052 step = 1; in message_stats_create()
1053 } else if (sscanf(a, "%llu%c", &step, &dummy) != 1 || in message_stats_create()
1059 if (a && sscanf(a, "%u%c", &feature_args, &dummy) == 1) { in message_stats_create()
1060 while (feature_args--) { in message_stats_create()
1066 else if (!strncasecmp(a, "histogram:", 10)) { in message_stats_create()
1079 program_id = "-"; in message_stats_create()
1080 aux_data = "-"; in message_stats_create()
1099 snprintf(result, maxlen, "%d", INT_MAX); in message_stats_create()
1101 r = 1; in message_stats_create()
1113 snprintf(result, maxlen, "%d", id); in message_stats_create()
1115 r = 1; in message_stats_create()
1119 r = -EINVAL; in message_stats_create()
1132 return -EINVAL; in message_stats_delete()
1134 if (sscanf(argv[1], "%d%c", &id, &dummy) != 1 || id < 0) in message_stats_delete()
1135 return -EINVAL; in message_stats_delete()
1147 return -EINVAL; in message_stats_clear()
1149 if (sscanf(argv[1], "%d%c", &id, &dummy) != 1 || id < 0) in message_stats_clear()
1150 return -EINVAL; in message_stats_clear()
1162 if (argc < 1 || argc > 2) in message_stats_list()
1163 return -EINVAL; in message_stats_list()
1165 if (argc > 1) { in message_stats_list()
1166 program = kstrdup(argv[1], GFP_KERNEL); in message_stats_list()
1168 return -ENOMEM; in message_stats_list()
1187 return -EINVAL; in message_stats_print()
1189 if (sscanf(argv[1], "%d%c", &id, &dummy) != 1 || id < 0) in message_stats_print()
1190 return -EINVAL; in message_stats_print()
1193 if (strcmp(argv[2], "-") && in message_stats_print()
1194 sscanf(argv[2], "%lu%c", &idx_start, &dummy) != 1) in message_stats_print()
1195 return -EINVAL; in message_stats_print()
1196 if (strcmp(argv[3], "-") && in message_stats_print()
1197 sscanf(argv[3], "%lu%c", &idx_len, &dummy) != 1) in message_stats_print()
1198 return -EINVAL; in message_stats_print()
1212 return -EINVAL; in message_stats_set_aux()
1214 if (sscanf(argv[1], "%d%c", &id, &dummy) != 1 || id < 0) in message_stats_set_aux()
1215 return -EINVAL; in message_stats_set_aux()
1243 if (r == -EINVAL) in dm_stats_message()