1cafe5635SKent Overstreet #ifndef _BCACHE_REQUEST_H_ 2cafe5635SKent Overstreet #define _BCACHE_REQUEST_H_ 3cafe5635SKent Overstreet 4cafe5635SKent Overstreet #include <linux/cgroup.h> 5cafe5635SKent Overstreet 6*220bb38cSKent Overstreet struct data_insert_op { 7cafe5635SKent Overstreet struct closure cl; 8c18536a7SKent Overstreet struct cache_set *c; 9cafe5635SKent Overstreet struct task_struct *task; 10*220bb38cSKent Overstreet struct bio *bio; 11cafe5635SKent Overstreet 12c18536a7SKent Overstreet unsigned inode; 13*220bb38cSKent Overstreet uint16_t write_prio; 14*220bb38cSKent Overstreet short error; 15c18536a7SKent Overstreet 16c18536a7SKent Overstreet unsigned bypass:1; 17*220bb38cSKent Overstreet unsigned writeback:1; 18c18536a7SKent Overstreet unsigned flush_journal:1; 19*220bb38cSKent Overstreet unsigned csum:1; 20*220bb38cSKent Overstreet 21*220bb38cSKent Overstreet unsigned replace:1; 22*220bb38cSKent Overstreet unsigned replace_collision:1; 23c18536a7SKent Overstreet 24c18536a7SKent Overstreet unsigned insert_data_done:1; 250b93207aSKent Overstreet 260b93207aSKent Overstreet /* Anything past this point won't get zeroed in search_alloc() */ 270b93207aSKent Overstreet struct keylist insert_keys; 281b207d80SKent Overstreet BKEY_PADDED(replace_key); 29cafe5635SKent Overstreet }; 30cafe5635SKent Overstreet 31c37511b8SKent Overstreet unsigned bch_get_congested(struct cache_set *); 32a34a8bfdSKent Overstreet void bch_data_insert(struct closure *cl); 33cafe5635SKent Overstreet 34cafe5635SKent Overstreet void bch_open_buckets_free(struct cache_set *); 35cafe5635SKent Overstreet int bch_open_buckets_alloc(struct cache_set *); 36cafe5635SKent Overstreet 37cafe5635SKent Overstreet void bch_cached_dev_request_init(struct cached_dev *dc); 38cafe5635SKent Overstreet void bch_flash_dev_request_init(struct bcache_device *d); 39cafe5635SKent Overstreet 40cafe5635SKent Overstreet extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache; 41cafe5635SKent Overstreet 42cafe5635SKent Overstreet struct bch_cgroup { 43cafe5635SKent Overstreet #ifdef CONFIG_CGROUP_BCACHE 44cafe5635SKent Overstreet struct cgroup_subsys_state css; 45cafe5635SKent Overstreet #endif 46cafe5635SKent Overstreet /* 47cafe5635SKent Overstreet * We subtract one from the index into bch_cache_modes[], so that 48cafe5635SKent Overstreet * default == -1; this makes it so the rest match up with d->cache_mode, 49cafe5635SKent Overstreet * and we use d->cache_mode if cgrp->cache_mode < 0 50cafe5635SKent Overstreet */ 51cafe5635SKent Overstreet short cache_mode; 52cafe5635SKent Overstreet bool verify; 53cafe5635SKent Overstreet struct cache_stat_collector stats; 54cafe5635SKent Overstreet }; 55cafe5635SKent Overstreet 56cafe5635SKent Overstreet struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio); 57cafe5635SKent Overstreet 58cafe5635SKent Overstreet #endif /* _BCACHE_REQUEST_H_ */ 59