Implement 'bcachefs data scrub', frontend for
BCH_IOCTL_DATA.BCH_DATA_OP_scrub.
Takes a path to a device, mountpoint, or filesystem uuid. Can be run on
a specific device by passing a device, or if run on a filesystem scrubs
all devices in parallel.
Metadata only scrubbing is supported via -m.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
After upgrading liburcu to v0.15.0, bcachefs-tools failed to build. This patch
fixes build errors on liburcu v0.15.0.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Currently, 'bcachefs set-fs-option' requires all devices to be specified
when setting options on an offline multidevice filesystem - it can't yet
scan for the rest of the filesystem members.
We do need to fix this, but the scan code is written in Rust, so that
either means a lot of ugly FFI code or rewriting cmd_set_option() in
Rust - neither of which are happening today.
So as an interim hack, add a --dev-idx option: this can be specified
(multiple times if desired) for indicating which devices the device
specific options should be applied to.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Fix TODO "Show bcachefs version" in fusemount.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Currently, when "BCACHEFS_FUSE=1" is set, fusemount subcommand
still cannot be identified. Change RUSTFLAGS in Makefile to fix
this problem.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This can prevent data loss as libblkid < 2.40.1 can fail
to recognize existing bcachefs filesystems.
Reported on #bcache.
Signed-off-by: Gabriel de Perthuis <g2p.code@gmail.com>
Currently, when BCACHEFS_FUSE=1 is set, bcachefs-tools failed to build.
Replace "bch2_trans_do()" macro with "bch2_trans_commit_do()" in
cmd_fusemount.c to fix build failure.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Just returning a failure exit status makes it hard to tell what the
actual issue was. Instead, the mount command now also provides some
textual output.
See https://github.com/koverstreet/bcachefs-tools/issues/308 for an
example where mount does not provide any helpful output, even with
BCACHEFS_LOG=trace enabled.
Signed-off-by: Florian Schmaus <flo@geekplace.eu>
By default, rustc passes -nodefaultlibs to the linker. In some cases,
this can cause compiler builtins (e.g. __cpu_model, used by
__builtin_cpu_supports) not to be linked in:
= note: /nix/store/s2cjhni3s6shh0n35ay1hpj8d85k44qk-x86_64-unknown-linux-musl-binutils-2.43.1/bin/x86_64-unknown-linux-musl-ld: ./libbcachefs.a(tools-util.o): in function `resolve_crc32c':
/build/source/c_src/tools-util.c:457:(.text+0x1023): undefined reference to `__cpu_model'
collect2: error: ld returned 1 exit status
I saw this with static musl GCC builds, and others have reported it with
Clang.
Link: https://github.com/koverstreet/bcachefs-tools/issues/300
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
When static linking, it's not possible to have two functions with the
same name in different libraries:
= note: /nix/store/s2cjhni3s6shh0n35ay1hpj8d85k44qk-x86_64-unknown-linux-musl-binutils-2.43.1/bin/x86_64-unknown-linux-musl-ld: /nix/store/zwid05lzfy46k32xljb2alh0gq7ys58a-util-linux-minimal-static-x86_64-unknown-linux-musl-2.39.4-lib/lib/libblkid.a(libcommon_la-crc32c.o): in function `crc32c':
(.text+0x0): multiple definition of `crc32c'; ./libbcachefs.a(tools-util.o):/build/source/c_src/tools-util.c:484: first defined here
collect2: error: ld returned 1 exit status
Work around this by avoiding a known name collision with a function in
libblkid.
Closes: https://github.com/koverstreet/bcachefs-tools/issues/311
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
When FUSE startup encounters an error after opening the filesystem--for
example because of a bad mountpoint--it exited uncleanly, which is a
bit unfriendly.
Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This also fixes a bug where the set-passphrase
command failed to derive the key for disks initially
formatted with --encrypted and --no_passphrase, due to
bch_sb_crypt_init not configuring the KDF params if
the passphrase wasn't specified during formatting.
Signed-off-by: Mae Kasza <git@badat.dev>
Tested-by: Jérôme Poulin <jeromepoulin@gmail.com>