89 lines
3.1 KiB
Diff
89 lines
3.1 KiB
Diff
From c106801642fe12b22001489702d42643103425ef Mon Sep 17 00:00:00 2001
|
|
From: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Date: Sun, 8 Dec 2024 00:28:16 -0500
|
|
Subject: [PATCH 184/233] bcachefs: bch2_journal_noflush_seq() now takes
|
|
[start, end)
|
|
Content-Type: text/plain; charset="utf-8"
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Harder to screw up if we're explicit about the range, and more correct
|
|
as journal reservations can be outstanding on multiple journal entries
|
|
simultaneously.
|
|
|
|
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
|
|
Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
|
|
---
|
|
fs/bcachefs/alloc_background.c | 4 +++-
|
|
fs/bcachefs/journal.c | 11 ++++++-----
|
|
fs/bcachefs/journal.h | 2 +-
|
|
3 files changed, 10 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
|
|
index 62069231c63b..9ae567402b03 100644
|
|
--- a/fs/bcachefs/alloc_background.c
|
|
+++ b/fs/bcachefs/alloc_background.c
|
|
@@ -953,7 +953,9 @@ int bch2_trigger_alloc(struct btree_trans *trans,
|
|
*/
|
|
if (is_empty_delta > 0) {
|
|
if (new_a->journal_seq == transaction_seq ||
|
|
- bch2_journal_noflush_seq(&c->journal, new_a->journal_seq))
|
|
+ bch2_journal_noflush_seq(&c->journal,
|
|
+ new_a->journal_seq,
|
|
+ transaction_seq))
|
|
new_a->journal_seq = 0;
|
|
else {
|
|
new_a->journal_seq = transaction_seq;
|
|
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
|
|
index 04a9ccf76d75..2cd20114b74b 100644
|
|
--- a/fs/bcachefs/journal.c
|
|
+++ b/fs/bcachefs/journal.c
|
|
@@ -807,10 +807,11 @@ int bch2_journal_flush(struct journal *j)
|
|
}
|
|
|
|
/*
|
|
- * bch2_journal_noflush_seq - tell the journal not to issue any flushes before
|
|
+ * bch2_journal_noflush_seq - ask the journal not to issue any flushes in the
|
|
+ * range [start, end)
|
|
* @seq
|
|
*/
|
|
-bool bch2_journal_noflush_seq(struct journal *j, u64 seq)
|
|
+bool bch2_journal_noflush_seq(struct journal *j, u64 start, u64 end)
|
|
{
|
|
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
|
u64 unwritten_seq;
|
|
@@ -819,15 +820,15 @@ bool bch2_journal_noflush_seq(struct journal *j, u64 seq)
|
|
if (!(c->sb.features & (1ULL << BCH_FEATURE_journal_no_flush)))
|
|
return false;
|
|
|
|
- if (seq <= c->journal.flushed_seq_ondisk)
|
|
+ if (c->journal.flushed_seq_ondisk >= start)
|
|
return false;
|
|
|
|
spin_lock(&j->lock);
|
|
- if (seq <= c->journal.flushed_seq_ondisk)
|
|
+ if (c->journal.flushed_seq_ondisk >= start)
|
|
goto out;
|
|
|
|
for (unwritten_seq = journal_last_unwritten_seq(j);
|
|
- unwritten_seq < seq;
|
|
+ unwritten_seq < end;
|
|
unwritten_seq++) {
|
|
struct journal_buf *buf = journal_seq_to_buf(j, unwritten_seq);
|
|
|
|
diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h
|
|
index a6a2e888c59b..cb0df0663946 100644
|
|
--- a/fs/bcachefs/journal.h
|
|
+++ b/fs/bcachefs/journal.h
|
|
@@ -404,7 +404,7 @@ void bch2_journal_flush_async(struct journal *, struct closure *);
|
|
|
|
int bch2_journal_flush_seq(struct journal *, u64, unsigned);
|
|
int bch2_journal_flush(struct journal *);
|
|
-bool bch2_journal_noflush_seq(struct journal *, u64);
|
|
+bool bch2_journal_noflush_seq(struct journal *, u64, u64);
|
|
int bch2_journal_meta(struct journal *);
|
|
|
|
void bch2_journal_halt(struct journal *);
|
|
--
|
|
2.45.2
|
|
|