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