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

bcachefs: Journal refactoring

Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent f1a79365
...@@ -134,6 +134,8 @@ static enum { ...@@ -134,6 +134,8 @@ static enum {
c->opts.block_size; c->opts.block_size;
BUG_ON(j->prev_buf_sectors > j->cur_buf_sectors); BUG_ON(j->prev_buf_sectors > j->cur_buf_sectors);
bkey_extent_init(&buf->key);
/* /*
* We have to set last_seq here, _before_ opening a new journal entry: * We have to set last_seq here, _before_ opening a new journal entry:
* *
...@@ -890,10 +892,6 @@ static bool bch2_journal_writing_to_device(struct journal *j, unsigned dev_idx) ...@@ -890,10 +892,6 @@ static bool bch2_journal_writing_to_device(struct journal *j, unsigned dev_idx)
void bch2_dev_journal_stop(struct journal *j, struct bch_dev *ca) void bch2_dev_journal_stop(struct journal *j, struct bch_dev *ca)
{ {
spin_lock(&j->lock);
bch2_extent_drop_device(bkey_i_to_s_extent(&j->key), ca->dev_idx);
spin_unlock(&j->lock);
wait_event(j->wait, !bch2_journal_writing_to_device(j, ca->dev_idx)); wait_event(j->wait, !bch2_journal_writing_to_device(j, ca->dev_idx));
} }
...@@ -1032,8 +1030,6 @@ int bch2_fs_journal_init(struct journal *j) ...@@ -1032,8 +1030,6 @@ int bch2_fs_journal_init(struct journal *j)
j->write_delay_ms = 1000; j->write_delay_ms = 1000;
j->reclaim_delay_ms = 100; j->reclaim_delay_ms = 100;
bkey_extent_init(&j->key);
atomic64_set(&j->reservations.counter, atomic64_set(&j->reservations.counter,
((union journal_res_state) ((union journal_res_state)
{ .cur_entry_offset = JOURNAL_ENTRY_CLOSED_VAL }).v); { .cur_entry_offset = JOURNAL_ENTRY_CLOSED_VAL }).v);
......
This diff is collapsed.
...@@ -126,7 +126,8 @@ void bch2_journal_reclaim_fast(struct journal *j) ...@@ -126,7 +126,8 @@ void bch2_journal_reclaim_fast(struct journal *j)
* Unpin journal entries whose reference counts reached zero, meaning * Unpin journal entries whose reference counts reached zero, meaning
* all btree nodes got written out * all btree nodes got written out
*/ */
while (!atomic_read(&fifo_peek_front(&j->pin).count)) { while (!fifo_empty(&j->pin) &&
!atomic_read(&fifo_peek_front(&j->pin).count)) {
BUG_ON(!list_empty(&fifo_peek_front(&j->pin).list)); BUG_ON(!list_empty(&fifo_peek_front(&j->pin).list));
BUG_ON(!fifo_pop(&j->pin, temp)); BUG_ON(!fifo_pop(&j->pin, temp));
popped = true; popped = true;
......
...@@ -185,7 +185,6 @@ struct journal { ...@@ -185,7 +185,6 @@ struct journal {
struct list_head seq_blacklist; struct list_head seq_blacklist;
struct journal_seq_blacklist *new_blacklist; struct journal_seq_blacklist *new_blacklist;
BKEY_PADDED(key);
struct write_point wp; struct write_point wp;
spinlock_t err_lock; spinlock_t err_lock;
......
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