bcachefs: Add an O_DIRECT option (for userspace)
authorKent Overstreet <kent.overstreet@gmail.com>
Thu, 21 Jul 2022 19:41:29 +0000 (15:41 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 22 Oct 2023 21:09:37 +0000 (17:09 -0400)
Sometimes we see IO errors due to O_DIRECT alignment issues - having an
option to use buffered IO will be helpful.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
fs/bcachefs/opts.h

index 30cf9a2d9dc1a47b04073bed25606a19668344ff..6e2bd6e01f8cc042d69ef3f45bd59a7fd19da9a3 100644 (file)
@@ -346,6 +346,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),                                         \