]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
bcachefs: Fix allocator + journal interaction
authorKent Overstreet <kent.overstreet@gmail.com>
Mon, 27 Dec 2021 02:41:09 +0000 (21:41 -0500)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:20 +0000 (17:09 -0400)
The allocator needs to wait until the last update touching a bucket has
been commited before writing to it again. However, the code was checking
against the last dirty journal sequence number, not the last flushed
journal sequence number.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/alloc_background.c
fs/bcachefs/buckets.c

index 45becfb1ffe9050e6b67456171d9e290d9f4b8e5..30bf363d2ff3757fc743488880551a5427c269ca 100644 (file)
@@ -594,7 +594,7 @@ static void find_reclaimable_buckets_lru(struct bch_fs *c, struct bch_dev *ca)
        buckets = bucket_array(ca);
        ca->alloc_heap.used = 0;
        now = atomic64_read(&c->io_clock[READ].now);
-       last_seq_ondisk = c->journal.last_seq_ondisk;
+       last_seq_ondisk = c->journal.flushed_seq_ondisk;
 
        /*
         * Find buckets with lowest read priority, by building a maxheap sorted
index 4b7fe4a5def93793fa88f5ea01f94fb7a07a478b..917575597ce5c1a6f828f1add01dcffcd64ef10b 100644 (file)
@@ -50,7 +50,7 @@ static inline void fs_usage_data_type_to_base(struct bch_fs_usage *fs_usage,
 void bch2_bucket_seq_cleanup(struct bch_fs *c)
 {
        u64 journal_seq = atomic64_read(&c->journal.seq);
-       u16 last_seq_ondisk = c->journal.last_seq_ondisk;
+       u16 last_seq_ondisk = c->journal.flushed_seq_ondisk;
        struct bch_dev *ca;
        struct bucket_array *buckets;
        struct bucket *g;