1 /* SPDX-License-Identifier: GPL-2.0 */ 2 #ifndef _BCACHEFS_BTREE_JOURNAL_ITER_TYPES_H 3 #define _BCACHEFS_BTREE_JOURNAL_ITER_TYPES_H 4 5 struct journal_key_range_overwritten { 6 size_t start, end; 7 }; 8 9 struct journal_key { 10 u64 journal_seq; 11 u32 journal_offset; 12 enum btree_id btree_id:8; 13 unsigned level:8; 14 bool allocated; 15 bool overwritten; 16 struct journal_key_range_overwritten __rcu * 17 overwritten_range; 18 struct bkey_i *k; 19 }; 20 21 struct journal_keys { 22 /* must match layout in darray_types.h */ 23 size_t nr, size; 24 struct journal_key *data; 25 /* 26 * Gap buffer: instead of all the empty space in the array being at the 27 * end of the buffer - from @nr to @size - the empty space is at @gap. 28 * This means that sequential insertions are O(n) instead of O(n^2). 29 */ 30 size_t gap; 31 atomic_t ref; 32 bool initial_ref_held; 33 struct mutex overwrite_lock; 34 }; 35 36 #endif /* _BCACHEFS_BTREE_JOURNAL_ITER_TYPES_H */ 37