summaryrefslogtreecommitdiff
path: root/fs/bcachefs/stats_types.h
blob: 28e4c69e8e6d51b4f5d90aefa03bc89df524932d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef _BCACHE_STATS_TYPES_H_
#define _BCACHE_STATS_TYPES_H_

struct cache_stat_collector {
	union {
	struct {
		atomic_t	cache_hits;
		atomic_t	cache_misses;
		atomic_t	cache_bypass_hits;
		atomic_t	cache_bypass_misses;
	};

	/* cache_hit_array[!bypass][!hit]: */
	atomic_t		cache_hit_array[2][2];
	};


	atomic_t		cache_readaheads;
	atomic_t		cache_miss_collisions;
	atomic_t		sectors_bypassed;
	atomic_t		foreground_write_sectors;
	atomic_t		gc_write_sectors;
	atomic_t		discard_sectors;
};

struct cache_stats {
	struct kobject		kobj;

	unsigned long		cache_hits;
	unsigned long		cache_misses;
	unsigned long		cache_bypass_hits;
	unsigned long		cache_bypass_misses;
	unsigned long		cache_readaheads;
	unsigned long		cache_miss_collisions;
	unsigned long		sectors_bypassed;
	unsigned long		foreground_write_sectors;
	unsigned long		gc_write_sectors;
	unsigned long		discard_sectors;

	unsigned		rescale;
};

struct cache_accounting {
	struct closure		cl;
	struct timer_list	timer;
	atomic_t		closing;

	struct cache_stat_collector collector;

	struct cache_stats	total;
	struct cache_stats	five_minute;
	struct cache_stats	hour;
	struct cache_stats	day;
};

#endif /* _BCACHE_STATS_TYPES_H_ */