xref: /openbmc/linux/drivers/md/bcache/request.h (revision a5ae4300)
1cafe5635SKent Overstreet #ifndef _BCACHE_REQUEST_H_
2cafe5635SKent Overstreet #define _BCACHE_REQUEST_H_
3cafe5635SKent Overstreet 
4cafe5635SKent Overstreet #include <linux/cgroup.h>
5cafe5635SKent Overstreet 
6220bb38cSKent Overstreet struct data_insert_op {
7cafe5635SKent Overstreet 	struct closure		cl;
8c18536a7SKent Overstreet 	struct cache_set	*c;
9220bb38cSKent Overstreet 	struct bio		*bio;
10cafe5635SKent Overstreet 
11c18536a7SKent Overstreet 	unsigned		inode;
122599b53bSKent Overstreet 	uint16_t		write_point;
13220bb38cSKent Overstreet 	uint16_t		write_prio;
14220bb38cSKent Overstreet 	short			error;
15c18536a7SKent Overstreet 
16a5ae4300SKent Overstreet 	union {
17a5ae4300SKent Overstreet 		uint16_t	flags;
18a5ae4300SKent Overstreet 
19a5ae4300SKent Overstreet 	struct {
20c18536a7SKent Overstreet 		unsigned	bypass:1;
21220bb38cSKent Overstreet 		unsigned	writeback:1;
22c18536a7SKent Overstreet 		unsigned	flush_journal:1;
23220bb38cSKent Overstreet 		unsigned	csum:1;
24220bb38cSKent Overstreet 
25220bb38cSKent Overstreet 		unsigned	replace:1;
26220bb38cSKent Overstreet 		unsigned	replace_collision:1;
27c18536a7SKent Overstreet 
28c18536a7SKent Overstreet 		unsigned	insert_data_done:1;
29a5ae4300SKent Overstreet 	};
30a5ae4300SKent Overstreet 	};
310b93207aSKent Overstreet 
320b93207aSKent Overstreet 	struct keylist		insert_keys;
331b207d80SKent Overstreet 	BKEY_PADDED(replace_key);
34cafe5635SKent Overstreet };
35cafe5635SKent Overstreet 
36c37511b8SKent Overstreet unsigned bch_get_congested(struct cache_set *);
37a34a8bfdSKent Overstreet void bch_data_insert(struct closure *cl);
38cafe5635SKent Overstreet 
39cafe5635SKent Overstreet void bch_cached_dev_request_init(struct cached_dev *dc);
40cafe5635SKent Overstreet void bch_flash_dev_request_init(struct bcache_device *d);
41cafe5635SKent Overstreet 
42cafe5635SKent Overstreet extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;
43cafe5635SKent Overstreet 
44cafe5635SKent Overstreet struct bch_cgroup {
45cafe5635SKent Overstreet #ifdef CONFIG_CGROUP_BCACHE
46cafe5635SKent Overstreet 	struct cgroup_subsys_state	css;
47cafe5635SKent Overstreet #endif
48cafe5635SKent Overstreet 	/*
49cafe5635SKent Overstreet 	 * We subtract one from the index into bch_cache_modes[], so that
50cafe5635SKent Overstreet 	 * default == -1; this makes it so the rest match up with d->cache_mode,
51cafe5635SKent Overstreet 	 * and we use d->cache_mode if cgrp->cache_mode < 0
52cafe5635SKent Overstreet 	 */
53cafe5635SKent Overstreet 	short				cache_mode;
54cafe5635SKent Overstreet 	bool				verify;
55cafe5635SKent Overstreet 	struct cache_stat_collector	stats;
56cafe5635SKent Overstreet };
57cafe5635SKent Overstreet 
58cafe5635SKent Overstreet struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);
59cafe5635SKent Overstreet 
60cafe5635SKent Overstreet #endif /* _BCACHE_REQUEST_H_ */
61