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>2016-11-23 14:09:22 -0900
commit38a04e41f316f845df371e5dca4960aa93259171 (patch)
tree8e65d549e9b4f5fe35c388ccd720495073dbcde4
parentb7cbaae722fed825a874d0a903779a4c7bd58ad5 (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