summaryrefslogtreecommitdiff
path: root/fs/bcachefs/journal_types.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2020-11-13 18:36:33 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-10-22 17:08:49 -0400
commitf299d57350b2450c522dc7780400ce811f4847ec (patch)
tree4775bbb7ebd4eff2c44d8144ec85e121bf9e51f0 /fs/bcachefs/journal_types.h
parent7bfbbd88024d70947761e482c856522b43a98d87 (diff)
bcachefs: Refactor filesystem usage accounting
Various filesystem usage counters are kept in percpu counters, with one set per in flight journal buffer. Right now all the code that deals with it assumes that there's only two buffers/sets of counters, but the number of journal bufs is getting increased to 4 in the next patch - so refactor that code to not assume a constant. 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.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/bcachefs/journal_types.h b/fs/bcachefs/journal_types.h
index 6312a7f06d87..7e328ccc0a8f 100644
--- a/fs/bcachefs/journal_types.h
+++ b/fs/bcachefs/journal_types.h
@@ -11,6 +11,10 @@
struct journal_res;
+#define JOURNAL_BUF_BITS 1
+#define JOURNAL_BUF_NR (1U << JOURNAL_BUF_BITS)
+#define JOURNAL_BUF_MASK (JOURNAL_BUF_NR - 1)
+
/*
* We put two of these in struct journal; we used them for writes to the
* journal that are being staged or in flight.