request.h 1.3 KB
Newer Older
K
Kent Overstreet 已提交
1 2 3 4 5
#ifndef _BCACHE_REQUEST_H_
#define _BCACHE_REQUEST_H_

#include <linux/cgroup.h>

K
Kent Overstreet 已提交
6
struct data_insert_op {
K
Kent Overstreet 已提交
7
	struct closure		cl;
K
Kent Overstreet 已提交
8
	struct cache_set	*c;
K
Kent Overstreet 已提交
9
	struct bio		*bio;
K
Kent Overstreet 已提交
10

K
Kent Overstreet 已提交
11
	unsigned		inode;
12
	uint16_t		write_point;
K
Kent Overstreet 已提交
13 14
	uint16_t		write_prio;
	short			error;
K
Kent Overstreet 已提交
15 16

	unsigned		bypass:1;
K
Kent Overstreet 已提交
17
	unsigned		writeback:1;
K
Kent Overstreet 已提交
18
	unsigned		flush_journal:1;
K
Kent Overstreet 已提交
19
	unsigned		csum:1;
K
Kent Overstreet 已提交
20

K
Kent Overstreet 已提交
21
	unsigned		replace:1;
K
Kent Overstreet 已提交
22
	unsigned		replace_collision:1;
K
Kent Overstreet 已提交
23

K
Kent Overstreet 已提交
24
	unsigned		insert_data_done:1;
25 26 27

	/* Anything past this point won't get zeroed in search_alloc() */
	struct keylist		insert_keys;
K
Kent Overstreet 已提交
28
	BKEY_PADDED(replace_key);
K
Kent Overstreet 已提交
29 30
};

K
Kent Overstreet 已提交
31
unsigned bch_get_congested(struct cache_set *);
32
void bch_data_insert(struct closure *cl);
K
Kent Overstreet 已提交
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

void bch_cached_dev_request_init(struct cached_dev *dc);
void bch_flash_dev_request_init(struct bcache_device *d);

extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache;

struct bch_cgroup {
#ifdef CONFIG_CGROUP_BCACHE
	struct cgroup_subsys_state	css;
#endif
	/*
	 * We subtract one from the index into bch_cache_modes[], so that
	 * default == -1; this makes it so the rest match up with d->cache_mode,
	 * and we use d->cache_mode if cgrp->cache_mode < 0
	 */
	short				cache_mode;
	bool				verify;
	struct cache_stat_collector	stats;
};

struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio);

#endif /* _BCACHE_REQUEST_H_ */