dm-stats.h 949 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef DM_STATS_H
  2. #define DM_STATS_H
  3. #include <linux/types.h>
  4. #include <linux/mutex.h>
  5. #include <linux/list.h>
  6. int dm_statistics_init(void);
  7. void dm_statistics_exit(void);
  8. struct dm_stats {
  9. struct mutex mutex;
  10. struct list_head list; /* list of struct dm_stat */
  11. struct dm_stats_last_position __percpu *last;
  12. sector_t last_sector;
  13. unsigned last_rw;
  14. };
  15. struct dm_stats_aux {
  16. bool merged;
  17. unsigned long long duration_ns;
  18. };
  19. void dm_stats_init(struct dm_stats *st);
  20. void dm_stats_cleanup(struct dm_stats *st);
  21. struct mapped_device;
  22. int dm_stats_message(struct mapped_device *md, unsigned argc, char **argv,
  23. char *result, unsigned maxlen);
  24. void dm_stats_account_io(struct dm_stats *stats, unsigned long bi_rw,
  25. sector_t bi_sector, unsigned bi_sectors, bool end,
  26. unsigned long duration_jiffies,
  27. struct dm_stats_aux *aux);
  28. static inline bool dm_stats_used(struct dm_stats *st)
  29. {
  30. return !list_empty(&st->list);
  31. }
  32. #endif