Commit 33b3b1dc authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Optimize bch2_journal_flush_seq_async()

Avoid taking the journal lock if we don't have to.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 7b489207
......@@ -547,12 +547,20 @@ void bch2_journal_entry_res_resize(struct journal *j,
* necessary
*/
int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
struct closure *parent)
struct closure *parent)
{
struct journal_buf *buf;
int ret = 0;
if (seq <= j->err_seq)
return -EIO;
if (seq <= j->seq_ondisk)
return 1;
spin_lock(&j->lock);
/* Recheck under lock: */
if (seq <= j->err_seq) {
ret = -EIO;
goto out;
......
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