summaryrefslogtreecommitdiff
path: root/fs/bcachefs/alloc_foreground.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2025-02-07 09:16:07 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2025-02-07 09:16:07 -0800
commit94b481f7671f412b571e4ee5e3b24f33a889812d (patch)
treeae93d3ecc716a9beee35fabd4cfa95f37a4192ee /fs/bcachefs/alloc_foreground.c
parent1b3291f00013c86a9bb349d6158a9a7a4f0334fe (diff)
parent4be214c26936813b636eed2fac906f585ddbf0f9 (diff)
Merge tag 'bcachefs-2025-02-06.2' of git://evilpiepirate.org/bcachefs
Pull bcachefs fixes from Kent Overstreet: "Nothing major, things continue to be fairly quiet over here. - add a SubmittingPatches to clarify that patches submitted for bcachefs do, in fact, need to be tested - discard path now correctly issues journal flushes when needed, this fixes performance issues when the filesystem is nearly full and we're bottlenecked on copygc - fix a bug that could cause the pending rebalance work accounting to be off when devices are being onlined/offlined; users should report if they are still seeing this - and a few more trivial ones" * tag 'bcachefs-2025-02-06.2' of git://evilpiepirate.org/bcachefs: bcachefs: bch2_bkey_sectors_need_rebalance() now only depends on bch_extent_rebalance bcachefs: Fix rcu imbalance in bch2_fs_btree_key_cache_exit() bcachefs: Fix discard path journal flushing bcachefs: fix deadlock in journal_entry_open() bcachefs: fix incorrect pointer check in __bch2_subvolume_delete() bcachefs docs: SubmittingPatches.rst
Diffstat (limited to 'fs/bcachefs/alloc_foreground.c')
-rw-r--r--fs/bcachefs/alloc_foreground.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fs/bcachefs/alloc_foreground.c b/fs/bcachefs/alloc_foreground.c
index 6df41c331a52..5a781fb4c794 100644
--- a/fs/bcachefs/alloc_foreground.c
+++ b/fs/bcachefs/alloc_foreground.c
@@ -205,8 +205,12 @@ static inline bool may_alloc_bucket(struct bch_fs *c,
return false;
}
- if (bch2_bucket_needs_journal_commit(&c->buckets_waiting_for_journal,
- c->journal.flushed_seq_ondisk, bucket.inode, bucket.offset)) {
+ u64 journal_seq_ready =
+ bch2_bucket_journal_seq_ready(&c->buckets_waiting_for_journal,
+ bucket.inode, bucket.offset);
+ if (journal_seq_ready > c->journal.flushed_seq_ondisk) {
+ if (journal_seq_ready > c->journal.flushing_seq)
+ s->need_journal_commit++;
s->skipped_need_journal_commit++;
return false;
}
@@ -570,7 +574,7 @@ alloc:
? bch2_bucket_alloc_freelist(trans, ca, watermark, &s, cl)
: bch2_bucket_alloc_early(trans, ca, watermark, &s, cl);
- if (s.skipped_need_journal_commit * 2 > avail)
+ if (s.need_journal_commit * 2 > avail)
bch2_journal_flush_async(&c->journal, NULL);
if (!ob && s.btree_bitmap != BTREE_BITMAP_ANY) {