]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/journal_reclaim.h
Update bcachefs sources to 75e8a078b8 bcachefs: improved flush_held_btree_writes()
[bcachefs-tools-debian] / libbcachefs / journal_reclaim.h
1 #ifndef _BCACHEFS_JOURNAL_RECLAIM_H
2 #define _BCACHEFS_JOURNAL_RECLAIM_H
3
4 #define JOURNAL_PIN     (32 * 1024)
5
6 unsigned bch2_journal_dev_buckets_available(struct journal *,
7                                             struct journal_device *);
8 void bch2_journal_space_available(struct journal *);
9
10 static inline bool journal_pin_active(struct journal_entry_pin *pin)
11 {
12         return pin->seq != 0;
13 }
14
15 static inline struct journal_entry_pin_list *
16 journal_seq_pin(struct journal *j, u64 seq)
17 {
18         EBUG_ON(seq < j->pin.front || seq >= j->pin.back);
19
20         return &j->pin.data[seq & j->pin.mask];
21 }
22
23 void bch2_journal_pin_put(struct journal *, u64);
24
25 void bch2_journal_pin_add(struct journal *, u64, struct journal_entry_pin *,
26                           journal_pin_flush_fn);
27 void bch2_journal_pin_update(struct journal *, u64, struct journal_entry_pin *,
28                              journal_pin_flush_fn);
29 void bch2_journal_pin_drop(struct journal *, struct journal_entry_pin *);
30 void bch2_journal_pin_add_if_older(struct journal *,
31                                   struct journal_entry_pin *,
32                                   struct journal_entry_pin *,
33                                   journal_pin_flush_fn);
34 void bch2_journal_pin_flush(struct journal *, struct journal_entry_pin *);
35
36 void bch2_journal_reclaim_work(struct work_struct *);
37
38 void bch2_journal_flush_pins(struct journal *, u64);
39
40 static inline void bch2_journal_flush_all_pins(struct journal *j)
41 {
42         bch2_journal_flush_pins(j, U64_MAX);
43 }
44
45 int bch2_journal_flush_device_pins(struct journal *, int);
46
47 #endif /* _BCACHEFS_JOURNAL_RECLAIM_H */