Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _BCACHE_STATS_H_
0003 #define _BCACHE_STATS_H_
0004 
0005 struct cache_stat_collector {
0006     atomic_t cache_hits;
0007     atomic_t cache_misses;
0008     atomic_t cache_bypass_hits;
0009     atomic_t cache_bypass_misses;
0010     atomic_t cache_miss_collisions;
0011     atomic_t sectors_bypassed;
0012 };
0013 
0014 struct cache_stats {
0015     struct kobject      kobj;
0016 
0017     unsigned long cache_hits;
0018     unsigned long cache_misses;
0019     unsigned long cache_bypass_hits;
0020     unsigned long cache_bypass_misses;
0021     unsigned long cache_readaheads;
0022     unsigned long cache_miss_collisions;
0023     unsigned long sectors_bypassed;
0024 
0025     unsigned int        rescale;
0026 };
0027 
0028 struct cache_accounting {
0029     struct closure      cl;
0030     struct timer_list   timer;
0031     atomic_t        closing;
0032 
0033     struct cache_stat_collector collector;
0034 
0035     struct cache_stats total;
0036     struct cache_stats five_minute;
0037     struct cache_stats hour;
0038     struct cache_stats day;
0039 };
0040 
0041 struct cache_set;
0042 struct cached_dev;
0043 struct bcache_device;
0044 
0045 void bch_cache_accounting_init(struct cache_accounting *acc,
0046                    struct closure *parent);
0047 
0048 int bch_cache_accounting_add_kobjs(struct cache_accounting *acc,
0049                    struct kobject *parent);
0050 
0051 void bch_cache_accounting_clear(struct cache_accounting *acc);
0052 
0053 void bch_cache_accounting_destroy(struct cache_accounting *acc);
0054 
0055 void bch_mark_cache_accounting(struct cache_set *c, struct bcache_device *d,
0056                    bool hit, bool bypass);
0057 void bch_mark_cache_readahead(struct cache_set *c, struct bcache_device *d);
0058 void bch_mark_cache_miss_collision(struct cache_set *c,
0059                    struct bcache_device *d);
0060 void bch_mark_sectors_bypassed(struct cache_set *c,
0061                    struct cached_dev *dc,
0062                    int sectors);
0063 
0064 #endif /* _BCACHE_STATS_H_ */