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"
7 #include "super_types.h"
9 #include <linux/llist.h>
10 #include <linux/workqueue.h>
12 struct extent_pick_ptr {
13 struct bch_extent_crc128 crc;
14 struct bch_extent_ptr ptr;
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 submit_time_us;
53 struct extent_pick_ptr pick;
54 struct bversion version;
56 struct promote_op *promote;
59 * If we have to retry the read (IO error, checksum failure, read stale
60 * data (raced with allocator), we retry the portion of the parent bio
61 * that failed (i.e. this bio's portion, bvec_iter).
63 * But we need to stash the inode somewhere:
67 struct work_struct work;
72 struct bch_write_bio {
76 struct bch_write_bio *parent;
90 unsigned submit_time_us;
99 struct workqueue_struct *io_wq;
101 unsigned written; /* sectors */
106 unsigned csum_type:4;
107 unsigned compression_type:4;
108 unsigned nr_replicas:4;
109 unsigned alloc_reserve:4;
113 struct bversion version;
115 /* For BCH_WRITE_DATA_COMPRESSED: */
116 struct bch_extent_crc128 crc;
119 struct disk_reservation res;
121 struct write_point *wp;
126 struct bch_write_op *next;
127 unsigned long expires;
132 * If caller wants to flush but hasn't passed us a journal_seq ptr, we
133 * still need to stash the journal_seq somewhere:
140 int (*index_update_fn)(struct bch_write_op *);
142 struct bch_devs_mask failed;
144 struct keylist insert_keys;
145 u64 inline_keys[BKEY_EXTENT_U64s_MAX * 2];
148 struct bch_write_bio wbio;
151 #endif /* _BCACHE_IO_TYPES_H */