summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2016-12-10 11:41:33 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-18 21:41:24 -0900
commitdbf53223522123af70591f57e602cbb337c165b9 (patch)
treee41066a084e4677527ce5edd0d02445945114788
parent7e0728ade61f03a36708c3631c6042a4df3d5efb (diff)
bcache: stash journal entry sequence number in struct journal_res
-rw-r--r--drivers/md/bcache/btree_update.c4
-rw-r--r--drivers/md/bcache/journal.c10
-rw-r--r--drivers/md/bcache/journal.h15
-rw-r--r--drivers/md/bcache/journal_types.h1
4 files changed, 9 insertions, 21 deletions
diff --git a/drivers/md/bcache/btree_update.c b/drivers/md/bcache/btree_update.c
index 54b34fe9e19a..4feaf02d8409 100644
--- a/drivers/md/bcache/btree_update.c
+++ b/drivers/md/bcache/btree_update.c
@@ -802,7 +802,7 @@ void bch_btree_journal_key(struct btree_insert *trans,
: btree_node_flush1);
if (trans->journal_res.ref) {
- u64 seq = bch_journal_res_seq(j, &trans->journal_res);
+ u64 seq = trans->journal_res.seq;
bool needs_whiteout = insert->k.needs_whiteout;
/* ick */
@@ -1999,7 +1999,7 @@ retry:
}
unlock:
multi_unlock_write(trans);
- bch_journal_res_put(&c->journal, &trans->journal_res, NULL);
+ bch_journal_res_put(&c->journal, &trans->journal_res);
if (split)
goto split;
diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c
index 55850be5c13c..0d8bf7ca7e4a 100644
--- a/drivers/md/bcache/journal.c
+++ b/drivers/md/bcache/journal.c
@@ -2175,14 +2175,13 @@ void bch_journal_meta_async(struct journal *j, struct closure *parent)
{
struct journal_res res;
unsigned u64s = jset_u64s(0);
- u64 seq;
memset(&res, 0, sizeof(res));
bch_journal_res_get(j, &res, u64s, u64s);
- bch_journal_res_put(j, &res, &seq);
+ bch_journal_res_put(j, &res);
- bch_journal_flush_seq_async(j, seq, parent);
+ bch_journal_flush_seq_async(j, res.seq, parent);
}
int bch_journal_meta(struct journal *j)
@@ -2190,7 +2189,6 @@ int bch_journal_meta(struct journal *j)
struct journal_res res;
unsigned u64s = jset_u64s(0);
int ret;
- u64 seq;
memset(&res, 0, sizeof(res));
@@ -2198,9 +2196,9 @@ int bch_journal_meta(struct journal *j)
if (ret)
return ret;
- bch_journal_res_put(j, &res, &seq);
+ bch_journal_res_put(j, &res);
- return bch_journal_flush_seq(j, seq);
+ return bch_journal_flush_seq(j, res.seq);
}
void bch_journal_flush_async(struct journal *j, struct closure *parent)
diff --git a/drivers/md/bcache/journal.h b/drivers/md/bcache/journal.h
index 43aa2b68e7bf..b0f1ce7b9589 100644
--- a/drivers/md/bcache/journal.h
+++ b/drivers/md/bcache/journal.h
@@ -161,14 +161,6 @@ static inline void journal_state_inc(union journal_res_state *s)
s->buf1_count += s->idx == 1;
}
-static inline u64 bch_journal_res_seq(struct journal *j,
- struct journal_res *res)
-{
- struct journal_buf *buf = &j->buf[res->idx];
-
- return le64_to_cpu(buf->data->seq);
-}
-
static inline void bch_journal_set_has_inode(struct journal_buf *buf, u64 inum)
{
set_bit(hash_64(inum, ilog2(sizeof(buf->has_inode) * 8)), buf->has_inode);
@@ -247,8 +239,7 @@ static inline void bch_journal_buf_put(struct journal *j, unsigned idx,
* then proceed to add their keys as well.
*/
static inline void bch_journal_res_put(struct journal *j,
- struct journal_res *res,
- u64 *journal_seq)
+ struct journal_res *res)
{
if (!res->ref)
return;
@@ -263,9 +254,6 @@ static inline void bch_journal_res_put(struct journal *j,
res->u64s -= jset_u64s(0);
}
- if (journal_seq)
- *journal_seq = bch_journal_res_seq(j, res);
-
bch_journal_buf_put(j, res->idx, false);
memset(res, 0, sizeof(*res));
@@ -303,6 +291,7 @@ static inline int journal_res_get_fast(struct journal *j,
res->ref = true;
res->idx = new.idx;
+ res->seq = le64_to_cpu(j->buf[res->idx].data->seq);
return 1;
}
diff --git a/drivers/md/bcache/journal_types.h b/drivers/md/bcache/journal_types.h
index 78c304d51d3a..3200ba7462d2 100644
--- a/drivers/md/bcache/journal_types.h
+++ b/drivers/md/bcache/journal_types.h
@@ -72,6 +72,7 @@ struct journal_res {
u8 idx;
u16 offset;
u16 u64s;
+ u64 seq;
};
union journal_res_state {