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