Linux 4.19.133
[linux/fpc-iii.git] / drivers / md / dm-stats.h
blob2ddfae678f320f84776c772f1107da8eab485385
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef DM_STATS_H
3 #define DM_STATS_H
5 #include <linux/types.h>
6 #include <linux/mutex.h>
7 #include <linux/list.h>
9 int dm_statistics_init(void);
10 void dm_statistics_exit(void);
12 struct dm_stats {
13 struct mutex mutex;
14 struct list_head list; /* list of struct dm_stat */
15 struct dm_stats_last_position __percpu *last;
16 sector_t last_sector;
17 unsigned last_rw;
20 struct dm_stats_aux {
21 bool merged;
22 unsigned long long duration_ns;
25 void dm_stats_init(struct dm_stats *st);
26 void dm_stats_cleanup(struct dm_stats *st);
28 struct mapped_device;
30 int dm_stats_message(struct mapped_device *md, unsigned argc, char **argv,
31 char *result, unsigned maxlen);
33 void dm_stats_account_io(struct dm_stats *stats, unsigned long bi_rw,
34 sector_t bi_sector, unsigned bi_sectors, bool end,
35 unsigned long duration_jiffies,
36 struct dm_stats_aux *aux);
38 static inline bool dm_stats_used(struct dm_stats *st)
40 return !list_empty(&st->list);
43 #endif