1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _BCACHEFS_JOURNAL_IO_H
3 #define _BCACHEFS_JOURNAL_IO_H
6 * Only used for holding the journal entries we read in btree_journal_read()
7 * during cache_registration
9 struct journal_replay {
16 } ptrs[BCH_REPLICAS_MAX];
25 static inline struct jset_entry *__jset_entry_type_next(struct jset *jset,
26 struct jset_entry *entry, unsigned type)
28 while (entry < vstruct_last(jset)) {
29 if (entry->type == type)
32 entry = vstruct_next(entry);
38 #define for_each_jset_entry_type(entry, jset, type) \
39 for (entry = (jset)->start; \
40 (entry = __jset_entry_type_next(jset, entry, type)); \
41 entry = vstruct_next(entry))
43 #define jset_entry_for_each_key(_e, _k) \
44 for (_k = (_e)->start; \
45 _k < vstruct_last(_e); \
48 #define for_each_jset_key(k, entry, jset) \
49 for_each_jset_entry_type(entry, jset, BCH_JSET_ENTRY_btree_keys)\
50 jset_entry_for_each_key(entry, k)
52 int bch2_journal_entry_validate(struct bch_fs *, struct jset *,
53 struct jset_entry *, unsigned, int,
54 enum bkey_invalid_flags);
55 void bch2_journal_entry_to_text(struct printbuf *, struct bch_fs *,
58 void bch2_journal_ptrs_to_text(struct printbuf *, struct bch_fs *,
59 struct journal_replay *);
61 int bch2_journal_read(struct bch_fs *, u64 *, u64 *, u64 *);
63 void bch2_journal_write(struct closure *);
65 #endif /* _BCACHEFS_JOURNAL_IO_H */