1 #ifndef _BCACHE_IO_TYPES_H
2 #define _BCACHE_IO_TYPES_H
4 #include "btree_types.h"
5 #include "buckets_types.h"
6 #include "keylist_types.h"
8 #include <linux/llist.h>
9 #include <linux/workqueue.h>
13 * Reads will often have to be split, and if the extent being read from
14 * was checksummed or compressed we'll also have to allocate bounce
15 * buffers and copy the data back into the original bio.
17 * If we didn't have to split, we have to save and restore the original
18 * bi_end_io - @split below indicates which:
21 struct bch_read_bio *parent;
22 bio_end_io_t *orig_bi_end_io;
26 * Saved copy of parent->bi_iter, from submission time - allows us to
27 * resubmit on IO error, and also to copy data back to the original bio
28 * when we're bouncing:
30 struct bvec_iter parent_iter;
33 * If we have to retry the read (IO error, checksum failure, read stale
34 * data (raced with allocator), we retry the portion of the parent bio
35 * that failed (i.e. this bio's portion, parent_iter).
37 * But we need to stash the inode somewhere:
41 unsigned submit_time_us;
46 struct bch_extent_crc64 crc;
47 struct bch_extent_ptr ptr;
50 struct cache_promote_op *promote;
52 /* bio_decompress_worker list */
53 struct llist_node list;
58 static inline struct bch_read_bio *
59 bch_rbio_parent(struct bch_read_bio *rbio)
61 return rbio->split ? rbio->parent : rbio;
64 struct bch_write_bio {
72 unsigned submit_time_us;
77 /* Only for btree writes: */
78 unsigned used_mempool:1;
84 struct bch_replace_info {
85 struct extent_insert_hook hook;
86 /* How many insertions succeeded */
88 /* How many insertions failed */
96 struct workqueue_struct *io_wq;
97 struct bch_write_bio *bio;
99 unsigned written; /* sectors */
104 unsigned compression_type:4;
105 unsigned nr_replicas:4;
106 unsigned alloc_reserve:4;
111 /* For BCH_WRITE_DATA_COMPRESSED: */
112 struct bch_extent_crc64 crc;
115 struct disk_reservation res;
117 struct write_point *wp;
122 struct bch_write_op *next;
123 unsigned long expires;
128 * If caller wants to flush but hasn't passed us a journal_seq ptr, we
129 * still need to stash the journal_seq somewhere:
136 int (*index_update_fn)(struct bch_write_op *);
138 struct keylist insert_keys;
139 u64 inline_keys[BKEY_EXTENT_U64s_MAX * 2];
142 struct bio_decompress_worker {
144 struct work_struct work;
145 struct llist_head bio_list;
148 #endif /* _BCACHE_IO_TYPES_H */