summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-11-15 10:29:03 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:41:00 -0900
commitd9815a6c202edb8ed4e99d5a8a554d18adf51aba (patch)
tree474355fe78a88778bb8f7d272ac2b8507fe4077a
parentd7ccebf4d7bc965b551ce76bc0f8bf89d762220c (diff)
bcache: Another journal assertion
-rw-r--r--drivers/md/bcache/journal.c4
-rw-r--r--drivers/md/bcache/journal_types.h1
2 files changed, 5 insertions, 0 deletions
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 150661bed2a1..d37130c70396 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -1032,6 +1032,8 @@ static enum {
journal_entry_u64s_reserve(j),
block_bytes(c)) * c->sb.block_size;
+ BUG_ON(j->prev_buf_sectors > j->cur_buf_sectors);
+
atomic_dec_bug(&fifo_peek_back(&j->pin).count);
__bch_journal_next_entry(j);
spin_unlock(&j->lock);
@@ -1168,6 +1170,8 @@ static int journal_entry_open(struct journal *j)
if (sectors <= 0)
return sectors;
+ j->cur_buf_sectors = sectors;
+
u64s = (sectors << 9) / sizeof(u64);
/* Subtract the journal header */
diff --git a/drivers/md/bcache/journal_types.h b/drivers/md/bcache/journal_types.h
index 630518d2e022..b40a2dfae25a 100644
--- a/drivers/md/bcache/journal_types.h
+++ b/drivers/md/bcache/journal_types.h
@@ -112,6 +112,7 @@ struct journal {
union journal_res_state reservations;
unsigned cur_entry_u64s;
unsigned prev_buf_sectors;
+ unsigned cur_buf_sectors;
/*
* Two journal entries -- one is currently open for new entries, the