32 Commits

Author SHA1 Message Date
Kent Overstreet
145ffa823b Update bcachefs sources to b31b8a82b13e bcachefs: fix ctime update on unlink
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-10-06 17:18:03 -04:00
beviu
454a6b9ade
Propagate error instead of die()ing in bcache_fs_open_fallible 2025-09-20 22:33:35 +02:00
Kent Overstreet
31c7a7398a format: Do a 'udevadm trigger' after formatting
Some checks failed
build / bcachefs-tools-rpm (push) Has been cancelled
build / bcachefs-tools-deb (ubuntu-24.04) (push) Has been cancelled
build / bcachefs-tools-msrv (push) Has been cancelled
Nix Flake actions / nix-matrix (push) Has been cancelled
Nix Flake actions / ${{ matrix.name }} (${{ matrix.system }}) (push) Has been cancelled
This causes the new filesystem UUID to be picked up; without this, mount
can fail if it's a multidevice filesystem.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 01:43:44 -04:00
Angelo Bulfone
4b97a99fa2 Allow block sizes smaller than backing medium 2025-08-27 18:47:54 -04:00
Kent Overstreet
459060f763 nul-terminate readlink() output
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-18 11:57:37 -04:00
Kent Overstreet
f968aa040b dev_name.state
Get memebr state when we're getting device names.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-17 18:27:05 -04:00
Kent Overstreet
43bca0cd63 Enforce a soft minimum limit of 64k for bucket size
Some checks failed
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
Nix Flake actions / nix-matrix (push) Has been cancelled
< 64k buckets don't work reliably anymore, we deadlock in the journal
when we try to write too big of a journal entry.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-24 12:02:22 -04:00
Kent Overstreet
5023292623 bcachefs: Fixes for bucket size calculations
Some checks failed
Nix Flake actions / nix-matrix (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
Make sure bucket size >= btree_node_size when adding a device, and
cmd_image_update needs to make sure the metadata device is big enough
for the minimum number of buckets.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-20 22:48:44 -04:00
Jérôme Poulin
5dd10a17e9 cmd_attr: Add --options=- and --remove-all to unset options
Signed-off-by: Jérôme Poulin <jeromepoulin@gmail.com>
2025-07-12 22:20:17 -04:00
Kent Overstreet
3f66d905c0 bch2_format_for_device_add()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-06-20 17:16:33 -04:00
Kent Overstreet
723b9092ac cmd_recover_super: Add a mode for recovering from another member device
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-05-08 12:26:19 -04:00
Kent Overstreet
6e4bda5ad5 Set BCH_FEATURE_incompat_version_field if supported
Some checks are pending
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-05-03 16:27:03 -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
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
642bc34abc fixup! Add support for FS_IOC_GETFSSYSFSPATH
Some checks failed
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
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
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
2160e9a7bd format: fix minimum bucket nr check
Some checks are pending
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
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
Some checks failed
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
Some checks failed
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
64ce740ac6 cmd_recover_super: 'bcachefs recover-super'
Some checks failed
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
Some checks are pending
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
Some checks failed
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
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
32fbdff2a9 Update bcachefs sources to 4a7a003763f5 bcachefs: Opt_durability can now be set via bch2_opt_set_sb() 2024-07-15 20:17:37 -04:00
Kent Overstreet
e1fa076a86 Fix target option parsing for format, migrate
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-07 16:12:55 -04:00
Kent Overstreet
38b8d01c4c Update bcachefs sources to 481b5f343248 bcachefs: Better error messages for missing inodes in fsck
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-24 17:36:11 -05:00
Thomas Bertschinger
f5baaf48e3 move Rust sources to top level, C sources into c_src
This moves the Rust sources out of rust_src/ and into the top level.
Running the bcachefs executable out of the development tree is now:

$ ./target/release/bcachefs command
or
$ cargo run --profile release -- command

instead of "./bcachefs command".

Building and installing is still:

$ make && make install

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 01:47:05 -05:00