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