Commit Graph

1263 Commits

Author SHA1 Message Date
Alexander Batischev
446ec6b092 docs: mention that libclang is required
This fixes the following build failure on Debian bookworm:

    error: failed to run custom build command for `clang-sys v1.6.1`

    Caused by:
      process didn't exit successfully: `/home/minoru/src/bcachefs-tools/rust-src/target/release/build/clang-sys-df95f6d1266be773/build-script-build` (exit status: 101)
      --- stdout
      cargo:warning=could not execute `llvm-config` one or more times, if the LLVM_CONFIG_PATH environment variable is set to a full path to valid `llvm-config` executable it will be used to try to find an instance of `libclang` on your system: "couldn't execute `llvm-config --prefix` (path=llvm-config) (error: No such file or directory (os error 2))"

      --- stderr
      thread 'main' panicked at /home/minoru/.cargo/registry/src/index.crates.io-6f17d22bba15001f/clang-sys-1.6.1/build/dynamic.rs:206:45:
      called `Result::unwrap()` on an `Err` value: "couldn't find any valid shared libraries matching: ['libclang.so', 'libclang-*.so'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
      note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-24 20:09:46 -05:00
Daniel Hill
326d7c1b3b improve kmalloc performance
Reading from /proc/meminfo is really slow

We don't want to start swapping to disk.

Deceptively, memory available goes up when we start to swap to disk making
performance even worse.

To mitigate this:
1. replace reading from meminfo with proper system calls.
2. attempt to lock allocations in physical memory space.
3. check our own allocated memory instead of available memory.
4. still check available memory in the off chance we're trying to play
nice with other apps.

Signed-off-by: Daniel Hill <daniel@gluo.nz>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-24 19:54:11 -05:00
Alexander Fougner
fbad1bfdf3 rust: fix MSRV build
- downgrade clap_completion to 4.3.x (1.65 compatible)
- dependency updates
- remove unused imports

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-11-23 19:29:43 +01:00
Kent Overstreet
06611a71a3 Update bcachefs sources to 783085c3cc44 kbuild: Allow gcov to be enabled on the command line
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-22 16:55:06 -05:00
Finn Behrens
e6b578917f nix: add bcachefs-fuse package
Add a fuseSupport argument and bcachefs-fuse as flake output with fuse enabled.

Signed-off-by: Finn Behrens <me@kloenk.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-20 15:13:17 -05:00
Zhai Can
b09d3a3356 fix manpage date
Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-18 14:53:17 -05:00
Zhai Can
07d4e0e864 manpage: add options for set-option
Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-18 14:53:17 -05:00
Zhai Can
0b5a8c239b update manpage
Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-18 14:53:17 -05:00
Kent Overstreet
c6e6954928 Fix build for cmd_fusemount.c
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-17 17:04:46 -05:00
Brian Foster
83bc15eefe bcachefs-tools: fix broken libblkid superblock wipe
When playing around with comparing some fstests results on different
filesystems, I noticed that a 'bcachefs format' of a previously
btrfs-formatted device still continued to mount as btrfs. The reason
for this is that the blkid wipe invoked via open_for_format() is not
working correctly. blkid_do_wipe() depends on the "SBMAGIC[_OFFSET]"
values to do any work, and the associated superblock magic flag is
not enabled on the probe.

Set the probe flags to explicitly enable the values the bcachefs
code depends on in the probe. This includes the type, label and
superblock magic information.

There are also a couple quirks in the libblkid code that might be
worth noting. One is that the superblock enablement and flag setting
functions appear hardcoded to return zero, so we just combine the
error checks. Second, while blkid_do_wipe() can return an error, it
actually doesn't in the scenario being addressed here because it
doesn't seem to distinguish between the values being absent because
nothing was found by the probe or because the values weren't enabled
in the first place. Regardless, add an error check here in the event
the wipe does explicitly fail for some unexpected reason.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-17 15:09:27 -05:00
Kent Overstreet
1331759db5 Bump rust edition to 2021
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 17:54:06 -05:00
Kent Overstreet
119d26bb10 delete dead code
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 17:54:06 -05:00
Kent Overstreet
689b4dd4f0 Update bcachefs sources to 938f680845d1 fixup! rename and export __kern_path_locked() 2023-11-16 17:54:06 -05:00
Kent Overstreet
9776f9f362 Create COPYING.rust-dependencies in release tarballs
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 17:54:06 -05:00
Kent Overstreet
47bb2d53ce Version is now specified in the makefile
git describe doesn't work for tarball releases

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 15:24:22 -05:00
Kent Overstreet
7fd6c3ffe4 Update bcachefs sources to 3ca08ab51ec9 bcachefs: six locks: Simplify optimistic spinning
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-12 20:57:28 -05:00
Finn Behrens
a613340b26 rust keylocation add none variant and implement ValueEnum
This enables a possible values help in the clap help text.

Signed-Off-By: Finn Behrens <me@kloenk.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-12 11:14:16 -05:00
Zhai Can
73da05d983
rust-cli: add help on list command 2023-11-10 21:20:17 +08:00
Zhai Can
1d1fe7b0b6
add command to generate Rust-part CLI completions 2023-11-10 21:20:01 +08:00
Finn Behrens
61134a06fa nix: add devShell
Add a nix devShell output to provide a development environment for nix users.

Signed-off-by: Finn Behrens <me@kloenk.de>
2023-11-09 23:13:43 +01:00
Finn Behrens
813310c343 nix: fix build add overlay and formatter to flake
Adds overlay flake output to expose the bcachefs package
and add and run a nix formatter.

Co-authored-by: Leona Maroni <dev@leona.is>
Signed-off-by: Leona Maroni <dev@leona.is>
Signed-off-by: Finn Behrens <me@kloenk.de>
2023-11-09 22:09:33 +01:00
Nicholas Sielicki
81352a29bc btree_write_buffer: ensure atomic64_sub_return_release availability
prior to this patch, on certain platforms (ie: armv7l), compilation fails due
to atomic64_sub_return_release not being defined here. Ensure that the atomics
header is pulled in, and ensure that it is available in all cases, regardless
of whether ATOMIC64_SPINLOCK is defined.

Signed-off-by: Nicholas Sielicki <linux@opensource.nslick.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-08 11:32:40 -05:00
Nicholas Sielicki
974d9bf000 rust: mount: use libc::c_ulong for flags
libc proper treats mount flags as an unsigned long, which is usually u64,
except when it isn't. When preparing mount flags, use the libc::c_ulong type
instead of u64 to allow for this.

This fixes compiling this file under armv7l.

Signed-off-by: Nicholas Sielicki <linux@opensource.nslick.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-08 11:32:36 -05:00
Kent Overstreet
29e27cc492 Fix build on 32 bit
size_t is apparently not an unsigned long on 32 bit, which is what
rounddown_pow_of_two() returns.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-07 21:17:06 -05:00
Kent Overstreet
d6d1d8e519 make-release-tarball.sh
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-07 19:33:41 -05:00
Alexander Fougner
8f4361b686 ci: skip install of recommended packages
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-11-07 20:02:43 +01:00
Alexander Fougner
04666325d4 ci: bump github actions
- cachix/install-nix-action v22 -> v23
- actions/checkout v3 -> v4

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-11-07 20:02:43 +01:00
Kent Overstreet
469e8eb008 Avoiding picking different bucket sizes for different devices
Erasure coding can't create stripes across devices with different bucket
sizes - therefore, format shouldn't pick different bucket sizes for
different devices.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-06 20:47:48 -05:00
Kent Overstreet
a0371350ef Fix build for cmd_fusermount.c
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-06 19:06:34 -05:00
Kent Overstreet
cc902bb4bf cmd_format: Check for device options after device arguments
It's a common user error to specify device specific options at the end
of a format command, and then not have them apply to any devices - add a
check for this.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-06 19:02:40 -05:00
Alexander Fougner
26efa5cf2e downgrade rust deps to compile for MSRV
- add helper for cargo update, whilst respecting MSRV

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-11-04 20:29:28 -04:00
Kent Overstreet
13a9480722 Update bcachefs sources to d464ec667b2b bcachefs: Add missing printk newlines 2023-11-03 12:09:59 -04:00
Kent Overstreet
37ee7f0591 Update, slim down rust dependencies
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-02 16:44:59 -04:00
Kent Overstreet
0a08ddf78c Update bcachefs sources to b9bd69421f73 bcachefs: x-macro-ify inode flags enum 2023-11-02 14:39:01 -04:00
Kent Overstreet
d320a4e927 Update bcachefs sources to 6628827a8707 bcachefs: Skip deleted members in member_to_text() 2023-10-27 19:38:36 -04:00
Kent Overstreet
8eaf8ddf45 Update bcachefs sources to 7250b2ee5574 bcachefs: Fix deleted inodes btree in snapshot deletion 2023-10-27 16:43:11 -04:00
Kent Overstreet
9799b119c3 Update bcachefs sources to 0d63ed13ea3d closures: Fix race in closure_sync()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-25 13:59:16 -04:00
Kent Overstreet
bd9e015334 Update bcachefs sources to f70a3402188e bcachefs: Fix ca->oldest_gen allocation
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-20 13:25:06 -04:00
Kent Overstreet
2252eecec7 Update bcachefs sources to 24bdb6fed91c bcachefs: bch2_btree_id_str()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-19 22:56:59 -04:00
Kent Overstreet
6a34032417 Update bcachefs sources to a180af9dd349 bcachefs: Refactor memcpy into direct assignment
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-18 22:14:53 -04:00
Hunter Shaffer
9f98746bfc Change open_for_format to the block io api
Upcoming patch will add device benchmarking at format time, which needs
the bio API.

Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
2023-10-08 21:06:07 -04:00
Hunter Shaffer
b2ffa12074 deleted unused path to device in get_size, get_blocksize
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
2023-10-08 21:06:07 -04:00
Kent Overstreet
1251ea58a8 Update bcachefs sources to 7bf1ac0d46 bcachefs: Correctly initialize new buckets on device resize
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
2023-10-08 21:06:07 -04:00
Kent Overstreet
6b175a0224 Handle -EAGAIN from io_submit()
If io_submit() returns -EAGAIN, that just means the io context is full
and we need to wait for completions - no need to die.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-29 01:27:59 -04:00
Kent Overstreet
5e215654da Update bcachefs sources to a1b6677dca57 bcachefs: Fix looping around bch2_propagate_key_to_snapshot_leaves() 2023-09-26 17:12:51 -04:00
Kent Overstreet
1e358401ec Update bcachefs sources to 1336a995cbc3 bcachefs: Silence transaction restart error message 2023-09-26 13:29:49 -04:00
Kent Overstreet
6e8f2857af Create symlinks on install with ln -sf
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-26 01:05:29 -04:00
Kent Overstreet
a053ebfb8c Update bcachefs sources to f9c612bbf82d bcachefs: Fixes for building in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-23 20:03:23 -04:00
Kent Overstreet
731926b5e5 Kill shell script wrappers
nixos has trouble with the shell script wrappers - readlink isn't
available by default!

But, there's a better approach: just get rid of them and use symlinks
instead, and have main() check what we're supposed to be.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-22 14:09:51 -04:00
Brian Foster
f76c449ec0 bcachefs-tools: fix endian problems between bit spinlocks and futexes
bcachefs format on a big-endian (s390x) machine crashes down in the
rhashtable code imported from the kernel. The reason this occurs
lies within the rht_lock() -> bit_spin_lock() code, the latter of
which casts bitmaps down to 32-bits to satisfy the requirements of
the futex interface.

The specific problem here is that a 64 -> 32 bit cast doesn't refer
to the lower 8 bytes on a big endian machine, which means setting
bit number 0 in the 32-bit map actually corresponds to bit 32 in the
64-bit map. The rhashtable code specifically uses bit zero of the
bucket pointer for exclusion and uses native bitops elsewhere (i.e.
__rht_ptr()) to identify NULL pointers. If bit 32 of the pointer is
set by the locking code instead of bit 0, an otherwise NULL pointer
looks like a non-NULL value and results in a segfault.

The bit spinlock code imported by the kernel is originally intended
to work with unsigned long. The kernel code is able to throttle the
cpu directly when under lock contention, while the userspace
implementation relies on the futex primitives to emulate reliable
blocking. Since the futex interface introduces the 32-bit
requirement, isolate the associated userspace hack to that
particular code.

Restore the native bitmap behavior of the bit spinlock code to
address the rhashtable problem described above. Since this is not
compatible with the futex interface, create a futex wrapper
specifically to convert the native bitmap type to a 32-bit virtual
address and mask value for the purposes of waiting/waking when under
lock contention.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-19 17:26:45 -04:00