Kent Overstreet
5f46c4b522
Don't use xclose() in splice_fd_to_stdinout()
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix Flake actions / nix-matrix (push) Waiting to run
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Blocked by required conditions
update-flake-lock / lockfile (push) Has been cancelled
The splice fd might have been closed, and a double-close here shouldn't
be a concern because we're not doing any interesting multithreaded
things and it's local to this function.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-29 13:33:29 -04:00
Kent Overstreet
6d7b47685b
Update bcachefs sources to f0ebca18293c bcachefs: bch2_fs_open() now takes a darray
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-28 15:31:43 -04:00
Kent Overstreet
e00e83b84d
copy_data should be static
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix Flake actions / nix-matrix (push) Waiting to run
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Blocked by required conditions
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-26 21:20:08 -04:00
Kent Overstreet
3304c90bec
format_opts.no_sb_at_end
...
Add an option for controlling whether we create a third redundant
superblock at the end of the device.
For image files that are going to immediately be resized, we want to
skip this.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-21 18:46:30 -04:00
Kent Overstreet
fee67d807b
linux shim: implement BLK_OPEN_CREAT
...
this allows O_CREAT to be passed through, for the new image creation
tool.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-21 18:46:30 -04:00
Kent Overstreet
8fae948d60
fixup! posix_to_bcachefs: Process dirents in sorted order
2025-04-21 18:46:30 -04:00
Kent Overstreet
6a83d70ef5
Update bcachefs sources to c9d875f9be1f bcachefs: Casefold is now a regular opts.h option
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix Flake actions / nix-matrix (push) Waiting to run
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Blocked by required conditions
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-21 15:47:15 -04:00
Kent Overstreet
98f2c06d41
fd fixes
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-21 14:32:50 -04:00
Kent Overstreet
dd2c7b9b89
format: Ensure we pick power of two bucket size
...
Non power of two bucket sizes are allowed - but not preferred.
We were accidentally picking bucket sizes that weren't blocksize
aligned - ouch.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-18 17:24:19 -04:00
Kent Overstreet
0f59cc6a9e
Update bcachefs sources to 65456ba56b93 bcachefs: Fix struct with flex member ABI warning
2025-04-17 12:51:03 -04:00
Kent Overstreet
642bc34abc
fixup! Add support for FS_IOC_GETFSSYSFSPATH
...
Nix Flake actions / nix-matrix (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-15 12:01:13 -04:00
Kent Overstreet
0335994507
Fix bchu_fs_open_by_dev()
...
- we can now correctly open by parsing sysfs, instead of falling back to
reading the superblock and grabbing the UUID
- non-UUID filesystem names now work
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-15 11:28:47 -04:00
Kent Overstreet
ae29e3069f
cmd_migrate: adjust space reserved for new fs metadata
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-15 11:21:47 -04:00
Kent Overstreet
c9ee646718
Add support for FS_IOC_GETFSSYSFSPATH
...
With single device mode we won't always show up in sysfs by UUID, but
the new VFS ioctl handles this nicely.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
844721635c
Update bcachefs sources to 2f9361370129 bcachefs: Improve opts.degraded
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
ad3875d1d9
cmd_migrate: use correct bucket size
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
e99da4dddb
xclose()
...
Add a helper to check for close errrors - especially bad file
descriptors, that can be a fun source of heisenbugs.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
7b35cb1e4a
reshuffle device_cmds(), data_cmds()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
4f5dba7a87
cmd_format: --source, --no_initialize are incompatible
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 21:10:24 -04:00
Kent Overstreet
007d6654bc
cmd_format: Don't initialize in verbose mode
...
Verbose is excessive here.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 10:14:23 -04:00
Kent Overstreet
bd3e0742af
cmd_format: make build_fs() static
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 10:14:23 -04:00
Kent Overstreet
24f9bd29a6
posix_to_bcachefs: Process dirents in sorted order
...
This improves reproducability when producing images.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-04-13 10:03:06 -04:00
Kent Overstreet
3aa2a4c47c
format: Ensure bcachefs module is loaded before checking version
...
this prevents accidentally formatting with a version unsupported by the
running kernel
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-31 18:40:18 -04:00
Integral
66c943be6c
bcachefs-tools: add fs_usage & return -EINVAL when no matching subcommand
...
Add the missing usage function for "fs" subcommand; when no matching
subcommand exists, print the usage and return -EINVAL.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-31 12:51:18 -04:00
Kent Overstreet
76b3ec9d66
list_journal: fix transaction filter extent matching
...
Giving a single pos for the transaction filter now correctly matches
against extents.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-30 18:27:52 -04:00
Kent Overstreet
7c47145f6c
cmd_fs_usage: Fix kernel version check
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
This needed an access() check, like the other uses, instead of exiting
if it can't be read.
Factor out a small common helper for this.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-28 11:38:55 -04:00
Integral
396545c2ea
bcachefs-tools: hide FUSE in usage when BCACHEFS_FUSE disabled
...
When BCACHEFS_FUSE is disabled or not defined, FUSE section shouldn't
be displayed in bcachefs usage (--help).
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-28 11:12:32 -04:00
Kent Overstreet
19d3a1778c
fsck: Kill -R, --reconstruct_alloc
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix-Tests / nix-flake-check (push) Waiting to run
We don't want users hitting this accidentally, and if needed for some
strange reason (it shouldn't be), it can still be specified via -o.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-26 10:15:26 -04:00
Integral
e54f288992
bcachefs-tools: fix build failure by fixing of C header filename
...
C header filename in `c_src/cmd_fusemount.c` hasn't been updated after renaming
`libbcachefs/fs-common.h`. Updating the filename to fix build failure.
Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-26 09:41:11 -04:00
Kent Overstreet
7c66e9fac5
migrate_superblock: make sure we remove old superblock
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-26 09:39:59 -04:00
Kent Overstreet
2160e9a7bd
format: fix minimum bucket nr check
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix-Tests / nix-flake-check (push) Waiting to run
2025-03-25 16:47:50 -04:00
Kent Overstreet
8af5c93e48
Update bcachefs sources to 1392e502d48b bcachefs: Add an "ignore unknown" option to bch2_parse_mount_opts()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-25 16:37:24 -04:00
Kent Overstreet
6657ce2de3
Migrate tool fixes
...
Migrate now works: there is an inconsequential free space inconsistency
after marking the new superblock (in migrate_superblock), which we're
hacking around with a fsck.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-24 17:46:23 -04:00
Kent Overstreet
5504533986
format: kill min_size()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-23 12:41:35 -04:00
Kent Overstreet
a55c655158
format: Redo bucket size calculations
...
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
bucket size now takes into account system memory and amount of memory
required to fsck: on very large filesystems it will automatically scale
up bucket size to ensure we can fsck.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-23 11:52:54 -04:00
Kent Overstreet
b8435c5693
bch2_format() now takes a darray of dev_opts
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-23 11:03:42 -04:00
Kent Overstreet
846f3398a2
More device option work
...
Nix-Tests / nix-flake-check (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
More work to regularize device options, with common command line
parsing - like other options.
This fixes an assortment of little nits: buggyness with the discard
option, device state (and others) can now be specied at device add time,
and is a decent cleanup.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-19 15:47:44 -04:00
Kent Overstreet
e6aecdd3b8
cmd_fsck: just exit if passed -a
...
-a is used when called from system to mean "automatic invocation, run
check only if you think you need it".
Since we have self healing and online fsck, we never need run fsck
automatically at boot time.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-19 15:09:44 -04:00
Kent Overstreet
62ea232b09
Update bcachefs sources to dbe591cee299 bcachefs: Add missing smp_rmb()
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-19 10:18:56 -04:00
Kent Overstreet
64ce740ac6
cmd_recover_super: 'bcachefs recover-super'
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
New tool for scanning for backup superblocks, to recover when the
primary superblock + sb layout have been overwritten.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-17 14:28:10 -04:00
Kent Overstreet
f42ee45c6e
Format now sets version_incompat_allowed
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Waiting to run
build / bcachefs-tools-deb (ubuntu-24.04) (push) Waiting to run
build / bcachefs-tools-rpm (push) Waiting to run
build / bcachefs-tools-msrv (push) Waiting to run
Nix-Tests / nix-flake-check (push) Waiting to run
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-03-16 16:09:03 -04:00
Kent Overstreet
86cbeaf1c2
fix bch2_super_write() for bs > 4096
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
update-flake-lock / lockfile (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-02-22 09:29:56 -05:00
Kent Overstreet
7d30f895c6
cmd_fs_usage: Handle querying old versions
...
Fix reading accounting from old kernel versions that had it in little
endian.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-02-06 10:26:10 -05:00
Kent Overstreet
67c9b378c7
fixup! Update bcachefs sources to 63bbe0ca4167 bcachefs: Scrub
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-02-03 15:31:59 -05:00
Kent Overstreet
3fcc955d00
Scrub
...
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>
2025-02-03 14:08:49 -05:00
Kent Overstreet
c4e25c6c3c
bcachefs fs top
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-02-03 14:08:49 -05:00
Kent Overstreet
8361ae1a42
Update bcachefs sources to 63bbe0ca4167 bcachefs: Scrub
2025-02-03 14:08:49 -05:00
Kent Overstreet
895fc9a101
cmd_format: fix -l, -v options
...
build / bcachefs-tools-deb (ubuntu-22.04) (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix-Tests / nix-flake-check (push) Has been cancelled
update-flake-lock / lockfile (push) Has been cancelled
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-01-26 17:34:23 -05:00
Kent Overstreet
16e23eaec1
Fix cmd_fs_usage for disk accounting key sort change
...
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-01-15 12:20:30 -05:00
Kent Overstreet
ef25411bdc
fixup! bcachefs: cmd_set_option() can now set device options on multi device filesystems
2024-12-09 03:55:16 -05:00