diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2020-11-14 12:29:21 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:08:49 -0400 |
commit | b6df4325cd914d988e5b96016f64b879058d0bc6 (patch) | |
tree | 1853abf0680825c2cd76b7d12cde294d47f89695 /fs/bcachefs/journal_types.h | |
parent | ebb84d094141eac9ee3e22d95abc9792a1c79eca (diff) | |
download | linux-stable-b6df4325cd914d988e5b96016f64b879058d0bc6.tar.gz linux-stable-b6df4325cd914d988e5b96016f64b879058d0bc6.tar.bz2 linux-stable-b6df4325cd914d988e5b96016f64b879058d0bc6.zip |
bcachefs: Improve journal free space calculations
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/journal_types.h')
-rw-r--r-- | fs/bcachefs/journal_types.h | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/fs/bcachefs/journal_types.h b/fs/bcachefs/journal_types.h index ec19f75f8ede..6b525dc6ab7c 100644 --- a/fs/bcachefs/journal_types.h +++ b/fs/bcachefs/journal_types.h @@ -9,8 +9,6 @@ #include "super_types.h" #include "fifo.h" -struct journal_res; - #define JOURNAL_BUF_BITS 2 #define JOURNAL_BUF_NR (1U << JOURNAL_BUF_BITS) #define JOURNAL_BUF_MASK (JOURNAL_BUF_NR - 1) @@ -122,6 +120,20 @@ union journal_preres_state { #define JOURNAL_ENTRY_CLOSED_VAL (JOURNAL_ENTRY_OFFSET_MAX - 1) #define JOURNAL_ENTRY_ERROR_VAL (JOURNAL_ENTRY_OFFSET_MAX) +struct journal_space { + /* Units of 512 bytes sectors: */ + unsigned next_entry; /* How big the next journal entry can be */ + unsigned total; +}; + +enum journal_space_from { + journal_space_discarded, + journal_space_clean_ondisk, + journal_space_clean, + journal_space_total, + journal_space_nr, +}; + /* * JOURNAL_NEED_WRITE - current (pending) journal entry should be written ASAP, * either because something's waiting on the write to complete or because it's @@ -216,6 +228,8 @@ struct journal { struct journal_entry_pin_list *data; } pin; + struct journal_space space[journal_space_nr]; + u64 replay_journal_seq; u64 replay_journal_seq_end; |