]> git.sesse.net Git - bcachefs-tools-debian/log
bcachefs-tools-debian
4 months agokill bd_sync_fd
Kent Overstreet [Sat, 6 Jan 2024 22:45:54 +0000 (17:45 -0500)]
kill bd_sync_fd

not needed with pwritev2(.., RWF_SYNC), and perhaps we can get down to
one fd and then use O_EXCL for block devices.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoFix bch2_super_write() alignment
Kent Overstreet [Thu, 11 Jan 2024 03:26:49 +0000 (22:26 -0500)]
Fix bch2_super_write() alignment

We're about to switch to O_DIRECT only, which means we need to write
with proper alignment.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agocreate common entry point for Rust commands
Thomas Bertschinger [Mon, 8 Jan 2024 01:36:33 +0000 (18:36 -0700)]
create common entry point for Rust commands

The bcachefs sub-commands that are implemented in Rust (completions,
list, and mount) had separate entrypoints and thus had some differences
in behavior.

This introduces a common entry point for the Rust sub-commands. This
reduces duplicate boilerplate code like parsing argv and setting up
logging, and will facilitate converting more sub-commands to Rust in
the future.

An immediate benefit is that this fixes an issue with `bcachefs list`
not reporting errors:

before:

$ bcachefs list /dev/typo
$ echo $?
0

after:

$ bcachefs list /dev/typo
ERROR - bcachefs_rust::cmd_list: Fatal error: "No such file or directory"
$ echo $?
1

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoUpdate bcachefs sources to cbb2e45634dd bcachefs: fix simulateously upgrading & downg...
Kent Overstreet [Fri, 5 Jan 2024 19:18:29 +0000 (14:18 -0500)]
Update bcachefs sources to cbb2e45634dd bcachefs: fix simulateously upgrading & downgrading

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoatomic64_read_acquire() should be inline
Kent Overstreet [Fri, 5 Jan 2024 20:11:42 +0000 (15:11 -0500)]
atomic64_read_acquire() should be inline

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agocmd_show_super: --field-only
Kent Overstreet [Fri, 5 Jan 2024 17:39:05 +0000 (12:39 -0500)]
cmd_show_super: --field-only

4 months agoUpdate bcachefs sources to d267e10a43b2 bcachefs: __bch2_sb_field_to_text()
Kent Overstreet [Fri, 5 Jan 2024 17:38:14 +0000 (12:38 -0500)]
Update bcachefs sources to d267e10a43b2 bcachefs: __bch2_sb_field_to_text()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agolinux header updates
Kent Overstreet [Fri, 5 Jan 2024 17:39:40 +0000 (12:39 -0500)]
linux header updates

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agofix show_super default fields
Kent Overstreet [Fri, 5 Jan 2024 17:07:57 +0000 (12:07 -0500)]
fix show_super default fields

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agocmd_reset_counters
Kent Overstreet [Fri, 5 Jan 2024 00:45:54 +0000 (19:45 -0500)]
cmd_reset_counters

Add a subcommand for resetting superblock counters - for automated tests

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agofix list_journal for nochanges
Kent Overstreet [Thu, 4 Jan 2024 04:14:28 +0000 (23:14 -0500)]
fix list_journal for nochanges

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoUpdate bcachefs sources to 2a6125decb43 bcachefs: bch_sb_field_downgrade
Kent Overstreet [Sun, 31 Dec 2023 03:54:04 +0000 (22:54 -0500)]
Update bcachefs sources to 2a6125decb43 bcachefs: bch_sb_field_downgrade

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoimprove do_splice()
Kent Overstreet [Thu, 4 Jan 2024 01:30:35 +0000 (20:30 -0500)]
improve do_splice()

4 months agoUpdate bcachefs sources to 5264e9f4d0c0 bcachefs: fix setting version_upgrade_complete
Kent Overstreet [Sat, 30 Dec 2023 21:04:21 +0000 (16:04 -0500)]
Update bcachefs sources to 5264e9f4d0c0 bcachefs: fix setting version_upgrade_complete

4 months agofix missing atomic64_read_acquire on 32 bit
Kent Overstreet [Sat, 30 Dec 2023 01:16:37 +0000 (20:16 -0500)]
fix missing atomic64_read_acquire on 32 bit

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agofix cmd_list for new nochanges semantics
Kent Overstreet [Thu, 28 Dec 2023 02:50:46 +0000 (21:50 -0500)]
fix cmd_list for new nochanges semantics

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoMerge pull request #196 from Conan-Kudo/spec-libexecdir
koverstreet [Sun, 24 Dec 2023 14:11:48 +0000 (09:11 -0500)]
Merge pull request #196 from Conan-Kudo/spec-libexecdir

packaging: Update RPM spec to use %_libexecdir for libexec files

4 months agopackaging: Update RPM spec to use %_libexecdir for libexec files
Neal Gompa [Sun, 24 Dec 2023 14:09:56 +0000 (09:09 -0500)]
packaging: Update RPM spec to use %_libexecdir for libexec files

4 months agoUpdate bcachefs sources to 44ac32df8e0c bcachefs: Split brain detection
Kent Overstreet [Sun, 24 Dec 2023 00:55:43 +0000 (19:55 -0500)]
Update bcachefs sources to 44ac32df8e0c bcachefs: Split brain detection

4 months agoMerge pull request #195 from Conan-Kudo/use-libexec
koverstreet [Sun, 24 Dec 2023 13:47:55 +0000 (08:47 -0500)]
Merge pull request #195 from Conan-Kudo/use-libexec

Makefile, fsck: Use libexec instead of lib

4 months agoMakefile, fsck: Use libexec instead of lib
Neal Gompa [Sun, 24 Dec 2023 13:34:16 +0000 (08:34 -0500)]
Makefile, fsck: Use libexec instead of lib

These are executables that need to be installed in a non-path location.
Most distributions now install these into /usr/libexec, and the
path variable for this is LIBEXECDIR, so use that instead.

4 months agofixup for old gcc
Kent Overstreet [Sun, 24 Dec 2023 00:47:08 +0000 (19:47 -0500)]
fixup for old gcc

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agov1.4.0: Split brain detection
Kent Overstreet [Sat, 23 Dec 2023 04:33:16 +0000 (23:33 -0500)]
v1.4.0: Split brain detection

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agocmd_fsck: -k, run fsck in kernel
Kent Overstreet [Sun, 24 Dec 2023 00:37:04 +0000 (19:37 -0500)]
cmd_fsck: -k, run fsck in kernel

This adds a new option to cmd_fsck for using the kernel implementation
of fsck instead of userspace, via the BCH_IOCTL_FSCK_OFFLINE ioctl.

This isn't intended for normal usage - mainly for testing and debugging
purposes, and for when the kernel version of bcachefs better matches the
on disk format version.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoUpdate bcachefs sources to 72740a707b64 bcachefs: Split brain detection
Kent Overstreet [Sat, 23 Dec 2023 02:39:45 +0000 (21:39 -0500)]
Update bcachefs sources to 72740a707b64 bcachefs: Split brain detection

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agocmd_fsck can now take colon separated devices
Kent Overstreet [Sat, 23 Dec 2023 02:29:36 +0000 (21:29 -0500)]
cmd_fsck can now take colon separated devices

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoUpdate bcachefs sources to c6d45169c6 bcachefs: Convert split_devs() to darray
Kent Overstreet [Sat, 23 Dec 2023 02:21:14 +0000 (21:21 -0500)]
Update bcachefs sources to c6d45169c6 bcachefs: Convert split_devs() to darray

4 months agoMerge pull request #194 from intelfx/work/makefile-nonrecursive
koverstreet [Fri, 22 Dec 2023 09:49:58 +0000 (04:49 -0500)]
Merge pull request #194 from intelfx/work/makefile-nonrecursive

Makefile: do not recursively expand flags (speed up parallel builds considerably)

4 months agoMakefile: avoid recursively expanding expensive variables
Ivan Shapovalov [Fri, 22 Dec 2023 06:51:17 +0000 (09:51 +0300)]
Makefile: avoid recursively expanding expensive variables

Specifically, do not recursively expand $(CFLAGS) because this leads to
repeatedly performing compile tests (e. g. cc-disable-warning) on every
recipe execution.

Without (nproc=32):
```
$ time env -i PATH=/usr/bin BCACHEFS_FUSE=1 NO_RUST=1 make -j$(nproc)
<...>
    [LD]     bcachefs
  72,48s user 11,29s system 190% cpu 44,036 total
```

With:
```
$ time env -i PATH=/usr/bin BCACHEFS_FUSE=1 NO_RUST=1 make -j$(nproc)
<...>
    [LD]     bcachefs
  66,79s user 5,17s system 1955% cpu 3,679 total
```

4 months agoSilence a few rust build warnings
Kent Overstreet [Fri, 22 Dec 2023 00:49:55 +0000 (19:49 -0500)]
Silence a few rust build warnings

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
4 months agoUpdate bcachefs sources to df6415fefb27 bcachefs: Fixes for rust bindgen
Kent Overstreet [Fri, 22 Dec 2023 00:49:00 +0000 (19:49 -0500)]
Update bcachefs sources to df6415fefb27 bcachefs: Fixes for rust bindgen

4 months agoUpdate bcachefs sources to 5d0a6c2b32f1 bcachefs: check_directory_structure() can...
Kent Overstreet [Fri, 22 Dec 2023 00:10:40 +0000 (19:10 -0500)]
Update bcachefs sources to 5d0a6c2b32f1 bcachefs: check_directory_structure() can now be run online

4 months agoremove Rust artifacts during `make clean`
Thomas Bertschinger [Wed, 20 Dec 2023 22:02:28 +0000 (15:02 -0700)]
remove Rust artifacts during `make clean`

This should use `cargo clean` instead of `rm -rf ...`. Also,
due to a typo, the `rm` did not actually remove the Rust artifacts.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_list_journal: fix check to print entry header
Kent Overstreet [Wed, 20 Dec 2023 02:28:43 +0000 (21:28 -0500)]
cmd_list_journal: fix check to print entry header

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_migrate: don't link data above i_size
Kent Overstreet [Wed, 20 Dec 2023 01:35:20 +0000 (20:35 -0500)]
cmd_migrate: don't link data above i_size

The new filesystem might have a smaller blocksize than the old
blocksize, which trips this.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agodocs: add llvm-config dependency for arch, fedora
Thomas Bertschinger [Tue, 19 Dec 2023 23:38:47 +0000 (16:38 -0700)]
docs: add llvm-config dependency for arch, fedora

This adds on to 446ec6b092cc ("docs: mention that libclang is
required"). That commit updated the dependency list for Debian. This
adds the packages needed to get llvm-config for arch and fedora.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_migrate: fix memory leaks
Kent Overstreet [Wed, 20 Dec 2023 00:43:30 +0000 (19:43 -0500)]
cmd_migrate: fix memory leaks

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agomake allocator helpers inlines
Kent Overstreet [Wed, 20 Dec 2023 00:30:13 +0000 (19:30 -0500)]
make allocator helpers inlines

this gets us better log messages when using -fsanitize=address

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_migrate: check for write errors
Kent Overstreet [Wed, 20 Dec 2023 00:30:00 +0000 (19:30 -0500)]
cmd_migrate: check for write errors

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agofix shrinker_free()
Kent Overstreet [Wed, 20 Dec 2023 00:29:25 +0000 (19:29 -0500)]
fix shrinker_free()

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_migrate: fix write_data()
Kent Overstreet [Wed, 20 Dec 2023 00:17:19 +0000 (19:17 -0500)]
cmd_migrate: fix write_data()

passing a parent closure is totally unnecessary when using
BCH_WRITE_SYNC - and pops an assert in debug mode, because the write
path no longer supports delivering completions that way.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agov1.3.6
Kent Overstreet [Tue, 19 Dec 2023 04:29:06 +0000 (23:29 -0500)]
v1.3.6

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoDrop mlockall()
Kent Overstreet [Tue, 19 Dec 2023 04:21:43 +0000 (23:21 -0500)]
Drop mlockall()

now that we have
 - shrinkers running in the background via a thread
 - run_shrinkers() considering swap usage

this can probably be safely dropped - and it causes problems when
running as non root, so let's do so.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 1a739db0b256 bcachefs; guard against overflow in btree...
Kent Overstreet [Sun, 17 Dec 2023 20:42:17 +0000 (15:42 -0500)]
Update bcachefs sources to 1a739db0b256 bcachefs; guard against overflow in btree node split

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_dump: fix error message
Kent Overstreet [Sun, 17 Dec 2023 20:42:38 +0000 (15:42 -0500)]
cmd_dump: fix error message

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoFix makefile when building without systemd
Kent Overstreet [Sat, 16 Dec 2023 23:42:22 +0000 (18:42 -0500)]
Fix makefile when building without systemd

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 841a95c29f4c bcachefs: fix userspace build errors
Kent Overstreet [Sat, 16 Dec 2023 02:57:44 +0000 (21:57 -0500)]
Update bcachefs sources to 841a95c29f4c bcachefs: fix userspace build errors

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agofix packaging
Alexander Fougner [Sat, 9 Dec 2023 11:20:04 +0000 (12:20 +0100)]
fix packaging

- make deb fails with dh: error: Unknown sequence --with
  (options should not come before the sequence)

- fix deb build deps

- add missing rpm files

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Fix typo in 872cd43
Chris Webb [Sun, 10 Dec 2023 07:28:31 +0000 (07:28 +0000)]
bcachefs-tools: Fix typo in 872cd43

6% of physical RAM is info.totalram >> 4 not info.totalram << 4.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Disable -Wgnu-variable-sized-type-not-at-end for clang
Chris Webb [Sat, 9 Dec 2023 14:31:40 +0000 (14:31 +0000)]
bcachefs-tools: Disable -Wgnu-variable-sized-type-not-at-end for clang

clang's default warnings include -Wgnu-variable-sized-type-not-at-end,
producing a lot of false alarms about the GNU extension for libbcachefs.
Disable these using cc-disable-warning when building with clang.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Guard the __struct_group() #define in kernel.h
Chris Webb [Sat, 9 Dec 2023 14:15:08 +0000 (14:15 +0000)]
bcachefs-tools: Guard the __struct_group() #define in kernel.h

Our include/linux/byteorder.h uses the system <asm/byteorder.h>
because we don't provide our own in include/asm. This then pulls in
system <linux/stddef.h> which defines __struct_group. That definition
collides with the unconditional #define __struct_group in our local
include/linux/kernel.h, provoking preprocessor warnings.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Avoid glibc-specific mallinfo() in shrinker
Chris Webb [Sat, 9 Dec 2023 12:50:31 +0000 (12:50 +0000)]
bcachefs-tools: Avoid glibc-specific mallinfo() in shrinker

Before 326d7c1, the shrinker used freeram and totalram from a struct
sysinfo (constructed from /proc/meminfo) to target 25% free physical
memory. As well as the slowness of repeatedly reading /proc/meminfo,
this was a problem as freeram rises when the system starts to swap.
We don't want swapping to reduce our estimate of memory pressure.

To work around this, in 326d7c1 the shrinker started to use the total
allocated heap from a glibc-specific interface mallinfo2(), aiming to
shrink such that our heap is less than 80% of physical memory, unless
overall free memory is less than 6% so that becomes the determining factor.

Unfortunately, a sign error in the calculation means this heuristic
never worked. It would shrink aggressively when the process was small,
and not at all when the process grew beyond 80% of physical RAM. Only the
fallback test ensuring the free physical RAM doesn't fall below 6% would
actually kick in under memory pressure. It also breaks portability to
anything other than recent glibc.

Later, in 2440469 the mallinfo2() was replaced with the older mallinfo()
to improve compatibility with older glibc. This is even more problematic:
it's still not portable but also struct mallinfo has (signed) int fields
which overflow for large processes on 32-bit machines with a 3G/1G split.

Rather than trying to use libc-specific debug interfaces and our own heap
to inform the shrinker, use the information about free and total swap
we already have from sysinfo(2) to explicitly compensate for swapping
in our estimate of free physical memory. Target free memory of 6% of
physical RAM adjusted for zero swap use when calculating the pressure
on the shrinker, based on the effective behaviour of 326d7c1 in practice
given the sign error.

As well as fixing portability to non-glibc systems, this loosens the
assumption that we are the only process using significant memory when
setting the shrinker target. It wouldn't be unreasonable to run two
fsck jobs against independent devices on a large RAM machine and want to
balance physical RAM between them.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Use sysinfo(2) directly to implement si_meminfo()
Chris Webb [Sat, 9 Dec 2023 12:49:12 +0000 (12:49 +0000)]
bcachefs-tools: Use sysinfo(2) directly to implement si_meminfo()

Use a single sysinfo(2) call to fill out struct sysinfo instead of
multiple libc sysconf(3) requests, which will only make sysinfo(2) calls
internally anyway. This also enables us to access other struct sysinfo
fields, not just the three filled-out previously.

As we provide our own definition of struct sysinfo in include/linux/mm.h
to match the kernel, which is not guaranteed to align with the definition
libc provides in <sys/sysinfo.h>, use syscall(SYS_sysinfo, ...) directly
instead of the libc wrapper.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: Use basename(3) from <libgen.h>
Chris Webb [Sat, 9 Dec 2023 12:58:46 +0000 (12:58 +0000)]
bcachefs-tools: Use basename(3) from <libgen.h>

Although glibc also provides basename(3) from <string.h>, this is
non-standard whereas it is available from <libgen.h> portably.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: make 'all' the default Makefile goal
Tero Roponen [Fri, 8 Dec 2023 08:10:52 +0000 (10:10 +0200)]
bcachefs-tools: make 'all' the default Makefile goal

"fsck/bcachefsck_all:" coming before "all:" in the Makefile
causes the bcachefs binary not being built by default. Fix
this by explicitly setting the .DEFAULT_GOAL=all.

Signed-off-by: Tero Roponen <tero.roponen@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoMerge remote-tracking branch 'amoz/devel'
Kent Overstreet [Fri, 8 Dec 2023 01:19:06 +0000 (20:19 -0500)]
Merge remote-tracking branch 'amoz/devel'

5 months agoMerge pull request #190 from Dikay900/fs_free_space
koverstreet [Fri, 8 Dec 2023 01:10:15 +0000 (20:10 -0500)]
Merge pull request #190 from Dikay900/fs_free_space

cmd_fs: calculate free space

5 months agofix build for glibc prior to 2.33
Alexander Fougner [Thu, 7 Dec 2023 20:27:16 +0000 (21:27 +0100)]
fix build for glibc prior to 2.33

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
5 months agofix fallback flex array
Alexander Fougner [Thu, 7 Dec 2023 20:04:27 +0000 (21:04 +0100)]
fix fallback flex array

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
5 months agocmd_fs: calculate size based on bucket count for data types BCH_DATA_free, BCH_DATA_n...
Philip Laube [Wed, 6 Dec 2023 18:29:26 +0000 (19:29 +0100)]
cmd_fs: calculate size based on bucket count for data types BCH_DATA_free, BCH_DATA_need_discard and BCH_DATA_need_inc_gens

Signed-off-by: Philip Laube <philip.laube.dev@xyz.de>
5 months agoOnline fsck
Kent Overstreet [Tue, 5 Dec 2023 00:49:21 +0000 (19:49 -0500)]
Online fsck

This hooks up cmd_fsck to the new BCH_IOCTL_FSCK_ONLINE: if a filesystem
is mounted, we now use that instead of bailing out with an error.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 6d44812757dd bcachefs: BCH_IOCTL_FSCK_ONLINE
Kent Overstreet [Mon, 4 Dec 2023 21:03:52 +0000 (16:03 -0500)]
Update bcachefs sources to 6d44812757dd bcachefs: BCH_IOCTL_FSCK_ONLINE

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate .gitignore for new service files
Kent Overstreet [Wed, 6 Dec 2023 04:52:43 +0000 (23:52 -0500)]
Update .gitignore for new service files

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agofsck: add a service to schedule and run bcachefsck@ services
Darrick J. Wong [Tue, 5 Dec 2023 02:43:31 +0000 (18:43 -0800)]
fsck: add a service to schedule and run bcachefsck@ services

Create a script that looks for mounted bcachefs filesystems and tries to
run as many of them in parallel as possible without two different
scrubbers hitting the same low level block device.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
5 months agofsck: add systemd service definitions for automatic online service
Darrick J. Wong [Tue, 5 Dec 2023 02:43:31 +0000 (18:43 -0800)]
fsck: add systemd service definitions for automatic online service

Add some systemd service files so that bcachefs can automatically fsck
mounted filesystems in the background.  Hopefully with minimal
disruption to frontend operations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
5 months agoMerge pull request #191 from cepelinas9000/fuse-fixes-1
koverstreet [Thu, 7 Dec 2023 16:57:04 +0000 (11:57 -0500)]
Merge pull request #191 from cepelinas9000/fuse-fixes-1

Multiple small fuse fixes for write, api, and hardlink

5 months agoMultiple small fuse fixes for write, api, and hardlink
Tautvydas Nesvarbu [Thu, 7 Dec 2023 13:17:34 +0000 (15:17 +0200)]
Multiple small fuse fixes for write, api, and hardlink

* changed in Makefile to use recomended fuse api 35;
* force foreground mode, because fuse_daemonize is forking after initalization other bcachefs threads;
* fix fuse_link, there where mistype in fuse_log (the paremeter need to be inum.inum);
* The write_aligned is fixed, by  wrapping struct bch_write_op into container with single closure and using end_io callback to release
      that closure.

5 months agofix udev rules path
Alexander Fougner [Wed, 6 Dec 2023 17:20:11 +0000 (18:20 +0100)]
fix udev rules path

- include rules file in rpmspec
- update install docs with udev build requirement

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoMerge pull request #189 from Dikay900/fs_human_readable
koverstreet [Wed, 6 Dec 2023 18:58:01 +0000 (13:58 -0500)]
Merge pull request #189 from Dikay900/fs_human_readable

cmd_fs: add long parameter --human-readable to usage command

5 months agocmd_fs: add long parameter --human-readable to usage command
Philip Laube [Wed, 6 Dec 2023 18:29:05 +0000 (19:29 +0100)]
cmd_fs: add long parameter --human-readable to usage command

Signed-off-by: Philip Laube <philip.laube.dev@xyz.de>
5 months agoDisable shrinker thread shutdown
Kent Overstreet [Tue, 5 Dec 2023 23:28:14 +0000 (18:28 -0500)]
Disable shrinker thread shutdown

We seem to be hitting a rare crash in the exit path of fsck - when
shutting down the shrinker thread. Disable exiting the shrinker thread
as a workaround.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agomisc: don't allow udisks to automount bcachefs filesystems with no prompt
Darrick J. Wong [Tue, 5 Dec 2023 00:44:29 +0000 (19:44 -0500)]
misc: don't allow udisks to automount bcachefs filesystems with no prompt

The unending stream of syzbot bug reports and overwrought filing of CVEs
for corner case handling (i.e. things that distract from actual user
complaints) in XFS has generated all sorts of of overheated rhetoric
about how every bug is a Serious Security Issue(tm) because anyone can
craft a malicious filesystem on a USB stick, insert the stick into a
victim machine, and mount will trigger a bug in the kernel driver that
leads to some compromise or DoS or something.

I thought that nobody would be foolish enough to automount an XFS
filesystem.  What a fool I was!  It turns out that udisks can be told
that it's okay to automount things, and then GNOME will do exactly that.
Including mounting mangled XFS filesystems!  Same with bcachefs!

<delete angry rant about poor decisionmaking and armchair fs developers
blasting us on X while not actually doing any of the work>

Turn off /this/ idiocy by adding a udev rule to tell udisks not to
automount bcachefs filesystems.

This will not stop a logged in user from unwittingly inserting a
malicious storage device and pressing [mount] and getting breached.
This is not a substitute for a thorough audit.  This is not a substitute
for lklfuse.  This does not solve the general problem of in-kernel fs
drivers being a huge attack surface.  I just want to give Kent a break
from some of the oceans of bu******.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 71a5b27e017d bcachefs: Make backpointer fsck wb flush...
Kent Overstreet [Thu, 30 Nov 2023 07:20:42 +0000 (02:20 -0500)]
Update bcachefs sources to 71a5b27e017d bcachefs: Make backpointer fsck wb flush check more rigorous

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 676dd269f0f8 mean and variance: Promote to lib/math
Kent Overstreet [Thu, 30 Nov 2023 03:42:52 +0000 (22:42 -0500)]
Update bcachefs sources to 676dd269f0f8 mean and variance: Promote to lib/math

5 months agoUpdate bcachefs sources to eb83f1f842bb mean and variance: Promote to lib/math
Kent Overstreet [Thu, 30 Nov 2023 03:00:41 +0000 (22:00 -0500)]
Update bcachefs sources to eb83f1f842bb mean and variance: Promote to lib/math

5 months agoadd a fallback __DECLARE_FLEX_ARRAY
Kent Overstreet [Wed, 29 Nov 2023 22:41:06 +0000 (17:41 -0500)]
add a fallback __DECLARE_FLEX_ARRAY

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to c3e4d892b77b mean and variance: Promote to lib/math
Kent Overstreet [Wed, 29 Nov 2023 22:00:30 +0000 (17:00 -0500)]
Update bcachefs sources to c3e4d892b77b mean and variance: Promote to lib/math

5 months agoman: Fix cmd-option format
Brett Holman [Mon, 27 Nov 2023 20:22:59 +0000 (13:22 -0700)]
man: Fix cmd-option format

Options prgquote and degraded only had a single leading hyphen.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agobcachefs-tools: don't skip stale superblock wipe in force mode
Brian Foster [Mon, 27 Nov 2023 18:31:10 +0000 (13:31 -0500)]
bcachefs-tools: don't skip stale superblock wipe in force mode

Even though the blkid wipe has been fixed to detect and wipe old
superblocks, we still incorrectly skip the wipe when in force mode.
Update the force logic in open_for_format() to bypass the user
request and otherwise proceed with the wipe.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agocmd_list_journal: Apply star_start_of_lines() correctly
Kent Overstreet [Mon, 27 Nov 2023 18:35:08 +0000 (13:35 -0500)]
cmd_list_journal: Apply star_start_of_lines() correctly

In list_journal, we note which journal entries are being ignored - this
was forgetting to mark entries newer than the newest flush.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to feaca6edbd24 mean and variance: Promote to lib/math
Kent Overstreet [Mon, 27 Nov 2023 03:33:04 +0000 (22:33 -0500)]
Update bcachefs sources to feaca6edbd24 mean and variance: Promote to lib/math

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoConvert to BCH_IOCTL_DEV_USAGE_V2
Kent Overstreet [Fri, 24 Nov 2023 00:42:47 +0000 (19:42 -0500)]
Convert to BCH_IOCTL_DEV_USAGE_V2

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agoUpdate bcachefs sources to 8c94740b1bf8 bcachefs: Add missing vaidation for jset_entr...
Kent Overstreet [Sun, 26 Nov 2023 02:51:30 +0000 (21:51 -0500)]
Update bcachefs sources to 8c94740b1bf8 bcachefs: Add missing vaidation for jset_entry_data_usage

5 months agocmd_fs_usage: Print out replica set durability
Kent Overstreet [Sat, 25 Nov 2023 01:50:49 +0000 (20:50 -0500)]
cmd_fs_usage: Print out replica set durability

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agodocs: mention that libclang is required
Alexander Batischev [Thu, 23 Nov 2023 18:37:16 +0000 (21:37 +0300)]
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>
5 months agoimprove kmalloc performance
Daniel Hill [Mon, 20 Nov 2023 12:43:52 +0000 (01:43 +1300)]
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>
5 months agorust: fix MSRV build
Alexander Fougner [Thu, 23 Nov 2023 18:22:47 +0000 (19:22 +0100)]
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>
5 months agoUpdate bcachefs sources to 783085c3cc44 kbuild: Allow gcov to be enabled on the comma...
Kent Overstreet [Tue, 21 Nov 2023 00:33:52 +0000 (19:33 -0500)]
Update bcachefs sources to 783085c3cc44 kbuild: Allow gcov to be enabled on the command line

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
5 months agonix: add bcachefs-fuse package
Finn Behrens [Sun, 19 Nov 2023 21:13:14 +0000 (22:13 +0100)]
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>
6 months agofix manpage date
Zhai Can [Sat, 18 Nov 2023 07:29:22 +0000 (15:29 +0800)]
fix manpage date

Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agomanpage: add options for `set-option`
Zhai Can [Fri, 17 Nov 2023 08:43:26 +0000 (16:43 +0800)]
manpage: add options for `set-option`

Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agoupdate manpage
Zhai Can [Fri, 17 Nov 2023 08:30:18 +0000 (16:30 +0800)]
update manpage

Signed-off-by: Zhai Can <bczhc0@126.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agoFix build for cmd_fusemount.c
Kent Overstreet [Fri, 17 Nov 2023 22:04:46 +0000 (17:04 -0500)]
Fix build for cmd_fusemount.c

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agobcachefs-tools: fix broken libblkid superblock wipe
Brian Foster [Fri, 17 Nov 2023 13:12:58 +0000 (08:12 -0500)]
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>
6 months agoBump rust edition to 2021
Kent Overstreet [Thu, 16 Nov 2023 21:33:47 +0000 (16:33 -0500)]
Bump rust edition to 2021

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agodelete dead code
Kent Overstreet [Thu, 16 Nov 2023 20:47:59 +0000 (15:47 -0500)]
delete dead code

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agoUpdate bcachefs sources to 938f680845d1 fixup! rename and export __kern_path_locked()
Kent Overstreet [Thu, 16 Nov 2023 20:47:11 +0000 (15:47 -0500)]
Update bcachefs sources to 938f680845d1 fixup! rename and export __kern_path_locked()

6 months agoCreate COPYING.rust-dependencies in release tarballs
Kent Overstreet [Thu, 16 Nov 2023 20:45:12 +0000 (15:45 -0500)]
Create COPYING.rust-dependencies in release tarballs

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agoVersion is now specified in the makefile
Kent Overstreet [Thu, 16 Nov 2023 20:24:22 +0000 (15:24 -0500)]
Version is now specified in the makefile

git describe doesn't work for tarball releases

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
6 months agoUpdate bcachefs sources to 3ca08ab51ec9 bcachefs: six locks: Simplify optimistic...
Kent Overstreet [Mon, 13 Nov 2023 01:53:57 +0000 (20:53 -0500)]
Update bcachefs sources to 3ca08ab51ec9 bcachefs: six locks: Simplify optimistic spinning

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>