xref: /openbmc/linux/drivers/md/bcache/request.h (revision 2599b53b7b0ea6103d1661dca74d35480cb8fa1f)
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;
12*2599b53bSKent Overstreet 	uint16_t		write_point;
13220bb38cSKent Overstreet 	uint16_t		write_prio;
14220bb38cSKent Overstreet 	short			error;
15c18536a7SKent Overstreet 
16c18536a7SKent Overstreet 	unsigned		bypass:1;
17220bb38cSKent Overstreet 	unsigned		writeback:1;
18c18536a7SKent Overstreet 	unsigned		flush_journal:1;
19220bb38cSKent Overstreet 	unsigned		csum:1;
20220bb38cSKent Overstreet 
21220bb38cSKent Overstreet 	unsigned		replace:1;
22220bb38cSKent 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_cached_dev_request_init(struct cached_dev *dc);
35cafe5635SKent Overstreet void bch_flash_dev_request_init(struct bcache_device *d);
36cafe5635SKent Overstreet 
37cafe5635SKent Overstreet extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;
38cafe5635SKent Overstreet 
39cafe5635SKent Overstreet struct bch_cgroup {
40cafe5635SKent Overstreet #ifdef CONFIG_CGROUP_BCACHE
41cafe5635SKent Overstreet 	struct cgroup_subsys_state	css;
42cafe5635SKent Overstreet #endif
43cafe5635SKent Overstreet 	/*
44cafe5635SKent Overstreet 	 * We subtract one from the index into bch_cache_modes[], so that
45cafe5635SKent Overstreet 	 * default == -1; this makes it so the rest match up with d->cache_mode,
46cafe5635SKent Overstreet 	 * and we use d->cache_mode if cgrp->cache_mode < 0
47cafe5635SKent Overstreet 	 */
48cafe5635SKent Overstreet 	short				cache_mode;
49cafe5635SKent Overstreet 	bool				verify;
50cafe5635SKent Overstreet 	struct cache_stat_collector	stats;
51cafe5635SKent Overstreet };
52cafe5635SKent Overstreet 
53cafe5635SKent Overstreet struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);
54cafe5635SKent Overstreet 
55cafe5635SKent Overstreet #endif /* _BCACHE_REQUEST_H_ */
56