1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_IO_TYPES_H
3 #define _BCACHEFS_IO_TYPES_H
5 #include "alloc_types.h"
6 #include "btree_types.h"
7 #include "buckets_types.h"
8 #include "extents_types.h"
9 #include "keylist_types.h"
11 #include "super_types.h"
13 #include <linux/llist.h>
14 #include <linux/workqueue.h>
22 * Reads will often have to be split, and if the extent being read from
23 * was checksummed or compressed we'll also have to allocate bounce
24 * buffers and copy the data back into the original bio.
26 * If we didn't have to split, we have to save and restore the original
27 * bi_end_io - @split below indicates which:
30 struct bch_read_bio *parent;
35 * Saved copy of bio->bi_iter, from submission time - allows us to
36 * resubmit on IO error, and also to copy data back to the original bio
37 * when we're bouncing:
39 struct bvec_iter bvec_iter;
41 unsigned offset_into_extent;
58 struct bch_devs_list devs_have;
60 struct extent_ptr_decoded pick;
63 * pos we read from - different from data_pos for indirect extents:
69 * start pos of data we read (may not be pos of data we want) - for
70 * promote, narrow extents paths:
72 enum btree_id data_btree;
74 struct bversion version;
76 struct promote_op *promote;
78 struct bch_io_opts opts;
80 struct work_struct work;
85 struct bch_write_bio {
88 struct bch_write_bio *parent;
93 struct bch_devs_list failed;
108 struct bch_write_op {
111 void (*end_io)(struct bch_write_op *);
114 unsigned written; /* sectors */
116 s16 error; /* dio write path expects it to hold -ERESTARTSYS... */
118 unsigned csum_type:4;
119 unsigned compression_type:4;
120 unsigned nr_replicas:4;
121 unsigned nr_replicas_required:4;
122 unsigned watermark:3;
123 unsigned incompressible:1;
124 unsigned stripe_waited:1;
126 struct bch_devs_list devs_have;
129 struct bch_io_opts opts;
133 struct bversion version;
135 /* For BCH_WRITE_DATA_ENCODED: */
136 struct bch_extent_crc_unpacked crc;
138 struct write_point_specifier write_point;
140 struct write_point *wp;
141 struct list_head wp_list;
143 struct disk_reservation res;
145 struct open_buckets open_buckets;
150 struct bch_devs_mask failed;
152 struct keylist insert_keys;
153 u64 inline_keys[BKEY_EXTENT_U64s_MAX * 2];
156 * Bitmask of devices that have had nocow writes issued to them since
159 struct bch_devs_mask *devs_need_flush;
162 struct bch_write_bio wbio;
165 #endif /* _BCACHEFS_IO_TYPES_H */