]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/journal_types.h
Update bcachefs sources to 24f7e08cd8 bcachefs: shrinker.to_text() methods
[bcachefs-tools-debian] / libbcachefs / journal_types.h
index 071fcb4a842286a35cbac254dc1668ab5ebfeb51..a6cdb885ad41077db05e74a837225a0e2158967b 100644 (file)
@@ -144,10 +144,38 @@ enum journal_space_from {
 enum {
        JOURNAL_REPLAY_DONE,
        JOURNAL_STARTED,
-       JOURNAL_MAY_GET_UNRESERVED,
        JOURNAL_MAY_SKIP_FLUSH,
 };
 
+#define JOURNAL_WATERMARKS()           \
+       x(any)                          \
+       x(copygc)                       \
+       x(reserved)
+
+enum journal_watermark {
+#define x(n)   JOURNAL_WATERMARK_##n,
+       JOURNAL_WATERMARKS()
+#undef x
+};
+
+#define JOURNAL_WATERMARK_MASK 3
+
+/* Reasons we may fail to get a journal reservation: */
+#define JOURNAL_ERRORS()               \
+       x(ok)                           \
+       x(blocked)                      \
+       x(max_in_flight)                \
+       x(journal_full)                 \
+       x(journal_pin_full)             \
+       x(journal_stuck)                \
+       x(insufficient_devices)
+
+enum journal_errors {
+#define x(n)   JOURNAL_ERR_##n,
+       JOURNAL_ERRORS()
+#undef x
+};
+
 /* Embedded in struct bch_fs */
 struct journal {
        /* Fastpath stuff up front: */
@@ -155,6 +183,7 @@ struct journal {
        unsigned long           flags;
 
        union journal_res_state reservations;
+       enum journal_watermark  watermark;
 
        /* Max size of current journal entry */
        unsigned                cur_entry_u64s;
@@ -164,15 +193,7 @@ struct journal {
         * 0, or -ENOSPC if waiting on journal reclaim, or -EROFS if
         * insufficient devices:
         */
-       enum {
-               cur_entry_ok,
-               cur_entry_blocked,
-               cur_entry_max_in_flight,
-               cur_entry_journal_full,
-               cur_entry_journal_pin_full,
-               cur_entry_journal_stuck,
-               cur_entry_insufficient_devices,
-       }                       cur_entry_error;
+       enum journal_errors     cur_entry_error;
 
        union journal_preres_state prereserved;