mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
bcachefs: Optimize bch2_journal_flush_seq_async()
Avoid taking the journal lock if we don't have to. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
7b48920770
commit
33b3b1dc0f
1 changed files with 9 additions and 1 deletions
|
@ -547,12 +547,20 @@ void bch2_journal_entry_res_resize(struct journal *j,
|
||||||
* necessary
|
* necessary
|
||||||
*/
|
*/
|
||||||
int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
|
int bch2_journal_flush_seq_async(struct journal *j, u64 seq,
|
||||||
struct closure *parent)
|
struct closure *parent)
|
||||||
{
|
{
|
||||||
struct journal_buf *buf;
|
struct journal_buf *buf;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
if (seq <= j->err_seq)
|
||||||
|
return -EIO;
|
||||||
|
|
||||||
|
if (seq <= j->seq_ondisk)
|
||||||
|
return 1;
|
||||||
|
|
||||||
spin_lock(&j->lock);
|
spin_lock(&j->lock);
|
||||||
|
|
||||||
|
/* Recheck under lock: */
|
||||||
if (seq <= j->err_seq) {
|
if (seq <= j->err_seq) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in a new issue