Commit c18dade6 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Issue discards when needed to allocate journal write

Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 163e885a
......@@ -1042,9 +1042,16 @@ void bch2_journal_write(struct closure *cl)
bytes = vstruct_bytes(jset);
memset((void *) jset + bytes, 0, (sectors << 9) - bytes);
retry_alloc:
spin_lock(&j->lock);
ret = journal_write_alloc(j, w, sectors);
if (ret && j->can_discard) {
spin_unlock(&j->lock);
bch2_journal_do_discards(j);
goto retry_alloc;
}
/*
* write is allocated, no longer need to account for it in
* bch2_journal_space_available():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment