Commit Graph

49 Commits

Author SHA1 Message Date
Kent Overstreet
ca4892af17 cmd_fsck can now take colon separated devices
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-22 23:30:55 -05:00
Kent Overstreet
2b28e8f7d2 make allocator helpers inlines
this gets us better log messages when using -fsanitize=address

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-19 19:30:15 -05:00
Kent Overstreet
f76d246fff Update bcachefs sources to 1a739db0b256 bcachefs; guard against overflow in btree node split
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-18 23:21:21 -05:00
Brian Foster
1cdb7812d1 bcachefs-tools: don't skip stale superblock wipe in force mode
Even though the blkid wipe has been fixed to detect and wipe old
superblocks, we still incorrectly skip the wipe when in force mode.
Update the force logic in open_for_format() to bypass the user
request and otherwise proceed with the wipe.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-27 21:04:03 -05:00
Brian Foster
83bc15eefe bcachefs-tools: fix broken libblkid superblock wipe
When playing around with comparing some fstests results on different
filesystems, I noticed that a 'bcachefs format' of a previously
btrfs-formatted device still continued to mount as btrfs. The reason
for this is that the blkid wipe invoked via open_for_format() is not
working correctly. blkid_do_wipe() depends on the "SBMAGIC[_OFFSET]"
values to do any work, and the associated superblock magic flag is
not enabled on the probe.

Set the probe flags to explicitly enable the values the bcachefs
code depends on in the probe. This includes the type, label and
superblock magic information.

There are also a couple quirks in the libblkid code that might be
worth noting. One is that the superblock enablement and flag setting
functions appear hardcoded to return zero, so we just combine the
error checks. Second, while blkid_do_wipe() can return an error, it
actually doesn't in the scenario being addressed here because it
doesn't seem to distinguish between the values being absent because
nothing was found by the probe or because the values weren't enabled
in the first place. Regardless, add an error check here in the event
the wipe does explicitly fail for some unexpected reason.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-17 15:09:27 -05:00
Kent Overstreet
2252eecec7 Update bcachefs sources to 24bdb6fed91c bcachefs: bch2_btree_id_str()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-10-19 22:56:59 -04:00
Hunter Shaffer
9f98746bfc Change open_for_format to the block io api
Upcoming patch will add device benchmarking at format time, which needs
the bio API.

Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
2023-10-08 21:06:07 -04:00
Hunter Shaffer
b2ffa12074 deleted unused path to device in get_size, get_blocksize
Signed-off-by: Hunter Shaffer <huntershaffer182456@gmail.com>
2023-10-08 21:06:07 -04:00
Kent Overstreet
63747ac653 Fix null ptr deref in bbpos_parse()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-22 15:45:35 -04:00
Kent Overstreet
87179c7a6e Update bcachefs sources to 33a60d9b05 bcachefs: Assorted fixes for clang 2023-08-01 22:13:03 -04:00
Kent Overstreet
3e39c57c70 bpos_parse() now handles symbol constants
We can now parse U32_MAX/U64_MAX, as printed by bch2_bpos_to_text().

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-01 16:57:00 -04:00
Kent Overstreet
4697efb7a0 cmd_list_journal: Add filter options
Instead of having to use grep, this adds the ability to print out only
transactions that update a particular key, or to filter out entirely
keys except those updating certain btrees.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-12 21:44:33 -05:00
Kent Overstreet
e142c4ca01 New subcommand: set-option
This is for setting superblock options on existing filesystems, either
online or offline.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-05-26 16:37:13 -04:00
Kent Overstreet
fa7a74fcc8 Delete some dead code
printf_pad() has been superseded by printbuf tabstops.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-05-26 16:30:57 -04:00
Kent Overstreet
6f5afc0c12 Update bcachefs sources to bdf6d7c135 fixup! bcachefs: Kill journal buf bloom filter 2022-05-02 18:42:06 -04:00
Kent Overstreet
e240b4ae86 Update bcachefs sources to f638850417 bcachefs: bch2_trans_log_msg() 2022-03-30 17:40:37 -04:00
Kent Overstreet
5528e3ae62 Update bcachefs sources to 9b3aa5ec6c bcachefs: Add tabstops to printbufs 2022-02-22 04:56:09 -05:00
Kent Overstreet
9cc3b7debb Unit handling cleanups
The option code has been switching to keeping things in display units -
bytes - and this transitions more libbcachefs.c code to bytes as well,
to match, and also fixes device add.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-01-01 21:14:22 -05:00
Kent Overstreet
ad03173172 Update bcachefs sources to aa540d47ab bcachefs: Option improvements 2021-12-25 18:48:46 -05:00
Kent Overstreet
2fc5a50bd6 Fix device add for kernel sysfs changes
Also slightly improve some error messages

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2021-12-10 14:07:31 -05:00
jpsollie
d6415ce25b add a blk_wipe function call
Remove any possible filesystems left on the block device when formatting
this makes sure the automounter does not accidentally mount it as another filesystem.
one of the functionalities possibly wiped by accodent?

Signed-off-by: jpsollie <janpieter.sollie@edpnet.be>
2021-07-24 17:10:10 -04:00
Kent Overstreet
07ec713e05 Update bcachefs sources to 1a510b00b6 bcachefs: Increase BTREE_TRANS_MEM_MAX 2021-07-04 23:33:54 -04:00
jpsollie
0fbe294a96 Improve compiler compatibility + run blkid remove for all filesystems
add a blk_wipe function to remove any possible filesystems left on the block device
this makes sure the automounter does not accidentally mount it as another filesystem.

Signed-off by: Janpieter Sollie <janpieter.sollie@edpnet.be>
2021-06-13 01:09:56 -04:00
Kent Overstreet
cc92b0f5a2 New data job command
This adds a new subcommand, bcachefs data job, that gives more direct
access to the data job/ioctl functionality, and hooks up the new rewrite
old nodes data job.
2021-03-16 21:46:21 -04:00
Kent Overstreet
a9a46467e6 Assorted debug and fsck improvements
This adds a new list mode to "bcachefs list", for printing out nodes as
they exist on disk (before being merge sorted). Also some improvements
to fsck return values.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2020-08-24 16:26:22 -04:00
Kent Overstreet
7c39a1cf1b fs_usage cmd fixes
- Sort devices by device name if they don't have a label
- We were printing the wrong devices in the device list in the per-data
  entries
2020-01-03 19:33:05 -05:00
Justin Husted
c54ea51416 Make die exit using _exit
Exiting the standard way on error caused teardown in bad state problems.

Signed-off-by: Justin Husted <sigstop@gmail.com>
2019-12-29 13:08:35 -08:00
Kent Overstreet
9b08492bc7 check if fs is mounted before running fsck 2019-03-24 21:07:45 -04:00
Kent Overstreet
0e9822571c Use opts.h for format options 2018-12-19 18:27:57 -05:00
Kent Overstreet
67fb317a07 improve dev_to_mount()
should fix a bug where resize does an offline resize when the fs was
mounted because it thought it wasn't mounted
2018-10-21 19:35:35 -04:00
Kent Overstreet
bb6f4111fb Update bcachefs sources to 9abf628c70 bcachefs: Fix a spurious error in fsck 2018-06-01 17:33:19 -04:00
Kent Overstreet
3588fa621c fixes for 32 bit builds/non x86 archs 2018-05-17 02:36:19 -04:00
Leah Neukirchen
0f85ced799 tools-util.c: define generic crc32c on non-x86_64 arch 2018-02-09 23:13:24 +01:00
Kent Overstreet
7875b82630 New data rereplicate command 2018-02-08 15:33:43 -05:00
Kent Overstreet
a9f5937a97 cmd_migrate fixes
when linking existing data, we weren't creating alloc btree keys - also,
we were calculating the wrong bucket...
2018-02-07 06:52:56 -05:00
Kent Overstreet
dbad1685bc show-super can now print more stuff 2017-12-29 21:15:47 -05:00
Kent Overstreet
aca9f96dcc Resizing 2017-12-28 02:55:08 -05:00
Kent Overstreet
30caf69540 Add bcachefs fs usage 2017-12-23 00:51:19 -05: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
Kent Overstreet
bf8c59996b Update for new superblock options; makefile improvements 2017-10-08 10:25:36 -08:00
Kent Overstreet
e7c2bb91bc Faster crc32c 2017-10-08 10:20:36 -08:00
Kent Overstreet
e004b95b88 fix sync writes - don't use O_EXCL 2017-05-05 00:27:50 -08:00
Kent Overstreet
5c7454176e cmd_list improvements; use %m 2017-04-14 20:40:50 -08:00
Kent Overstreet
5ec39af8ea Rename from bcache-tools to bcachefs-tools 2017-03-19 17:31:47 -08:00
Kent Overstreet
07ddcf0bef cmd_device_add improvements 2017-03-09 09:26:56 -09:00
Kent Overstreet
a17f7bcec7 cmd_migrate 2017-03-09 09:14:11 -09:00
Kent Overstreet
d230eaea61 Add a command to dump filesystem metadata 2017-02-06 23:43:16 -09:00
Kent Overstreet
5933f9478c update bcache code, fsck improvements 2017-02-06 20:45:37 -09:00
Kent Overstreet
b33fc8298f bcache in userspace; userspace fsck 2017-01-20 09:07:08 -09:00