blob: 721bf336ed1aa2cfe531a25faaef2f5c989273c8 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Kent Overstreetcafe5632013-03-23 16:11:31 -07002#ifndef _BCACHE_REQUEST_H_
3#define _BCACHE_REQUEST_H_
4
Kent Overstreet220bb382013-09-10 19:02:45 -07005struct data_insert_op {
Kent Overstreetcafe5632013-03-23 16:11:31 -07006 struct closure cl;
Kent Overstreetc18536a2013-07-24 17:44:17 -07007 struct cache_set *c;
Kent Overstreet220bb382013-09-10 19:02:45 -07008 struct bio *bio;
Nicholas Swensonda415a02014-01-09 16:03:04 -08009 struct workqueue_struct *wq;
Kent Overstreetcafe5632013-03-23 16:11:31 -070010
Coly Li6f10f7d2018-08-11 13:19:44 +080011 unsigned int inode;
Kent Overstreet2599b532013-07-24 18:11:11 -070012 uint16_t write_point;
Kent Overstreet220bb382013-09-10 19:02:45 -070013 uint16_t write_prio;
Christoph Hellwig4e4cbee2017-06-03 09:38:06 +020014 blk_status_t status;
Kent Overstreetc18536a2013-07-24 17:44:17 -070015
Kent Overstreeta5ae4302013-09-10 19:16:31 -070016 union {
17 uint16_t flags;
Kent Overstreet220bb382013-09-10 19:02:45 -070018
Kent Overstreeta5ae4302013-09-10 19:16:31 -070019 struct {
Coly Li6f10f7d2018-08-11 13:19:44 +080020 unsigned int bypass:1;
21 unsigned int writeback:1;
22 unsigned int flush_journal:1;
23 unsigned int csum:1;
Kent Overstreetc18536a2013-07-24 17:44:17 -070024
Coly Li6f10f7d2018-08-11 13:19:44 +080025 unsigned int replace:1;
26 unsigned int replace_collision:1;
Kent Overstreet0b932072013-07-24 17:26:51 -070027
Coly Li6f10f7d2018-08-11 13:19:44 +080028 unsigned int insert_data_done:1;
Kent Overstreeta5ae4302013-09-10 19:16:31 -070029 };
30 };
31
Kent Overstreet0b932072013-07-24 17:26:51 -070032 struct keylist insert_keys;
Kent Overstreet1b207d82013-09-10 18:52:54 -070033 BKEY_PADDED(replace_key);
Kent Overstreetcafe5632013-03-23 16:11:31 -070034};
35
Coly Lifc2d5982018-08-11 13:19:46 +080036unsigned int bch_get_congested(struct cache_set *c);
Kent Overstreeta34a8bf2013-10-24 17:07:04 -070037void bch_data_insert(struct closure *cl);
Kent Overstreetcafe5632013-03-23 16:11:31 -070038
Kent Overstreetcafe5632013-03-23 16:11:31 -070039void bch_cached_dev_request_init(struct cached_dev *dc);
40void bch_flash_dev_request_init(struct bcache_device *d);
41
Shenghui Wang3fd3c5c2018-10-08 20:41:16 +080042extern struct kmem_cache *bch_search_cache;
Kent Overstreetcafe5632013-03-23 16:11:31 -070043
Kent Overstreetcafe5632013-03-23 16:11:31 -070044#endif /* _BCACHE_REQUEST_H_ */