]> git.sesse.net Git - bcachefs-tools-debian/blob - libbcachefs/journal_reclaim.h
Update bcachefs sources to 7227ff07f14b Merge pull request #10 from modelrockettier...
[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 static inline bool journal_pin_active(struct journal_entry_pin *pin)
7 {
8         return pin->seq != 0;
9 }
10
11 static inline struct journal_entry_pin_list *
12 journal_seq_pin(struct journal *j, u64 seq)
13 {
14         EBUG_ON(seq < j->pin.front || seq >= j->pin.back);
15
16         return &j->pin.data[seq & j->pin.mask];
17 }
18
19 void bch2_journal_pin_add(struct journal *, u64, struct journal_entry_pin *,
20                           journal_pin_flush_fn);
21 void bch2_journal_pin_drop(struct journal *, struct journal_entry_pin *);
22 void bch2_journal_pin_add_if_older(struct journal *,
23                                   struct journal_entry_pin *,
24                                   struct journal_entry_pin *,
25                                   journal_pin_flush_fn);
26 void bch2_journal_pin_flush(struct journal *, struct journal_entry_pin *);
27
28 void bch2_journal_reclaim_fast(struct journal *);
29 void bch2_journal_reclaim_work(struct work_struct *);
30
31 void bch2_journal_flush_pins(struct journal *, u64);
32
33 static inline void bch2_journal_flush_all_pins(struct journal *j)
34 {
35         bch2_journal_flush_pins(j, U64_MAX);
36 }
37
38 int bch2_journal_flush_device_pins(struct journal *, int);
39
40 #endif /* _BCACHEFS_JOURNAL_RECLAIM_H */