18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _BCACHE_REQUEST_H_
38c2ecf20Sopenharmony_ci#define _BCACHE_REQUEST_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_cistruct data_insert_op {
68c2ecf20Sopenharmony_ci	struct closure		cl;
78c2ecf20Sopenharmony_ci	struct cache_set	*c;
88c2ecf20Sopenharmony_ci	struct bio		*bio;
98c2ecf20Sopenharmony_ci	struct workqueue_struct *wq;
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci	unsigned int		inode;
128c2ecf20Sopenharmony_ci	uint16_t		write_point;
138c2ecf20Sopenharmony_ci	uint16_t		write_prio;
148c2ecf20Sopenharmony_ci	blk_status_t		status;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci	union {
178c2ecf20Sopenharmony_ci		uint16_t	flags;
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci	struct {
208c2ecf20Sopenharmony_ci		unsigned int	bypass:1;
218c2ecf20Sopenharmony_ci		unsigned int	writeback:1;
228c2ecf20Sopenharmony_ci		unsigned int	flush_journal:1;
238c2ecf20Sopenharmony_ci		unsigned int	csum:1;
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci		unsigned int	replace:1;
268c2ecf20Sopenharmony_ci		unsigned int	replace_collision:1;
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci		unsigned int	insert_data_done:1;
298c2ecf20Sopenharmony_ci	};
308c2ecf20Sopenharmony_ci	};
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci	struct keylist		insert_keys;
338c2ecf20Sopenharmony_ci	BKEY_PADDED(replace_key);
348c2ecf20Sopenharmony_ci};
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciunsigned int bch_get_congested(const struct cache_set *c);
378c2ecf20Sopenharmony_civoid bch_data_insert(struct closure *cl);
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_civoid bch_cached_dev_request_init(struct cached_dev *dc);
408c2ecf20Sopenharmony_ciblk_qc_t cached_dev_submit_bio(struct bio *bio);
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_civoid bch_flash_dev_request_init(struct bcache_device *d);
438c2ecf20Sopenharmony_ciblk_qc_t flash_dev_submit_bio(struct bio *bio);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciextern struct kmem_cache *bch_search_cache;
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#endif /* _BCACHE_REQUEST_H_ */
48