1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _BCACHEFS_IO_WRITE_TYPES_H
3#define _BCACHEFS_IO_WRITE_TYPES_H
4
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"
10#include "opts.h"
11#include "super_types.h"
12
13#include <linux/llist.h>
14#include <linux/workqueue.h>
15
16struct bch_write_bio {
17 struct_group(wbio,
18 struct bch_fs *c;
19 struct bch_write_bio *parent;
20
21 u64 submit_time;
22 u64 inode_offset;
23
24 struct bch_devs_list failed;
25 u8 dev;
26
27 unsigned split:1,
28 bounce:1,
29 put_bio:1,
30 have_ioref:1,
31 nocow:1,
32 used_mempool:1,
33 first_btree_write:1;
34 );
35
36 struct bio bio;
37};
38
39struct bch_write_op {
40 struct closure cl;
41 struct bch_fs *c;
42 void (*end_io)(struct bch_write_op *);
43 u64 start_time;
44
45 unsigned written; /* sectors */
46 u16 flags;
47 s16 error; /* dio write path expects it to hold -ERESTARTSYS... */
48
49 unsigned compression_opt:8;
50 unsigned csum_type:4;
51 unsigned nr_replicas:4;
52 unsigned nr_replicas_required:4;
53 unsigned watermark:3;
54 unsigned incompressible:1;
55 unsigned stripe_waited:1;
56
57 struct bch_devs_list devs_have;
58 u16 target;
59 u16 nonce;
60 struct bch_io_opts opts;
61
62 u32 subvol;
63 struct bpos pos;
64 struct bversion version;
65
66 /* For BCH_WRITE_DATA_ENCODED: */
67 struct bch_extent_crc_unpacked crc;
68
69 struct write_point_specifier write_point;
70
71 struct write_point *wp;
72 struct list_head wp_list;
73
74 struct disk_reservation res;
75
76 struct open_buckets open_buckets;
77
78 u64 new_i_size;
79 s64 i_sectors_delta;
80
81 struct bch_devs_mask failed;
82
83 struct keylist insert_keys;
84 u64 inline_keys[BKEY_EXTENT_U64s_MAX * 2];
85
86 /*
87 * Bitmask of devices that have had nocow writes issued to them since
88 * last flush:
89 */
90 struct bch_devs_mask *devs_need_flush;
91
92 /* Must be last: */
93 struct bch_write_bio wbio;
94};
95
96#endif /* _BCACHEFS_IO_WRITE_TYPES_H */
97

source code of linux/fs/bcachefs/io_write_types.h