Commit Graph

17 Commits

Author SHA1 Message Date
Qu Wenruo 87b3197d81 btrfs-progs: move space cache removal to rescue group
The option "--clear-space-cache" is not really that suitable for "btrfs
check" group, as there are some concerns:

- Allowing transid mismatch
- No leaf item checks

  Thoe behaviour are inherited from the default open ctree flags for
  "btrfs check", which can be unsafe if the end user just wants to clear
  the cache.

- Unclear if the cache clearing would happen along with repair

  Thankfully the clearing of space cache is done without any repair

Thus there is a proposal to move space cache removal to rescue group,
and this patch would do that exactly.

However this would lead to some behavior changes:

- Transid mismatch would be treated as error
- Leaf items size/offset would still be checked

  If we hit any above error, we should just abort without doing any
  write.

These change would increase the safety of the space cache removal, thus
I believe it's worthy to introduce such behavior change.

Since we're here, also add a small explanation on why we need this
dedicated tool to clear space cache (especially for v1 cache).

Issue: #698
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-11-03 18:04:37 +01:00
David Sterba c1c4923a02 btrfs-progs: completeion: add missing commands from 'rescue' group
The commands fix-device-size, clear-uuid-tree and clear-ino-cache have
been missing in the completion file since the command implementation was
added.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-10-13 18:13:12 +02:00
David Disseldorp f75dd798d1 btrfs-progs: completion: include files in "du" completion
Currently "btrfs filesystem du" auto-completes for directories only,
but it can also be used against files to determine shared vs exclusive
extents.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-04-26 12:39:16 +02:00
David Sterba b16b35e074 btrfs-progs: inspect: new command map-swapfile
Verify if a given file is suitable for a swapfile and print the physical
offset (ie. the ultimate on-device physical offset), and the resume
offset value (physical / page size).

This can be the kernel parameter or written to /sys/power/resume_offset
before hibernation.  Option -r or --resume-offset prints just the value.

Copied and simplified from Omar Sandoval's tool to print extents:

https://github.com/osandov/osandov-linux/blob/master/scripts/btrfs_map_physical.c

Issue: #544
Issue: #533
Signed-off-by: David Sterba <dsterba@suse.com>
2022-12-06 21:03:31 +01:00
David Sterba 1c6c2c2159 btrfs-progs: completion: add recently added commands
Signed-off-by: David Sterba <dsterba@suse.com>
2022-11-09 18:57:35 +01:00
Daniel Xu c11874ae81 btrfs-progs: rescue: add create-control-device subcommand
Add a new subcommand 'btrfs rescue create-control-device' that creates
/dev/btrfs-control. This is helpful on systems that may not have `mknod`
installed and the device node is missing for some reason.

Issue: #223
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
[ update docs ]
Signed-off-by: David Sterba <dsterba@suse.com>
2021-02-19 16:19:37 +01:00
Qu Wenruo 89fcbbc041 btrfs-progs: completion: let dump-tree/dump-super/inode-resolve accept any file
For dump-tree/dump-super the completion uses default filedir -d, which
is far from convenient.  Use filedir for
dump-tree/dump-super/inode-resolve just like rootid.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-10-23 14:48:38 +02:00
Qu Wenruo 26300de037 btrfs-progs: completion: use _filedir to replace _btrfs_devs
For developers it's pretty common to call "btrfs check" on a raw image
dump other than real block device.  It's also possible to end users to
do some tests on loop devices.

So current _btrfs_devs() is really making things worse. Use _filedir()
to replace _btrfs_devs() so it can complete any filenames, no matter if
it's just a file or a real block device.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2018-10-23 14:48:38 +02:00
Misono, Tomohiro 629688a2d2 btrfs-progs: cleanup whitespaces of btrfs-completion
Clean up spaces and use only tabs. No functional change.

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:19 +02:00
Misono, Tomohiro 86529862e1 btrfs-progs: update btrfs-completion
This patch updates btrfs-completion:
 - add "filesystem du" and "rescure zero-log"
 - restrict _btrfs_mnts to show btrfs type only
 - add more completion in last case statements

(This file contains both spaces/tabs and may need cleanup.)

Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2017-09-25 15:17:11 +02:00
Alexander Fougner 1a9df1c68b btrfs-progs: update docs and completion for tree-stats
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-05-02 14:39:57 +02:00
Alexander Fougner 2ae0b12df0 btrfs-progs: update docs for inspect-internal dump-super
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
[ minor formatting updates ]
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
Alexander Fougner a7dae09ae2 btrfs-progs: update docs and completion for inspect-internal dump-tree
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2016-03-14 13:42:47 +01:00
David Sterba 5b1c5b8878 btrfs-progs: inspect: add command min-dev-size
Previously in 'filesystem resize get_min_size', now
'inspect-internal min-dev-size'. We'd like to avoid cluttering the
'resize' syntax further.

The test has been updated to exercise the new option.

Signed-off-by: David Sterba <dsterba@suse.com>
2015-08-31 19:25:08 +02:00
David Sterba f7a18e4cab btrfs-progs: add 'device remove' alias to completion
Signed-off-by: David Sterba <dsterba@suse.com>
2015-07-01 15:39:59 +02:00
David Sterba 895b772996 btrfs-progs: completion: add fi and dev usage commands
Signed-off-by: David Sterba <dsterba@suse.cz>
2015-03-23 23:07:32 +01:00
David Sterba ace45622ce btrfs-progs: add bash completion script
Original authors:
  Alfredo Esteban <aedelatorre at gmail.com>
  Joseph Wang <joequant at gmail.com>
  John C F <john.ch.fr at gmail.com>

Signed-off-by: David Sterba <dsterba@suse.cz>
2015-02-02 17:49:41 +01:00