Commit Graph

1611 Commits

Author SHA1 Message Date
Thomas Mühlbacher
422ae1f1a7 build(nix): add cargo clippy check
note that this only checks the top-level package, `bch_bindgen` is
excluded because it has too many clippy lints.
2024-05-28 19:32:53 +02:00
Thomas Mühlbacher
bf2c0c8852 build(nix): use crane to build packages
this enables faster incremental rebuilds in nix. it also allows us to
add clippy and cargo test checks more easily. aside from that, i have
tried to carry over things that i think are sensible from the previous
`mkDerivation` call.

the `checkPhase` may as well rather be done in a `installCheckPhase` and
we can set `enableParallelBuilding` to speed up the compilation of
`libbcachefs.a`.
2024-05-28 19:32:15 +02:00
Thomas Mühlbacher
ce01c61ba5 build(nix): enable rustfmt check+formatter
with this, the gh actions ci will fail if submitted code does not adhere
to rustfmt rules.

additionally, running `nix fmt` will also format rust code.

because we want rules only supported by nightly rustfmt, and nixpkgs
doesn't have a nightly toolchain, we need to pull in another flake
input: fenix.
2024-05-27 19:30:26 -04:00
Thomas Mühlbacher
0e414b462f style: fix one straggler not caught by rustfmt
not sure why this wasn't picked up, maybe different versions of nightly
rustfmt?
2024-05-27 19:30:26 -04:00
Kent Overstreet
7efaf45d78 Update bcachefs sources to bc0fa834a738 bcachefs: Better fsck error message for key version 2024-05-27 19:17:49 -04:00
Kent Overstreet
067e072465 Update bcachefs sources to ea473c4a1a21 bcachefs: btree_gc can now handle unknown btrees 2024-05-27 19:04:42 -04:00
Kent Overstreet
9bb2977a1a Update bcachefs sources to 45845c32a41a fs: bcachefs: add missing MODULE_DESCRIPTION() 2024-05-27 17:59:22 -04:00
Christopher Fore
5a3011c48e doc: update subvolume destroy command to subvolume delete
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 21:36:01 -04:00
Kent Overstreet
aa985e6a44 Format with rustfmt
Note that we're using struct/enum align options, which require nightly.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 20:38:08 -04:00
Thomas Mühlbacher
5b216318b8 check_for_key before ask_for_passphrase
let's always first check if there is already a key in the keyring
available before we try to get the key from some more involved means.

Fixes: #261
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 13:32:56 -04:00
Thomas Mühlbacher
6ba303e8bf fix unfortunate typo
causes mounting encrypted devices to become stuck in a busy loop.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 12:52:37 -04:00
Kent Overstreet
80167bf0a8 cmd_dump: Dump full btree nodes
We're still having issues with corrupted dumps when we try to dump only
the live part of btree nodes.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-26 12:51:26 -04:00
Kent Overstreet
1e35104d31 Revert dump blocksize change
It appears qemu-img chokes on qcow2 images with too many l1 entries

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-25 12:51:31 -04:00
Thomas Bertschinger
7bf821f3f9 check errno to determine fsck ioctl error
The error code is in errno, not the return value.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-25 00:02:27 -04:00
koverstreet
ff44b8b96d
Merge pull request #275 from intelfx/work/fix-naming
fusemount: unbreak build
2024-05-24 18:09:54 -04:00
Kent Overstreet
9cd7440649 cmd_dump: Dump btree nodes correctly
We were using sectors_written from the parent node - whoops

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-24 18:07:20 -04:00
Kent Overstreet
3f531df2b3 Update bcachefs sources to 254510a1c269 bcachefs: btree_ptr_sectors_written() now takes bkey_s_c 2024-05-24 18:07:20 -04:00
Ivan Shapovalov
72ad5766bd fusemount: unbreak build
Commit 477670f4 ("Update bcachefs sources to 07f9a27f1969 bcachefs: add
no_invalid_checks flag") changed capitalization of BTREE_ITER_* flags.
Update cmd_fusemount.c accordingly.

Fixes: 477670f4 ("Update bcachefs sources to 07f9a27f1969 bcachefs: add no_invalid_checks flag")
2024-05-24 22:56:50 +02:00
koverstreet
cd198e2b8e
Merge pull request #274 from tmuehlbacher/make-nix-ci-useful
Make nix ci useful
2024-05-24 12:01:21 -04:00
Thomas Mühlbacher
88aa61eb95 ci: run nix build in workflow
so since up until the last merged changes, this entire gh action pretty
much equated to a no-op, afaict. and even now, the only thing i added in
PR #272 is a formatter check only for *.nix files.

i plan to add more checks soon that will be run by `nix flake check`.
but as of right now, adding this is the quickest way to make sure at
least something useful is done by this workflow.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-23 21:04:41 +02:00
Thomas Mühlbacher
45c8cc32a3 ci: fix NixOS misnomer
this workflow has nothing to do with NixOS, it's just running Nix on
Ubuntu.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-23 21:03:00 +02:00
koverstreet
0f5c8e0407
Merge pull request #273 from tmuehlbacher/gh-action-fix
github action fix
2024-05-22 17:42:59 -04:00
Thomas Mühlbacher
368cdb8796 ci: fix ci by updating gh actions
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 23:20:16 +02:00
Thomas Mühlbacher
f40361c34f chore(editorconfig): add *.y{,a}ml
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 23:20:16 +02:00
koverstreet
764031a4aa
Merge pull request #272 from tmuehlbacher/flake-overhaul
Flake overhaul
2024-05-22 16:58:18 -04:00
koverstreet
7d795ddb25
Merge pull request #271 from tmuehlbacher/cargo-clippy
Fix clippy lints
2024-05-22 16:44:35 -04:00
Thomas Mühlbacher
56a9580aeb build(nix): add some packages to the dev shell
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
2e316499df build(nix): add treefmt-nix
currently still bare but can be extended with a number of different
formatters (rustfmt, clang-format, ...). For full list see
https://flake.parts/options/treefmt-nix

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
cc16402e4f build(nix): replace flake-utils with flake-parts
it also provides a way for abstracting `system` and provides optional
modules, like treefmt-nix.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
0fcdd67bf0 build(nix): rm nixpkgs overlay
it shouldn't really be our job to define an overlay. it doesn't do
anything for us, afaict, and is trivial to implement for downstream
users of the flake if they so desire.

also the overlay doesn't even overlay anything, there is no package
called `bcachefs` in nixpkgs.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
5e9d1953a2 build(nix): simplify devShell
much more DRY.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
eccefb381d style(nix): group together inputs attr
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
b91647aab8 style(nix): run nix fmt
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
e94c985640 build(nix): switch to new RFC style nixfmt
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
04a31f10e0 build(flake.lock): update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/fa804edfb7869c9fb230e174182a8a1a7e512c40' (2023-11-02)
  → 'github:nixos/nixpkgs/3eaeaeb6b1e08a016380c279f8846e0bd8808916' (2024-05-21)
• Updated input 'utils':
    'github:numtide/flake-utils/ff7b65b44d01cf9ba6a71320833626af21126384' (2023-09-12)
  → 'github:numtide/flake-utils/b1d9ab70662946ef0850d488da1c9019f3a9752a' (2024-03-11)

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
683710c068 chore(editorconfig): flesh out definitions
so it actually works.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:35:05 +02:00
Thomas Mühlbacher
3882d1b1e4 refactor: manually fix remaining clippy lints
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:33:40 +02:00
Thomas Mühlbacher
3488d4f15f refactor: cargo clippy --fix
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-05-22 22:33:40 +02:00
Thomas Bertschinger
3ac510f6a4 add "bkey-type" option to list command
Only bkeys of the specified type will be printed.

Also, this reworks the error type in bch_bindgen to be able to
represent other kinds of error than just "invalid btree id".

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-09 17:29:08 -04:00
Kent Overstreet
477670f481 Update bcachefs sources to 07f9a27f1969 bcachefs: add no_invalid_checks flag 2024-05-09 16:26:14 -04:00
Kent Overstreet
5531accc97 cmd_dump: Fix missing sectors-to-bytes conversion
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-08 19:04:53 -04:00
Tony Asleson
128b569155 mount: Make udev_bcachefs_info more idiomatic
Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07 12:20:49 -05:00
Tony Asleson
3d63b901c6 Handle mount with FS with 1 device
If the user passes a single device node during the mount and
we have no information for it in the udev db, we read up the
super block.  When we do this, if the FS only has 1 block device
we will simply go ahead and do the mount instead of walking
all the block devices and reading up super blocks looking for
devices with a matching FS UUID.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07 12:20:49 -05:00
Tony Asleson
761ef99f91 Add env. variable BCACHEFS_BLOCK_SCAN
Introduce an env. variable for users that have a broken blkid which
renders the udev db as incomplete.  Only checks for the existence
of the variable, not its value.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07 12:20:49 -05:00
Tony Asleson
1fb1898b24 mount: Leverage udev db
If the udev database contains information about bcachefs, utilize it.
Otherwise, resort to traversing block devices and checking for
bcachefs super blocks.

V2: Reduce number of places we call read_super_slient in interators

Signed-off-by: Tony Asleson <tasleson@redhat.com>
2024-05-07 12:20:49 -05:00
Kent Overstreet
52904aa886 BCACHEFS_KERNEL_ONLY
Add an environment variable that indicates we prefer to run bcachefs
code in the kernel, not userspace - this is for the test environment
where it's easier to debug kernel code.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-05-04 15:28:24 -04:00
Thomas Bertschinger
2b8a0f0caf remove redundant "cmd_" prefix from functions in "commands"
It is more idiomatic to use `commands::mount` than
`commands::cmd_mount`.

No functionality changes intended by this patch.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-30 21:16:09 -04:00
koverstreet
578f32a96e
Merge pull request #259 from evanrichter/fix_device_add_args
Fix device add args
2024-04-29 12:57:27 -04:00
Evan Richter
a739671c0b add short arg parsers to device add command
Without the single char (with ':' if optarg expected) only the long
argument string would successfully parse.

For example, now "-lasdf" parses the same as "--label asdf"
2024-04-29 10:16:13 -06:00
Evan Richter
b832e3b2f7 remove --tier from device add getopt parser 2024-04-29 09:59:16 -06:00