mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 09:12:07 +00:00
bcachefs: bch2_journal_noflush_seq() now takes [start, end)
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>
This commit is contained in:
parent
f3b4692b79
commit
c106801642
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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 *);
|
||||
|
Loading…
Reference in New Issue
Block a user