]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - libbcachefs/opts.h
Update bcachefs sources to 8e1519ccb6 bcachefs: Add tracepoint & counter for btree...
[bcachefs-tools-debian] / libbcachefs / opts.h
index 9e68f1002d8dddae816e35d7986e94681240fee1..304718a0b599b50b60d80631d98f515bbc7b6d77 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/sysfs.h>
 #include "bcachefs_format.h"
 
+extern const char * const bch2_metadata_versions[];
 extern const char * const bch2_error_actions[];
 extern const char * const bch2_sb_features[];
 extern const char * const bch2_sb_compat[];
@@ -164,22 +165,22 @@ enum opt_type {
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
          OPT_FN(bch2_opt_target),                                      \
          BCH_SB_METADATA_TARGET,       0,                              \
-         "(target)",   "Device or disk group for metadata writes")     \
+         "(target)",   "Device or label for metadata writes")          \
        x(foreground_target,            u16,                            \
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
          OPT_FN(bch2_opt_target),                                      \
          BCH_SB_FOREGROUND_TARGET,     0,                              \
-         "(target)",   "Device or disk group for foreground writes")   \
+         "(target)",   "Device or label for foreground writes")        \
        x(background_target,            u16,                            \
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
          OPT_FN(bch2_opt_target),                                      \
          BCH_SB_BACKGROUND_TARGET,     0,                              \
-         "(target)",   "Device or disk group to move data to in the background")\
+         "(target)",   "Device or label to move data to in the background")\
        x(promote_target,               u16,                            \
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
          OPT_FN(bch2_opt_target),                                      \
          BCH_SB_PROMOTE_TARGET,        0,                              \
-         "(target)",   "Device or disk group to promote data to on read")\
+         "(target)",   "Device or label to promote data to on read")   \
        x(erasure_code,                 u16,                            \
          OPT_FS|OPT_INODE|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,            \
          OPT_BOOL(),                                                   \
@@ -205,6 +206,11 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,               true,                           \
          NULL,         "Stash pointer to in memory btree node in btree ptr")\
+       x(btree_write_buffer_size, u32,                                 \
+         OPT_FS|OPT_MOUNT,                                             \
+         OPT_UINT(16, (1U << 20) - 1),                                 \
+         BCH2_NO_SB_OPT,               1U << 13,                       \
+         NULL,         "Number of btree write buffer entries")         \
        x(gc_reserve_percent,           u8,                             \
          OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME,                      \
          OPT_UINT(5, 21),                                              \
@@ -265,16 +271,16 @@ enum opt_type {
        x(discard,                      u8,                             \
          OPT_FS|OPT_MOUNT|OPT_DEVICE,                                  \
          OPT_BOOL(),                                                   \
-         BCH2_NO_SB_OPT,               false,                          \
+         BCH2_NO_SB_OPT,               true,                           \
          NULL,         "Enable discard/TRIM support")                  \
        x(verbose,                      u8,                             \
-         OPT_FS|OPT_MOUNT,                                             \
+         OPT_FS|OPT_MOUNT|OPT_RUNTIME,                                 \
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,               false,                          \
          NULL,         "Extra debugging information during mount/recovery")\
        x(journal_flush_delay,          u32,                            \
          OPT_FS|OPT_MOUNT|OPT_RUNTIME,                                 \
-         OPT_UINT(0, U32_MAX),                                         \
+         OPT_UINT(1, U32_MAX),                                         \
          BCH_SB_JOURNAL_FLUSH_DELAY,   1000,                           \
          NULL,         "Delay in milliseconds before automatic journal commits")\
        x(journal_flush_disabled,       u8,                             \
@@ -289,6 +295,16 @@ enum opt_type {
          OPT_UINT(0, U32_MAX),                                         \
          BCH_SB_JOURNAL_RECLAIM_DELAY, 100,                            \
          NULL,         "Delay in milliseconds before automatic journal reclaim")\
+       x(move_bytes_in_flight,         u32,                            \
+         OPT_HUMAN_READABLE|OPT_FS|OPT_MOUNT|OPT_RUNTIME,              \
+         OPT_UINT(1024, U32_MAX),                                      \
+         BCH2_NO_SB_OPT,               1U << 20,                       \
+         NULL,         "Maximum Amount of IO to keep in flight by the move path")\
+       x(move_ios_in_flight,           u32,                            \
+         OPT_FS|OPT_MOUNT|OPT_RUNTIME,                                 \
+         OPT_UINT(1, 1024),                                            \
+         BCH2_NO_SB_OPT,               32,                             \
+         NULL,         "Maximum number of IOs to keep in flight by the move path")\
        x(fsck,                         u8,                             \
          OPT_FS|OPT_MOUNT,                                             \
          OPT_BOOL(),                                                   \
@@ -315,11 +331,6 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,                       false,                          \
          NULL,         "Don't replay the journal")                     \
-       x(rebuild_replicas,             u8,                             \
-         OPT_FS|OPT_MOUNT,                                             \
-         OPT_BOOL(),                                                   \
-         BCH2_NO_SB_OPT,                       false,                          \
-         NULL,         "Rebuild the superblock replicas section")      \
        x(keep_journal,                 u8,                             \
          0,                                                            \
          OPT_BOOL(),                                                   \
@@ -345,6 +356,11 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,                       false,                          \
          NULL,         "Don't open device in exclusive mode")          \
+       x(direct_io,                    u8,                             \
+         OPT_FS|OPT_MOUNT,                                             \
+         OPT_BOOL(),                                                   \
+         BCH2_NO_SB_OPT,                       true,                   \
+         NULL,         "Use O_DIRECT (userspace only)")                \
        x(sb,                           u64,                            \
          OPT_MOUNT,                                                    \
          OPT_UINT(0, S64_MAX),                                         \
@@ -381,6 +397,19 @@ enum opt_type {
          OPT_BOOL(),                                                   \
          BCH2_NO_SB_OPT,                       false,                          \
          NULL,         NULL)                                           \
+       x(nocow,                        u8,                             \
+         OPT_FS|OPT_FORMAT|OPT_MOUNT|OPT_RUNTIME|OPT_INODE,            \
+         OPT_BOOL(),                                                   \
+         BCH_SB_NOCOW,                 false,                          \
+         NULL,         "Nocow mode: Writes will be done in place when possible.\n"\
+                       "Snapshots and reflink will still caused writes to be COW\n"\
+                       "Implicitly disables data checksumming, compression and encryption")\
+       x(no_data_io,                   u8,                             \
+         OPT_FS|OPT_MOUNT,                                             \
+         OPT_BOOL(),                                                   \
+         BCH2_NO_SB_OPT,                       false,                  \
+         NULL,         "Skip submit_bio() for data reads and writes, " \
+                       "for performance testing purposes")             \
        x(fs_size,                      u64,                            \
          OPT_DEVICE,                                                   \
          OPT_UINT(0, S64_MAX),                                         \
@@ -453,17 +482,9 @@ struct bch_option {
        enum opt_flags          flags;
        u64                     min, max;
 
-       union {
-       struct {
-       };
-       struct {
-               const char * const *choices;
-       };
-       struct {
-               int (*parse)(struct bch_fs *, const char *, u64 *);
-               void (*to_text)(struct printbuf *, struct bch_fs *, u64);
-       };
-       };
+       const char * const *choices;
+       int (*parse)(struct bch_fs *, const char *, u64 *);
+       void (*to_text)(struct printbuf *, struct bch_fs *, struct bch_sb *, u64);
 
        const char              *hint;
        const char              *help;
@@ -482,13 +503,14 @@ void __bch2_opt_set_sb(struct bch_sb *, const struct bch_option *, u64);
 void bch2_opt_set_sb(struct bch_fs *, const struct bch_option *, u64);
 
 int bch2_opt_lookup(const char *);
-int bch2_opt_parse(struct bch_fs *, const char *, const struct bch_option *,
-                  const char *, u64 *);
+int bch2_opt_validate(const struct bch_option *, u64, struct printbuf *);
+int bch2_opt_parse(struct bch_fs *, const struct bch_option *,
+                  const char *, u64 *, struct printbuf *);
 
 #define OPT_SHOW_FULL_LIST     (1 << 0)
 #define OPT_SHOW_MOUNT_STYLE   (1 << 1)
 
-void bch2_opt_to_text(struct printbuf *, struct bch_fs *,
+void bch2_opt_to_text(struct printbuf *, struct bch_fs *, struct bch_sb *,
                      const struct bch_option *, u64, unsigned);
 
 int bch2_opt_check_may_set(struct bch_fs *, int, u64);
@@ -498,18 +520,12 @@ int bch2_parse_mount_opts(struct bch_fs *, struct bch_opts *, char *);
 /* inode opts: */
 
 struct bch_io_opts {
-#define x(_name, _bits)        unsigned _name##_defined:1;
-       BCH_INODE_OPTS()
-#undef x
-
 #define x(_name, _bits)        u##_bits _name;
        BCH_INODE_OPTS()
 #undef x
 };
 
 struct bch_io_opts bch2_opts_to_inode_opts(struct bch_opts);
-struct bch_opts bch2_inode_opts_to_opts(struct bch_io_opts);
-void bch2_io_opts_apply(struct bch_io_opts *, struct bch_io_opts);
 bool bch2_opt_is_inode_opt(enum bch_opt_id);
 
 #endif /* _BCACHEFS_OPTS_H */