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