Commit Graph

291 Commits

Author SHA1 Message Date
Kent Overstreet
da37a5f204 Update bcachefs sources to b2f5acc670 bcachefs: fix assertion in journal read 2017-12-21 18:57:37 -05:00
Kent Overstreet
1cf4d51dc4 Update bcachefs sources to 14ce2a2031 bcachefs: fixes for building in userspace 2017-12-21 18:06:45 -05:00
Austin Seipp
8acc54456e make: correct path to 'bcachefs' in mkfs/fsck scripts
The fsck and bcachefs scripts simply worked by running 'exec bcachefs
...', but this executes whatever is out of `$PATH`, which is likely not
what a user expected when working inside the bcachefs-tools tree.

This replaces the local uses of 'exec bcachefs' to use bash's
readlink/dirname builtins in order to find the location of the currently
executing wrapper, and execute the 'bcachefs' tool from there.

This allows executing these wrappers from anywhere, provided 'bcachefs'
is just right next to them, with the correct semantics.

As a result, this also allows removing a tiny hack from the Nix
expressions, allowing the included default.nix to use completely
standard mkDerivation builders, with no extra patch/fixup phases.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-17 12:46:45 -06:00
Kent Overstreet
5053c6ed25 fix default checksum types 2017-12-15 12:57:40 -05:00
Kent Overstreet
ea83a3985d Update bcachefs sources to e57b5958cf bcachefs: fix for building in userspace 2017-12-13 16:12:38 -05:00
Kent Overstreet
f2feceddae Shim layer updates 2017-12-13 16:07:21 -05:00
Austin Seipp
fa36882a73 nix: add nix expressions for development
This adds Nix expressions for bcachefs-tools that are modular, work in
purely sandboxed build environments (e.g. on NixOS itself, or macOS, where
sandboxing is enabled by default), use a fixed copy of Nixpkgs (to avoid hidden,
global state) and uses standard build idioms.

This change uses a fixed version of Nixpkgs, one that will always be used for
every build of bcachefs-tools, for all users, rather than relying on whatever
copy of Nixpkgs the user has available.

This has a major benefit in that it allows the build to work in sandboxed
environments such as NixOS, and it correctly declares all of the necessary
dependencies that bcachefs-tools needs. This is done simply by using
stdenv.mkDerivation in order to write a "normal" Nix expression, where the
previous version used a variant of the stdenv builder, but this isn't needed for
the most part. (Doing this has other knock-on benefits, such as the usage of
standardized options like `enableParallelBuild = true;` -- allowing `nix-build`
to automatically do parallel builds, etc.)

Another major benefit of this change is that anyone can now use `nix-shell` to
develop/hack on bcachefs-tools incrementally; simply running nix-shell will put
you in a Bash shell environment where all of bcachefs-tools' dependencies are
proprerly provided, no matter the state of the outside build environment/host
operating system:

    $ nix-shell

    [nix-shell:~/src/bcachefs-tools]$ make -j4 # works immediately

As mentioned before, with this change, by default, nix-build and
nix-shell run using a prepackaged copy of an upstream Nixpkgs snapshot. This is
done purely to ensure anyone who builds bcachefs-tools using Nix does, in fact,
get a reproducible build. Without this, nix-build defaults to using the the
`<nixpkgs>` NIX_PATH entry in order to fetch dependencies; meaning that two
users on different channels will get different results (for example, if you have
the November 2017 channel but I have the October 2017 channel, the results may
be different).

With this patch, a user running

    $ nix-build

will always use the exact same copy of nixpkgs to bootstrap the build,
regardless of whatever channels the user has. This bootstrap mechanism does not
even depend on an existing copy of Nixpkgs itself; e.g. it can work with a
completely empty `NIX_PATH`.

This is arguably anti-modular, but for end-user applications like
bcachefs-tools, fixing the version of Nixpkgs is not normally a huge deal. Users
who wish to use a different copy of Nixpkgs can provide this with an argument to
nix-build directly, using the `nixpkgs` argument to the expression:

    $ nix-build --pure --arg nixpkgs 'import <nixpkgs> {}'

This uses the `<nixpkgs>` provided inside your `NIX_PATH` environment variable
to acquire dependencies, which by default is managed using `nix-channel`. If you
have a copy of the Nixpkgs source code e.g. from a `git clone`, you may use that
too by simply using `-I` to prepend your Nixpkgs to `NIX_PATH` (see `man
nix-build` for more):

    $ nix-build --pure \
        -I nixpkgs=$HOME/src/nixpkgs \
        --arg nixpkgs 'import <nixpkgs> {}'

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-10 16:07:33 -06:00
Austin Seipp
997bb216aa build: require explicit include paths for libbcachefs/
This removes the implicit `-I libbcachefs` argument to $(CC), which in turn
requires a set of minor changes throughout the tools. There are two advantages
to this setup:

    1) It is (arguably) easier to read, since the location of bcachefs includes
    are easier to understand at a glance ("where does util.h live?")

    2) It removes the need for a hack to include glibc's copy of
    dirent.h explicitly via '/usr/include/dirent.h', because libbcachefs/
    *also* has a dirent.h file and the compiler cannot disambiguate them.
    This has some ramifications on systems where /usr/include may not
    exist, such as NixOS.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-10 16:06:01 -06:00
Austin Seipp
04035f0c7e build: use 'find', not 'git', to locate C source code
We will not always have .git available in some cases. For example, if someone
simply downloaded a tarball of the tree, or if we're building with something
like Nix and want to exclude the .git folder, we need to cope and build the
source anyway.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-10 16:03:32 -06:00
Austin Seipp
4ac5ad0832 bcachefs: make usage output more consistent
Minor newline and spacing/alignment touchups make it all just a little easier to
read.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2017-12-10 16:03:25 -06:00
Kent Overstreet
a95883db43 add --replicas 2017-12-02 06:04:16 -05:00
Kent Overstreet
22291ae84a Update bcachefs sources to 9e7ae5219c bcachefs: Make write points more dynamic 2017-11-22 00:50:47 -05:00
Kent Overstreet
74cb922032 Update bcachefs sources to 661faf58db bcachefs: fix a deadlock in journal replay error path 2017-11-12 18:23:29 -05:00
Kent Overstreet
3347339bbd Simple stupid memory reclaim code 2017-11-12 16:48:07 -05:00
Kent Overstreet
e9afb70d26 Update bcachefs sources to 6a361fb68c bcachefs: Rework btree read error handling 2017-11-10 22:18:52 -09:00
Kent Overstreet
ea57dd8d48 Update bcachefs sources to 58b77cfec6 bcachefs: improve btree_ptr_debugcheck() 2017-11-10 12:58:58 -09:00
Kent Overstreet
6d09cd7766 Update bcachefs sources to 2679158d6e bcachefs: fix allocation + replication 2017-11-08 21:12:38 -09:00
Kent Overstreet
097fd2a5e6 Add commands for changing and removing passphrase 2017-11-08 16:06:37 -09:00
Kent Overstreet
b984559329 update for new option code 2017-11-08 16:01:26 -09:00
Kent Overstreet
8351bbc05b Update bcachefs sources to d4b7ef921a bcachefs: Refactoring 2017-11-08 16:01:26 -09:00
Kent Overstreet
bf8c59996b Update for new superblock options; makefile improvements 2017-10-08 10:25:36 -08:00
Kent Overstreet
85ee972555 Update bcachefs sources to e82e656279 bcachefs: Cleanups for building in userspace 2017-10-08 10:25:33 -08:00
Kent Overstreet
e7c2bb91bc Faster crc32c 2017-10-08 10:20:36 -08:00
Kent Overstreet
b1814f2dd0 fix a build error on weird glibc 2017-08-28 15:07:12 -04:00
Kent Overstreet
e0c54d52f5 Workarounds for building with gcc 4 2017-08-23 16:30:25 -06:00
Kent Overstreet
c7950838b2 handle REQ_OP_FLUSH 2017-08-23 16:30:25 -06:00
Kent Overstreet
8aaf7d913a urandom fallback 2017-08-23 16:29:28 -06:00
Kent Overstreet
4b9e40b23a fix incorrect errno usage 2017-08-23 16:29:28 -06:00
Kent Overstreet
38f22164a9 Update bcachefs sources to 6a25f7a00d bcachefs: fix ioctl code 2017-06-13 17:41:59 -08:00
Kent Overstreet
914c4d19ed Fix io from rebase to 4.11 2017-06-13 17:41:22 -08:00
Kent Overstreet
851e945db8 Update for sysfs changes 2017-06-13 15:53:11 -08:00
Kent Overstreet
565b4a74d6 Update bcachefs sources to 14e9ac5016 bcachefs: btree_iter fastpath 2017-05-12 23:14:24 -08:00
Kent Overstreet
a588eb0d9e Update bcachefs sources to 2d95696fbe bcachefs: fix rw -> ro -> rw transition 2017-05-08 10:21:21 -08:00
Kent Overstreet
63065c0128 Update bcachefs sources to 9ceb982d77 bcachefs: Store bucket gens in a btree 2017-05-08 06:57:17 -08:00
Kent Overstreet
e57a624feb Update bcachefs sources to 113b475ed2 bcachefs: Better error handling reading bucket prios/gens 2017-05-08 02:26:04 -08:00
Kent Overstreet
f9395eeca5 Update bcachefs sources to 3610542890 bcachefs: Convert to skcipher interface for chacha20 2017-05-05 04:28:45 -08:00
Kent Overstreet
e004b95b88 fix sync writes - don't use O_EXCL 2017-05-05 00:27:50 -08:00
Kent Overstreet
5db58a0bae Update bcachefs sources to fb365e1745 2017-04-24 09:48:35 -08:00
Kent Overstreet
e41920e603 Use aio 2017-04-23 22:05:31 -08:00
Kent Overstreet
c35fbbc025 Update bcachefs sources to 2e70771b8d 2017-04-23 22:00:36 -08:00
Kent Overstreet
1b495cf9e1 Update bcachefs sources to 846600a41b 2017-04-15 02:42:29 -08:00
Kent Overstreet
5c7454176e cmd_list improvements; use %m 2017-04-14 20:40:50 -08:00
Kent Overstreet
819f2dde79 Update bcachefs sources to f026e4e024 2017-04-14 20:40:31 -08:00
Kent Overstreet
03bc9d71b1 Update bcachefs sources to 3b4024f944 2017-04-10 21:37:18 -08:00
Kent Overstreet
e394bd4ba3 silence a compiler warning 2017-04-10 00:33:58 -08:00
Kent Overstreet
e783d814e8 Update bcachefs sources to da037866e6 2017-04-09 20:12:37 -08:00
Kent Overstreet
2615d73a74 Allow disk commands to specify member by index 2017-04-05 18:20:50 -08:00
Kent Overstreet
bc85a94114 add -i to cmd_list 2017-04-05 17:30:17 -08:00
Kent Overstreet
978c160405 Fix some clang warnings
the issue in cmd_debug - passing members of struct bpos to kstrtoull,
which aren't aligned - was a legit bug
2017-04-04 06:43:08 -08:00
Kent Overstreet
64c325ef48 Update bcachefs sources to ff95156479 2017-04-04 06:43:08 -08:00