1*cafe5635SKent Overstreet #ifndef _BCACHE_REQUEST_H_ 2*cafe5635SKent Overstreet #define _BCACHE_REQUEST_H_ 3*cafe5635SKent Overstreet 4*cafe5635SKent Overstreet #include <linux/cgroup.h> 5*cafe5635SKent Overstreet 6*cafe5635SKent Overstreet struct search { 7*cafe5635SKent Overstreet /* Stack frame for bio_complete */ 8*cafe5635SKent Overstreet struct closure cl; 9*cafe5635SKent Overstreet 10*cafe5635SKent Overstreet struct bcache_device *d; 11*cafe5635SKent Overstreet struct task_struct *task; 12*cafe5635SKent Overstreet 13*cafe5635SKent Overstreet struct bbio bio; 14*cafe5635SKent Overstreet struct bio *orig_bio; 15*cafe5635SKent Overstreet struct bio *cache_miss; 16*cafe5635SKent Overstreet unsigned cache_bio_sectors; 17*cafe5635SKent Overstreet 18*cafe5635SKent Overstreet unsigned recoverable:1; 19*cafe5635SKent Overstreet unsigned unaligned_bvec:1; 20*cafe5635SKent Overstreet 21*cafe5635SKent Overstreet unsigned write:1; 22*cafe5635SKent Overstreet unsigned writeback:1; 23*cafe5635SKent Overstreet 24*cafe5635SKent Overstreet /* IO error returned to s->bio */ 25*cafe5635SKent Overstreet short error; 26*cafe5635SKent Overstreet unsigned long start_time; 27*cafe5635SKent Overstreet 28*cafe5635SKent Overstreet /* Anything past op->keys won't get zeroed in do_bio_hook */ 29*cafe5635SKent Overstreet struct btree_op op; 30*cafe5635SKent Overstreet }; 31*cafe5635SKent Overstreet 32*cafe5635SKent Overstreet void bch_cache_read_endio(struct bio *, int); 33*cafe5635SKent Overstreet int bch_get_congested(struct cache_set *); 34*cafe5635SKent Overstreet void bch_insert_data(struct closure *cl); 35*cafe5635SKent Overstreet void bch_btree_insert_async(struct closure *); 36*cafe5635SKent Overstreet void bch_cache_read_endio(struct bio *, int); 37*cafe5635SKent Overstreet 38*cafe5635SKent Overstreet void bch_open_buckets_free(struct cache_set *); 39*cafe5635SKent Overstreet int bch_open_buckets_alloc(struct cache_set *); 40*cafe5635SKent Overstreet 41*cafe5635SKent Overstreet void bch_cached_dev_request_init(struct cached_dev *dc); 42*cafe5635SKent Overstreet void bch_flash_dev_request_init(struct bcache_device *d); 43*cafe5635SKent Overstreet 44*cafe5635SKent Overstreet extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache; 45*cafe5635SKent Overstreet 46*cafe5635SKent Overstreet struct bch_cgroup { 47*cafe5635SKent Overstreet #ifdef CONFIG_CGROUP_BCACHE 48*cafe5635SKent Overstreet struct cgroup_subsys_state css; 49*cafe5635SKent Overstreet #endif 50*cafe5635SKent Overstreet /* 51*cafe5635SKent Overstreet * We subtract one from the index into bch_cache_modes[], so that 52*cafe5635SKent Overstreet * default == -1; this makes it so the rest match up with d->cache_mode, 53*cafe5635SKent Overstreet * and we use d->cache_mode if cgrp->cache_mode < 0 54*cafe5635SKent Overstreet */ 55*cafe5635SKent Overstreet short cache_mode; 56*cafe5635SKent Overstreet bool verify; 57*cafe5635SKent Overstreet struct cache_stat_collector stats; 58*cafe5635SKent Overstreet }; 59*cafe5635SKent Overstreet 60*cafe5635SKent Overstreet struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio); 61*cafe5635SKent Overstreet 62*cafe5635SKent Overstreet #endif /* _BCACHE_REQUEST_H_ */ 63