34 Commits

Author SHA1 Message Date
Kent Overstreet
7094e625c0 Update bcachefs sources to 5df84d32ad84 bcachefs: bch2_can_do_write_btree() 2025-11-28 15:34:08 -05:00
Manuel Mendez
30fcb00f69 c_src: Ensure all commands support -h and --help 2025-10-07 16:23:03 -04:00
Manuel Mendez
7873eb976e c_src: Align and standardize help outputs
While adding scrub to data in last commit I noticed that the help output
where all over the place, both "physically" on the console and also
things like inconsistent case and newlines before "Report bugs to ...",
so I decided to fix all that up.
2025-10-07 16:22:50 -04:00
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
Nikita Ofitserov
a1e870abb7 cmd_migrate: Prevent spurious "Superblock modified by another process" errors
This is only a workaround for the superblock writing process always reading back the
first sb in the layout and checking its sequence number.
Zeroing it out ensures a harmless warning instead of an error.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
b1021e7b39 cmd_migrate: Make fsck after migrate-superblock debug-only
There is no reason to run a fsck there for common use, as the FS is now
modified only by calling consistency-preserving APIs.

Also switch the debug-only fsck to nochanges mode for easier debugging.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
805319c0ef cmd_migrate: Open the device in exclusive mode for migrate-superblock
Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
85184478aa cmd_migrate: Small fixes
Ensure that the space for the future default sb layout is not used during the migration process.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
020763ad66 cmd_migrate: Reimplement cmd_migrate_superblock
Now the FS is first started RW, then new superblock is written and metadata updated.
This ensures that all recovery/upgrades/downgrades are performed at the beginning.

Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
277ddb57ef cmd_migrate: Introduce add_default_sb_layout helper
Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Nikita Ofitserov
ed95a9f311 cmd_migrate: Introduce mark_nouse_range helper
Signed-off-by: Nikita Ofitserov <himikof@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-09-06 17:56:19 -04:00
Kent Overstreet
c12d7b3315 Commands called with no arguments now print usage
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-08-27 18:47:54 -04:00
Kent Overstreet
b02c3e9682 posix_to_bcachefs: cleanup
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-12 19:49:41 -04:00
Kent Overstreet
b392d55d4a cmd_migrate: Fix small UAF
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 Flake actions / nix-matrix (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-07-05 11:33:49 -04:00
Kent Overstreet
e7cc6bb9cf getopt() -> getopt_long()
Kill all remaining getopt() uses - all options can now be passed as
longopts.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2025-07-04 12:47:30 -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
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
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
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
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
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
8361ae1a42 Update bcachefs sources to 63bbe0ca4167 bcachefs: Scrub 2025-02-03 14:08:49 -05:00
Ariel Miculas
d750b2b98b bcachefs: allow initializing a bcachefs filesystem from a source directory
Add a new source command line argument which specifies the directory
tree that will be copied onto the newly formatted bcachefs filesystem.

This commit also fixes an issue in copy_link where uninitialized data is
copied into the symlink because of a round_up of the buffer size.

Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:08:52 -04:00
Kent Overstreet
7d79fba1af Update bcachefs sources to f81dc88f0c80 bcachefs: bch2_btree_insert() - add btree iter flags
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-03 20:08:06 -04:00
Andrea Gelmini
18f9526c45
treewide, docs: fix typos
Signed-off-by: Andrea Gelmini <andrea.gelmini@gelma.net>
[remove changes to libbcachefs/, linux/, include/, and raid/]
Co-authored-by: Masum Reza <masumrezarock100@gmail.com>
Signed-off-by: Masum Reza <masumrezarock100@gmail.com>
2024-05-29 09:22:09 +05:30
Kent Overstreet
477670f481 Update bcachefs sources to 07f9a27f1969 bcachefs: add no_invalid_checks flag 2024-05-09 16:26:14 -04:00
Kent Overstreet
5639fb38ca Update bcachefs sources to 09d4c2acbf4c bcachefs: reconstruct_inode()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-03 17:34:02 -04:00
Cyan
0c00d3a372
Typo 2024-02-24 14:21:54 +08: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