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