summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-05-25 19:29:48 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2020-06-09 21:32:46 -0400
commit9efbfabfe8d244b348c2a19c2564b8fc68cb6937 (patch)
tree44f4335be29df8b3c1a14885365ca2ac4cdcd9a2 /fs/bcachefs/journal.h
parent45effed2a7c2c4a149ff8a921d23eb68e3a81427 (diff)
bcachefs: Add a mechanism for passing extra journal entries to bch2_trans_commit()
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/journal.h')
-rw-r--r--fs/bcachefs/journal.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h
index 78f5fac06bf5..e4b7fe8ffa82 100644
--- a/fs/bcachefs/journal.h
+++ b/fs/bcachefs/journal.h
@@ -199,13 +199,18 @@ bch2_journal_add_entry_noreservation(struct journal_buf *buf, size_t u64s)
return entry;
}
+static inline struct jset_entry *
+bch2_journal_reservation_entry(struct journal *j, struct journal_res *res)
+{
+ return vstruct_idx(j->buf[res->idx].data, res->offset);
+}
+
static inline void bch2_journal_add_entry(struct journal *j, struct journal_res *res,
unsigned type, enum btree_id id,
unsigned level,
const void *data, unsigned u64s)
{
- struct journal_buf *buf = &j->buf[res->idx];
- struct jset_entry *entry = vstruct_idx(buf->data, res->offset);
+ struct jset_entry *entry = bch2_journal_reservation_entry(j, res);
unsigned actual = jset_u64s(u64s);
EBUG_ON(!res->ref);
@@ -219,7 +224,7 @@ static inline void bch2_journal_add_entry(struct journal *j, struct journal_res
entry->type = type;
entry->btree_id = id;
entry->level = level;
- memcpy_u64s(entry->_data, data, u64s);
+ memcpy_u64s_small(entry->_data, data, u64s);
}
static inline void bch2_journal_add_keys(struct journal *j, struct journal_res *res,