]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/journal_io.h
Update bcachefs sources to d83b992f65 bcachefs: Rewrite journal_seq_blacklist machinery
[bcachefs-tools-debian] / libbcachefs / journal_io.h
1 #ifndef _BCACHEFS_JOURNAL_IO_H
2 #define _BCACHEFS_JOURNAL_IO_H
3
4 /*
5  * Only used for holding the journal entries we read in btree_journal_read()
6  * during cache_registration
7  */
8 struct journal_replay {
9         struct list_head        list;
10         struct bch_devs_list    devs;
11         /* must be last: */
12         struct jset             j;
13 };
14
15 static inline struct jset_entry *__jset_entry_type_next(struct jset *jset,
16                                         struct jset_entry *entry, unsigned type)
17 {
18         while (entry < vstruct_last(jset)) {
19                 if (entry->type == type)
20                         return entry;
21
22                 entry = vstruct_next(entry);
23         }
24
25         return NULL;
26 }
27
28 #define for_each_jset_entry_type(entry, jset, type)                     \
29         for (entry = (jset)->start;                                     \
30              (entry = __jset_entry_type_next(jset, entry, type));       \
31              entry = vstruct_next(entry))
32
33 #define for_each_jset_key(k, _n, entry, jset)                           \
34         for_each_jset_entry_type(entry, jset, BCH_JSET_ENTRY_btree_keys)        \
35                 vstruct_for_each_safe(entry, k, _n)
36
37 int bch2_journal_read(struct bch_fs *, struct list_head *);
38 void bch2_journal_entries_free(struct list_head *);
39 int bch2_journal_replay(struct bch_fs *, struct list_head *);
40
41 void bch2_journal_write(struct closure *);
42
43 #endif /* _BCACHEFS_JOURNAL_IO_H */