1 #ifndef _BCACHEFS_IO_TYPES_H
2 #define _BCACHEFS_IO_TYPES_H
4 #include "alloc_types.h"
5 #include "btree_types.h"
6 #include "buckets_types.h"
7 #include "extents_types.h"
8 #include "keylist_types.h"
10 #include "super_types.h"
12 #include <linux/llist.h>
13 #include <linux/workqueue.h>
21 * Reads will often have to be split, and if the extent being read from
22 * was checksummed or compressed we'll also have to allocate bounce
23 * buffers and copy the data back into the original bio.
25 * If we didn't have to split, we have to save and restore the original
26 * bi_end_io - @split below indicates which:
29 struct bch_read_bio *parent;
34 * Saved copy of bio->bi_iter, from submission time - allows us to
35 * resubmit on IO error, and also to copy data back to the original bio
36 * when we're bouncing:
38 struct bvec_iter bvec_iter;
55 struct bch_devs_list devs_have;
57 struct extent_ptr_decoded pick;
58 /* start pos of data we read (may not be pos of data we want) */
60 struct bversion version;
62 struct promote_op *promote;
64 struct bch_io_opts opts;
66 struct work_struct work;
71 struct bch_write_bio {
73 struct bch_write_bio *parent;
77 struct bch_devs_list failed;
93 struct workqueue_struct *io_wq;
96 unsigned written; /* sectors */
98 s16 error; /* dio write path expects it to hold -ERESTARTSYS... */
100 unsigned csum_type:4;
101 unsigned compression_type:4;
102 unsigned nr_replicas:4;
103 unsigned nr_replicas_required:4;
104 unsigned alloc_reserve:4;
106 struct bch_devs_list devs_have;
110 struct bch_io_opts opts;
113 struct bversion version;
115 /* For BCH_WRITE_DATA_ENCODED: */
116 struct bch_extent_crc_unpacked crc;
118 struct write_point_specifier write_point;
120 struct disk_reservation res;
122 struct open_buckets open_buckets;
125 * If caller wants to flush but hasn't passed us a journal_seq ptr, we
126 * still need to stash the journal_seq somewhere:
133 int (*index_update_fn)(struct bch_write_op *);
135 struct bch_devs_mask failed;
137 struct keylist insert_keys;
138 u64 inline_keys[BKEY_EXTENT_U64s_MAX * 2];
141 struct bch_write_bio wbio;
144 #endif /* _BCACHEFS_IO_TYPES_H */