#include <linux/rculist.h>
#include <linux/threads.h>
#include <linux/preempt.h>
#include <linux/irqflags.h>
#include <linux/vmalloc.h>
#include <linux/module.h>
#include <linux/device-mapper.h>
#define DM_MSG_PREFIX "stats"
static int dm_stat_need_rcu_barrier;
unsigned long long sectors[2];
unsigned long long ios[2];
unsigned long long merges[2];
unsigned long long ticks[2];
unsigned long long io_ticks[2];
unsigned long long io_ticks_total;
unsigned long long time_in_queue;
unsigned long long *histogram;
unsigned long long stamp;
struct dm_stat_percpu tmp;
struct list_head list_entry;
unsigned n_histogram_entries;
unsigned long long *histogram_boundaries;
struct rcu_head rcu_head;
size_t shared_alloc_size;
size_t percpu_alloc_size;
size_t histogram_alloc_size;
struct dm_stat_percpu *stat_percpu[NR_CPUS];
struct dm_stat_shared stat_shared[0];
#define STAT_PRECISE_TIMESTAMPS 1
struct dm_stats_last_position {
#define DM_STATS_MEMORY_FACTOR 4
#define DM_STATS_VMALLOC_FACTOR 2
static DEFINE_SPINLOCK(shared_memory_lock);
static unsigned long shared_memory_amount;
static bool __check_shared_memory(size_t alloc_size)
a = shared_memory_amount + alloc_size;
if (a < shared_memory_amount)
if (a >> PAGE_SHIFT > totalram_pages() / DM_STATS_MEMORY_FACTOR)
if (a > (VMALLOC_END - VMALLOC_START) / DM_STATS_VMALLOC_FACTOR)