bcachefs: Skip periodic wakeup of journal reclaim when journal empty
Less system noise. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
parent
f0cc5d2931
commit
718ce1eb8a
@ -240,6 +240,9 @@ static int journal_entry_open(struct journal *j)
|
|||||||
if (u64s <= 0)
|
if (u64s <= 0)
|
||||||
return cur_entry_journal_full;
|
return cur_entry_journal_full;
|
||||||
|
|
||||||
|
if (fifo_empty(&j->pin) && j->reclaim_thread)
|
||||||
|
wake_up_process(j->reclaim_thread);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The fifo_push() needs to happen at the same time as j->seq is
|
* The fifo_push() needs to happen at the same time as j->seq is
|
||||||
* incremented for journal_last_seq() to be calculated correctly
|
* incremented for journal_last_seq() to be calculated correctly
|
||||||
|
@ -667,6 +667,7 @@ static int bch2_journal_reclaim_thread(void *arg)
|
|||||||
struct journal *j = arg;
|
struct journal *j = arg;
|
||||||
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
struct bch_fs *c = container_of(j, struct bch_fs, journal);
|
||||||
unsigned long delay, now;
|
unsigned long delay, now;
|
||||||
|
bool journal_empty;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
set_freezable();
|
set_freezable();
|
||||||
@ -693,10 +694,17 @@ static int bch2_journal_reclaim_thread(void *arg)
|
|||||||
break;
|
break;
|
||||||
if (j->reclaim_kicked)
|
if (j->reclaim_kicked)
|
||||||
break;
|
break;
|
||||||
if (time_after_eq(jiffies, j->next_reclaim))
|
|
||||||
break;
|
|
||||||
schedule_timeout(j->next_reclaim - jiffies);
|
|
||||||
|
|
||||||
|
spin_lock(&j->lock);
|
||||||
|
journal_empty = fifo_empty(&j->pin);
|
||||||
|
spin_unlock(&j->lock);
|
||||||
|
|
||||||
|
if (journal_empty)
|
||||||
|
schedule();
|
||||||
|
else if (time_after(j->next_reclaim, jiffies))
|
||||||
|
schedule_timeout(j->next_reclaim - jiffies);
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
__set_current_state(TASK_RUNNING);
|
__set_current_state(TASK_RUNNING);
|
||||||
}
|
}
|
||||||
|
@ -243,6 +243,10 @@ struct journal {
|
|||||||
spinlock_t err_lock;
|
spinlock_t err_lock;
|
||||||
|
|
||||||
struct mutex reclaim_lock;
|
struct mutex reclaim_lock;
|
||||||
|
/*
|
||||||
|
* Used for waiting until journal reclaim has freed up space in the
|
||||||
|
* journal:
|
||||||
|
*/
|
||||||
wait_queue_head_t reclaim_wait;
|
wait_queue_head_t reclaim_wait;
|
||||||
struct task_struct *reclaim_thread;
|
struct task_struct *reclaim_thread;
|
||||||
bool reclaim_kicked;
|
bool reclaim_kicked;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user