diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-01-27 10:16:15 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-03-10 15:34:08 -0400 |
commit | 52f7d75e7d36ae4258c4ceef4cb86dc2950e7906 (patch) | |
tree | 31f8e1de600b6e52819af664fe3f47a800e9a6d5 /fs/bcachefs/journal_io.h | |
parent | 3d3d23b341109fe349b1f448c2d89d2ee4429415 (diff) |
bcachefs: jset_entry_datetime
This gives us a way to record the date and time every journal entry was
written - useful for debugging.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_io.h')
-rw-r--r-- | fs/bcachefs/journal_io.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_io.h b/fs/bcachefs/journal_io.h index 1e0b9a571648..1f395f43cf76 100644 --- a/fs/bcachefs/journal_io.h +++ b/fs/bcachefs/journal_io.h @@ -65,4 +65,20 @@ int bch2_journal_read(struct bch_fs *, u64 *, u64 *, u64 *); CLOSURE_CALLBACK(bch2_journal_write); +static inline struct jset_entry *jset_entry_init(struct jset_entry **end, size_t size) +{ + struct jset_entry *entry = *end; + unsigned u64s = DIV_ROUND_UP(size, sizeof(u64)); + + memset(entry, 0, u64s * sizeof(u64)); + /* + * The u64s field counts from the start of data, ignoring the shared + * fields. + */ + entry->u64s = cpu_to_le16(u64s - 1); + + *end = vstruct_next(*end); + return entry; +} + #endif /* _BCACHEFS_JOURNAL_IO_H */ |