Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 1 | #ifndef _BCACHE_REQUEST_H_ |
| 2 | #define _BCACHE_REQUEST_H_ |
| 3 | |
| 4 | #include <linux/cgroup.h> |
| 5 | |
| 6 | struct search { |
| 7 | /* Stack frame for bio_complete */ |
| 8 | struct closure cl; |
Kent Overstreet | b54d693 | 2013-07-24 18:04:18 -0700 | [diff] [blame] | 9 | struct closure btree; |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 10 | |
| 11 | struct bcache_device *d; |
Kent Overstreet | c18536a | 2013-07-24 17:44:17 -0700 | [diff] [blame] | 12 | struct cache_set *c; |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 13 | struct task_struct *task; |
| 14 | |
| 15 | struct bbio bio; |
| 16 | struct bio *orig_bio; |
| 17 | struct bio *cache_miss; |
Kent Overstreet | c18536a | 2013-07-24 17:44:17 -0700 | [diff] [blame] | 18 | |
| 19 | /* Bio to be inserted into the cache */ |
| 20 | struct bio *cache_bio; |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 21 | unsigned cache_bio_sectors; |
| 22 | |
Kent Overstreet | c18536a | 2013-07-24 17:44:17 -0700 | [diff] [blame] | 23 | unsigned inode; |
| 24 | |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 25 | unsigned recoverable:1; |
| 26 | unsigned unaligned_bvec:1; |
| 27 | |
| 28 | unsigned write:1; |
| 29 | unsigned writeback:1; |
| 30 | |
Kent Overstreet | c18536a | 2013-07-24 17:44:17 -0700 | [diff] [blame] | 31 | unsigned csum:1; |
| 32 | unsigned bypass:1; |
| 33 | unsigned flush_journal:1; |
| 34 | |
| 35 | unsigned insert_data_done:1; |
Kent Overstreet | 1b207d8 | 2013-09-10 18:52:54 -0700 | [diff] [blame^] | 36 | unsigned replace:1; |
Kent Overstreet | c18536a | 2013-07-24 17:44:17 -0700 | [diff] [blame] | 37 | |
| 38 | uint16_t write_prio; |
| 39 | |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 40 | /* IO error returned to s->bio */ |
| 41 | short error; |
| 42 | unsigned long start_time; |
| 43 | |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 44 | struct btree_op op; |
Kent Overstreet | 0b93207 | 2013-07-24 17:26:51 -0700 | [diff] [blame] | 45 | |
| 46 | /* Anything past this point won't get zeroed in search_alloc() */ |
| 47 | struct keylist insert_keys; |
Kent Overstreet | 1b207d8 | 2013-09-10 18:52:54 -0700 | [diff] [blame^] | 48 | BKEY_PADDED(replace_key); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 49 | }; |
| 50 | |
Kent Overstreet | c37511b | 2013-04-26 15:39:55 -0700 | [diff] [blame] | 51 | unsigned bch_get_congested(struct cache_set *); |
Kent Overstreet | a34a8bf | 2013-10-24 17:07:04 -0700 | [diff] [blame] | 52 | void bch_data_insert(struct closure *cl); |
Kent Overstreet | cafe563 | 2013-03-23 16:11:31 -0700 | [diff] [blame] | 53 | |
| 54 | void bch_open_buckets_free(struct cache_set *); |
| 55 | int bch_open_buckets_alloc(struct cache_set *); |
| 56 | |
| 57 | void bch_cached_dev_request_init(struct cached_dev *dc); |
| 58 | void bch_flash_dev_request_init(struct bcache_device *d); |
| 59 | |
| 60 | extern struct kmem_cache *bch_search_cache, *bch_passthrough_cache; |
| 61 | |
| 62 | struct bch_cgroup { |
| 63 | #ifdef CONFIG_CGROUP_BCACHE |
| 64 | struct cgroup_subsys_state css; |
| 65 | #endif |
| 66 | /* |
| 67 | * We subtract one from the index into bch_cache_modes[], so that |
| 68 | * default == -1; this makes it so the rest match up with d->cache_mode, |
| 69 | * and we use d->cache_mode if cgrp->cache_mode < 0 |
| 70 | */ |
| 71 | short cache_mode; |
| 72 | bool verify; |
| 73 | struct cache_stat_collector stats; |
| 74 | }; |
| 75 | |
| 76 | struct bch_cgroup *bch_bio_to_cgroup(struct bio *bio); |
| 77 | |
| 78 | #endif /* _BCACHE_REQUEST_H_ */ |