]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/journal_reclaim.h
Update bcachefs sources to 6628827a8707 bcachefs: Skip deleted members in member_to_t...
[bcachefs-tools-debian] / libbcachefs / journal_reclaim.h
index f02caa3d49ea74daf97d1054cc3ddbfba250d254..494d1a6eddb011fd5c0aa0b41676522949b12577 100644 (file)
@@ -8,11 +8,9 @@ static inline void journal_reclaim_kick(struct journal *j)
 {
        struct task_struct *p = READ_ONCE(j->reclaim_thread);
 
-       if (p && !j->reclaim_kicked) {
-               j->reclaim_kicked = true;
-               if (p)
-                       wake_up_process(p);
-       }
+       j->reclaim_kicked = true;
+       if (p)
+               wake_up_process(p);
 }
 
 unsigned bch2_journal_dev_buckets_available(struct journal *,
@@ -33,7 +31,8 @@ journal_seq_pin(struct journal *j, u64 seq)
        return &j->pin.data[seq & j->pin.mask];
 }
 
-void __bch2_journal_pin_put(struct journal *, u64);
+void bch2_journal_reclaim_fast(struct journal *);
+bool __bch2_journal_pin_put(struct journal *, u64);
 void bch2_journal_pin_put(struct journal *, u64);
 void bch2_journal_pin_drop(struct journal *, struct journal_entry_pin *);
 
@@ -53,8 +52,11 @@ static inline void bch2_journal_pin_copy(struct journal *j,
                                         struct journal_entry_pin *src,
                                         journal_pin_flush_fn flush_fn)
 {
-       if (journal_pin_active(src))
-               bch2_journal_pin_add(j, src->seq, dst, flush_fn);
+       /* Guard against racing with journal_pin_drop(src): */
+       u64 seq = READ_ONCE(src->seq);
+
+       if (seq)
+               bch2_journal_pin_add(j, seq, dst, flush_fn);
 }
 
 static inline void bch2_journal_pin_update(struct journal *j, u64 seq,