Commit graph

6605 commits

Author SHA1 Message Date
David Sterba b3b041302e btrfs-progs: add btrfs-find-root to btrfs.box
There's a report that btrfs-find-root does not work as built-in tool in
btrfs.box, while it's advertised in the help:

  $ ./btrfs.box help --box
  Standalone tools built-in in the busybox style:
  - mkfs.btrfs
  - btrfs-image
  - btrfs-convert
  - btrfstune
  - btrfs-find-root

Add the support as it might be useful tool sometimes. In the future the
command should be moved to e.g. inspect-internal or rescue.

Issue: #648
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
David Sterba 7446f2ce71 btrfs-progs: ci: build check all crypto backends
On relese tests also check all the backends, use Tumbleweed as it's
known to work there and provide all supported library versions.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
Anand Jain 77f366c9da btrfs-progs: add noscan parameter to check_where_mounted
The function check_where_mounted() scans the system for all other btrfs
devices, which is necessary for its operation.  However, in certain
cases, devices remaining in the scanned state is undesirable.  Introduce
the 'noscan' argument to make devices unscanned before return.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
Anand Jain e408cfb49b btrfs-progs: factor out btrfs_scan_argv_devices
To prepare for handling command line given devices factor out
btrfs_scan_argv_devices().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
Anand Jain 60771e72a4 btrfs-progs: drop argument devid from device_list_add
Drop the devid argument, it can be fetched from the disk_super argument.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
Anand Jain dc9e80192b btrfs-progs: drop open_ctree_flags variable in cmd_inspect_dump_tree
Local variable open_ctree_flags carries the flags whose final update is
for the locally declared struct variable oca_flags. Just use oca.flags
directly.

Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:48 +02:00
Anand Jain d46a0ef6a0 btrfs-progs: rename struct open_ctree_flags to open_ctree_args
The struct open_ctree_flags currently holds arguments for
open_ctree_fs_info(), it can be confusing when mixed with a local variable
named open_ctree_flags as below in the function cmd_inspect_dump_tree().

  cmd_inspect_dump_tree()
  ::
  struct open_ctree_flags ocf = { 0 };
  ::
  unsigned open_ctree_flags;

So rename struct open_ctree_flags to struct open_ctree_args.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:47 +02:00
Anand Jain 626d53fc75 btrfs-progs: switch is_btrfs to bool in check_mounted_where
The variable 'is_btrfs' is declared as an integer but should be a boolean
instead.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:47 +02:00
David Sterba 177a2eeadb btrfs-progs: tests: don't show grep output when checking stream version
The test misc/058 does not properly filter out the output due to -s that
only ignores non-existent files and was there due to previous changes.
We need to use -q.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:47 +02:00
Anand Jain 82a9870d48 btrfs-progs: dump-super: fix read beyond device size
On aarch64 systems with glibc 2.28, several btrfs-progs test cases are
failing because the command 'btrfs inspect dump-super -a <dev>' reports
an error when it attempts to read beyond the disk/file-image size.

  $ btrfs inspect dump-super -a /dev/vdb12
  <snap>
  ERROR: Failed to read the superblock on /dev/vdb12 at 274877906944

And btrfs/184 also fails, as it uses -s 2 option to dump the last super
block.

	$ ./check btrfs/184
	FSTYP         -- btrfs
	PLATFORM      -- Linux/aarch64 a4k 6.4.0-rc7+ #7 SMP PREEMPT Sat Jun 24 02:47:24 EDT 2023
	MKFS_OPTIONS  -- /dev/vdb2
	MOUNT_OPTIONS -- /dev/vdb2 /mnt/scratch

	btrfs/184 1s ... [failed, exit status 1]- output mismatch (see /Volumes/ws/xfstests-dev/results//btrfs/184.out.bad)
	    --- tests/btrfs/184.out    2020-03-03 00:26:40.172081468 -0500
	    +++ /Volumes/ws/xfstests-dev/results//btrfs/184.out.bad    2023-06-24 05:54:40.868210737 -0400
	    @@ -1,2 +1,3 @@
	     QA output created by 184
	    -Silence is golden
	    +Deleted dev superblocks not scratched
	    +(see /Volumes/ws/xfstests-dev/results//btrfs/184.full for details)
	    ...
	    (Run 'diff -u /Volumes/ws/xfstests-dev/tests/btrfs/184.out /Volumes/ws/xfstests-dev/results//btrfs/184.out.bad'  to see the entire diff)
	Ran: btrfs/184
	Failures: btrfs/184
	Failed 1 of 1 tests

This is because `pread()` behaves differently on aarch64 and sets
`errno = 2` instead of the usual `errno = 0`.

To fix check if the sb offset is beyond the device size or regular file
size and skip the corresponding sbread().

Also, move putchar('\n') after a successful call to load_and_dump_sb() to
the load_and_dump_sb() itself.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:47 +02:00
Anand Jain 8da82cde9c btrfs-progs: dump-super: drop the label out and variable ret
In cmd_inspect_dump_super(), at the label 'out', nothing much happens
other than returning ret.

At the goto statement to the label, in the for loop, we perform close(fd).
However, moving the close(fd) to 'out' as well is not a good idea because
close(fd) doesn't make sense outside the for loop.

Instead, simply return 1 instead of ret=1 and then returning it. Drop both
the 'out' label and ret.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 15:00:41 +02:00
Anand Jain 4ab083175a btrfs-progs: dump-super: improve error message on failed read
Add more error information to help debugging:

  $ ./btrfs inspect-internal dump-super -Ffa /dev/vdb10

  Before:
  ERROR: failed to read the superblock on /dev/vdb10 at 274877906944

  After:
  ERROR: failed to read the superblock on /dev/vdb10 at 274877906944 read 0/4096 bytes

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain b51117d68e btrfs-progs: tests: check for btrfs ACL support
Fix failures caused by the lack of ACL support in btrfs. For example:

  $ make test
    ::
    [TEST/misc]   057-btrfstune-free-space-tree
    failed: setfacl -m u:root:x /Volumes/ws/btrfs-progs/tests/mnt/acls/acls.1
    test failed for case 057-btrfstune-free-space-tree
    make: *** [Makefile:493: test-misc] Error 1

Similar failures occurred in the test cases convert/001-ext2-basic,
convert/003-ext4-basic, convert/005-delete-all-rollback, and
convert/006-large-hole-extent.

Resolve it by adding a check for ACL support using the
check_kernel_support_acl() helper function. It gracefully handles the case
when ACL support is not compiled by calling _not_run().

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain 1fb1ae8ebb btrfs-progs: tests: add helper to check if ACLs are supported
Some test cases are failing when ACL is not compiled in the system.
Instead, they should be marked as 'not_run'.

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain d52686fc2a btrfs-progs: tests: move delete_subvol_children under HAVE_BTRFSUTIL_H fsstress.c
Bring the  'delete_subvol_children' function under the HAVE_BTRFSUTIL_H
define and fix the following warnings. This function is called only when
'HAVE_BTRFSUTILS_H' is defined.

tests/fsstress.c:1183:1: warning: ‘delete_subvol_children’ defined but not used [-Wunused-function]
 1183 | delete_subvol_children(int parid

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain b31f1e6988 btrfs-progs: tests: move do_fallocate under HAVE_LINUX_FALLOC_H in fsstress.c
Move the entire 'do_fallocate' function under the 'HAVE_LINUX_FALLOC_H'
define and fix the following warnings. This function is called only when
'HAVE_LINUX_FALLOC_H' is defined.

tests/fsstress.c:3814:1: warning: ‘do_fallocate’ defined but not used [-Wunused-function]
 3814 | do_fallocate(opnum_t opno, long r, int mode)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain 282c05698a btrfs-progs: tests: move do_mmap under HAVE_SYS_MMAN_H in fsstress.c
Move the entire 'do_mmap' function under the 'HAVE_SYS_MMAN_H' define
and fix the following warnings. This function is called only when
'HAVE_SYS_MMAN_H' is defined.

tests/fsstress.c:4363:1: warning: ‘do_mmap’ defined but not used [-Wunused-function]
 4363 | do_mmap(opnum_t opno, long r, int prot)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
Anand Jain 3b8a552fd7 btrfs-progs: tests: fix missing prototype warnings in fssum.c
Annoying warnings when running 'make test' from the file tests/fssum.c.
gcc version 8.5.0. Fix the it by declaring the corresponding functions as static.

$ rm fssum
$ make TEST=001\* test-misc
::
tests/fssum.c:86:1: warning: no previous prototype for ‘getln’ [-Wmissing-prototypes]
   86 | getln(char *buf, int size, FILE *fp)
      | ^~~~~
tests/fssum.c:103:1: warning: no previous prototype for ‘parse_flag’ [-Wmissing-prototypes]
  103 | parse_flag(int c)
      | ^~~~~~~~~~
tests/fssum.c:123:1: warning: no previous prototype for ‘parse_flags’ [-Wmissing-prototypes]
  123 | parse_flags(char *p)
      | ^~~~~~~~~~~
tests/fssum.c:130:1: warning: no previous prototype for ‘usage’ [-Wmissing-prototypes]
  130 | usage(void)
      | ^~~~~
tests/fssum.c:163:1: warning: no previous prototype for ‘alloc’ [-Wmissing-prototypes]
  163 | alloc(size_t sz)
      | ^~~~~
tests/fssum.c:176:1: warning: no previous prototype for ‘sum_init’ [-Wmissing-prototypes]
  176 | sum_init(sum_t *cs)
      | ^~~~~~~~
tests/fssum.c:182:1: warning: no previous prototype for ‘sum_fini’ [-Wmissing-prototypes]
  182 | sum_fini(sum_t *cs)
      | ^~~~~~~~
tests/fssum.c:188:1: warning: no previous prototype for ‘sum_add’ [-Wmissing-prototypes]
  188 | sum_add(sum_t *cs, void *buf, int size)
      | ^~~~~~~
tests/fssum.c:194:1: warning: no previous prototype for ‘sum_add_sum’ [-Wmissing-prototypes]
  194 | sum_add_sum(sum_t *dst, sum_t *src)
      | ^~~~~~~~~~~
tests/fssum.c:200:1: warning: no previous prototype for ‘sum_add_u64’ [-Wmissing-prototypes]
  200 | sum_add_u64(sum_t *dst, uint64_t val)
      | ^~~~~~~~~~~
tests/fssum.c:207:1: warning: no previous prototype for ‘sum_add_time’ [-Wmissing-prototypes]
  207 | sum_add_time(sum_t *dst, time_t t)
      | ^~~~~~~~~~~~
tests/fssum.c:213:1: warning: no previous prototype for ‘sum_to_string’ [-Wmissing-prototypes]
  213 | sum_to_string(sum_t *dst)
      | ^~~~~~~~~~~~~
tests/fssum.c:225:1: warning: no previous prototype for ‘namecmp’ [-Wmissing-prototypes]
  225 | namecmp(const void *aa, const void *bb)
      | ^~~~~~~
tests/fssum.c:234:1: warning: no previous prototype for ‘sum_xattrs’ [-Wmissing-prototypes]
  234 | sum_xattrs(int fd, sum_t *dst)
      | ^~~~~~~~~~
tests/fssum.c:325:1: warning: no previous prototype for ‘sum_file_data_permissive’ [-Wmissing-prototypes]
  325 | sum_file_data_permissive(int fd, sum_t *dst)
      | ^~~~~~~~~~~~~~~~~~~~~~~~
tests/fssum.c:341:1: warning: no previous prototype for ‘sum_file_data_strict’ [-Wmissing-prototypes]
  341 | sum_file_data_strict(int fd, sum_t *dst)
      | ^~~~~~~~~~~~~~~~~~~~
tests/fssum.c:369:1: warning: no previous prototype for ‘escape’ [-Wmissing-prototypes]
  369 | escape(char *in)
      | ^~~~~~
tests/fssum.c:389:1: warning: no previous prototype for ‘excess_file’ [-Wmissing-prototypes]
  389 | excess_file(const char *fn)
      | ^~~~~~~~~~~
tests/fssum.c:395:1: warning: no previous prototype for ‘missing_file’ [-Wmissing-prototypes]
  395 | missing_file(const char *fn)
      | ^~~~~~~~~~~~
tests/fssum.c:401:1: warning: no previous prototype for ‘pathcmp’ [-Wmissing-prototypes]
  401 | pathcmp(const char *a, const char *b)
      | ^~~~~~~
tests/fssum.c:419:1: warning: no previous prototype for ‘check_match’ [-Wmissing-prototypes]
  419 | check_match(char *fn, char *local_m, char *remote_m,
      | ^~~~~~~~~~~
tests/fssum.c:438:1: warning: no previous prototype for ‘check_manifest’ [-Wmissing-prototypes]
  438 | check_manifest(char *fn, char *m, char *c, int last_call)
      | ^~~~~~~~~~~~~~
tests/fssum.c:509:1: warning: no previous prototype for ‘sum’ [-Wmissing-prototypes]
  509 | sum(int dirfd, int level, sum_t *dircs, char *path_prefix, char *path_in)
      | ^~~
    [LD]     fsstress
tests/fsstress.c:4363:1: warning: ‘do_mmap’ defined but not used [-Wunused-function]
 4363 | do_mmap(opnum_t opno, long r, int prot)
      | ^~~~~~~
tests/fsstress.c:3814:1: warning: ‘do_fallocate’ defined but not used [-Wunused-function]
 3814 | do_fallocate(opnum_t opno, long r, int mode)
      | ^~~~~~~~~~~~
tests/fsstress.c:1183:1: warning: ‘delete_subvol_children’ defined but not used [-Wunused-function]
 1183 | delete_subvol_children(int parid)

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
David Sterba a0137082de btrfs-progs: docs: formatting updates
- use :file: and :command:
- simplify manual page references
- add more web links
- typo fixes
- more cross-references

Signed-off-by: David Sterba <dsterba@suse.com>
2023-07-26 14:59:10 +02:00
David Sterba 22cf63d8ee btrfs-progs: kernel-shared: add helper write_extent_buffer_chunk_tree_uuid
Sync the helper write_extent_buffer_chunk_tree_uuid from kernel.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-27 23:40:56 +02:00
David Sterba 339de9b2d7 btrfs-progs: kernel-shared: use write_extent_buffer_fsid where possible
We already have the helper but don't use it everywhere.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-27 16:29:58 +02:00
David Sterba f094e35d63 btrfs-progs: kernel-shared: use copy_extent_buffer_full where possible
We already have the helper for full extent buffer copy but don't use it
everywhere.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-27 16:29:54 +02:00
David Sterba 53b64cc366 btrfs-progs: minor source sync with kernel 6.4
Sync a few more file on the source level with kernel 6.4, no functional
changes.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-27 16:15:35 +02:00
David Sterba 2bc4002583 btrfs-progs: docs: update 6.4 kernel development stats
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-26 23:09:47 +02:00
David Sterba 8a59d12c92 btrfs-progs: tests: support starting from a given test
Add make command line variable TEST_FROM that takes a glob from where to
start the test sequence. Update docs and fix some trivial typos.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-21 16:44:30 +02:00
David Sterba 316499ed79 btrfs-progs: fix 6.3.2 change description regarding big endian hosts
The build is fine on BE but endianness was broken which prevents mkfs
and anything else on existing images.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 13:58:43 +02:00
David Sterba 3139c26079 btrfs-progs: ci: run more workflows after pushing master branch
Run release tests after pushing master branch to verify that everything
is ok, also trigger the static build so there are binaries built with
the new version tag.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 13:41:52 +02:00
David Sterba d1d8fb4b59
Btrfs progs v6.3.2
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 13:37:06 +02:00
David Sterba 77988fef38 btrfs-progs: update CHANGES for 6.3.2
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 12:24:48 +02:00
Qu Wenruo c88ac0170b btrfs-progs: scrub: unify the output numbers for "Total to scrub"
[BUG]
Command `btrfs scrub start -B` and `btrfs scrub status` are reporting
very different results for "Total to scrub":

  $ sudo btrfs scrub start -B /mnt/btrfs/
  scrub done for c107ef62-0a5d-4fd7-a119-b88f38b8e084
  Scrub started:    Mon Jun  5 07:54:07 2023
  Status:           finished
  Duration:         0:00:00
  Total to scrub:   1.52GiB
  Rate:             0.00B/s
  Error summary:    no errors found

  $ sudo btrfs scrub status /mnt/btrfs/
  UUID:             c107ef62-0a5d-4fd7-a119-b88f38b8e084
  Scrub started:    Mon Jun  5 07:54:07 2023
  Status:           finished
  Duration:         0:00:00
  Total to scrub:   12.00MiB
  Rate:             0.00B/s
  Error summary:    no errors found

This can be very confusing for end users.

[CAUSE]
It's the function print_fs_stat() handling the "Total to scrub" output.

For `btrfs scrub start` command, we use the used bytes (aka, the total
used dev extents of a device) for output.

This is not really accurate, as the chunks may be mostly empty just like
the following:

  $ btrfs fi df /mnt/btrfs/
  Data, single: total=1.01GiB, used=9.06MiB
  System, DUP: total=40.00MiB, used=64.00KiB
  Metadata, DUP: total=256.00MiB, used=1.38MiB
  GlobalReserve, single: total=22.00MiB, used=0.00B

Thus we're reporting 1.5GiB to scrub (1.01GiB + 40MiB * 2 + 256MiB * 2).
But in reality, we only scrubbed 12MiB
(9.06MiB + 64KiB * 2 + 1.38MiB * 2).

[FIX]
Instead of using the used dev-extent bytes of a device, go with proper
scrubbed bytes for each device.

This involves print_fs_stat() and print_scrub_dev() called inside
scrub_start().

Now the output should match each other.

Issue: #636
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 12:24:48 +02:00
Qu Wenruo af6f301834 btrfs-progs: fix accessors for big endian systems
[BUG]
There is a bug report that on s390x big endian systems, mkfs.btrfs just
fails:

  $ mkfs.btrfs  -f ~/test.img
  btrfs-progs v6.3.1
  Invalid mapping for 1081344-1097728, got 17592186044416-17592190238720
  Couldn't map the block 1081344
  ERROR: cannot read chunk root
  ERROR: open ctree failed

[CAUSE]
The error is caused by wrong endian conversion. The s390x is a big
endian architecture:

  $ lscpu
  Byte Order:            Big Endian

While checking the offending @disk_key and @key inside
btrfs_read_sys_array(), we got:

  2301		while (cur_offset < array_size) {
  (gdb)
  2304			if (cur_offset + len > array_size)
  (gdb)
  2307			btrfs_disk_key_to_cpu(&key, disk_key);
  (gdb)
  2310			sb_array_offset += len;
  (gdb) print *disk_key
  $2 = {objectid = 281474976710656, type = 228 '\344', offset = 17592186044416}
  (gdb) print key
  $3 = {objectid = 281474976710656, type = 228 '\344', offset = 17592186044416}
  (gdb)

Now we can see, @disk_key is indeed in the little endian, but @key is
not converted to the CPU native endian.

Furthermore, if we step into the help btrfs_disk_key_to_cpu(), it shows
we're using little endian version:

  (gdb) step
  btrfs_disk_key_to_cpu (disk_key=0x109fcdb, cpu_key=0x3ffffff847f)
      at ./kernel-shared/accessors.h:592
  592		memcpy(cpu_key, disk_key, sizeof(struct btrfs_key));

[FIX]
The kernel accessors.h checks if __LITTLE_ENDIAN is defined or not, but
that only works inside kernel.

In user space, __LITTLE_ENDIAN and __BIG_ENDIAN are both provided by
kerncompat.h that should have been included already.

Instead we should check __BYTE_ORDER against __LITTLE_ENDIAN to
determine our endianness.

With this change, s390x build works as expected now.

Issue: #639
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-15 12:24:09 +02:00
Boris Burkov aa49b7cfbb btrfs-progs: docs: discourage seeding remount workflow
The remount workflow could cause some problems so make a note about it.
Recommend the umount/mount step by default. A seeding device used for
e.g. a root filesystem that gets updated and has snapshots is a real
world example where the space consumed by unreclaimed deleted snapshots
would hurt.

Pull-request: #462
Author: Boris Burkov <boris@bur.io>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-09 12:55:13 +02:00
Eideen 1e18750288 btrfs-progs: docs: add balance filter examples
Add more examples and explanations how the filters can be used.

Pull-request: #486
Author: Eideen
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-09 12:44:03 +02:00
Dominique Martinet 9362803539 btrfs-progs: mkfs: make --quiet silence the 5.15 default change NOTE
mkfs.btrfs help message for --quiet is 'no message except errors' so
we probably ought to silence this as well in the quiet case.

Author: Dominique Martinet <dominique.martinet@atmark-techno.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-09 11:57:39 +02:00
Jonathan Liu 055f215525 btrfs-progs: docs: fix 'group' typo in btrfsrune page
Pull-request: #634
Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-09 11:55:53 +02:00
Sam James 3ce3c8638c btrfs-progs: check: add a specific warning in --help for repair
Make it more explicit for the argument.

Pull-request: #635
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-09 11:54:11 +02:00
David Sterba ed9339b403 btrfs-progs: image: convert int to bool in a few helpers
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-08 00:08:35 +02:00
David Sterba d8172c2fbc btrfs-progs: docs: fixups, references
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-01 20:50:04 +02:00
David Sterba 7887e978ba btrfs-progs: docs: reorder versions in Features-by-version
Other pages list the latest version first, do that here as well. Also
reorder index so the features are first before version changelogs.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-01 20:50:04 +02:00
David Sterba 972ea8c8b3 btrfs-progs: docs: updates, formatting, status page
- formatting, typo fixes, corrections
- cross references
- enhancements
- revised and colored status page
- ioctl updates

Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-01 20:49:17 +02:00
Qu Wenruo 99ed2a64d8 btrfs-progs: convert: follow the default free space tree setting
[BUG]
We got some test failures related to btrfs-convert with subpage, e.g.
btrfs/012, the failure would cause the following dmesg:

  BTRFS warning (device nvme0n1p7): v1 space cache is not supported for page size 16384 with sectorsize 4096
  BTRFS error (device nvme0n1p7): open_ctree failed

[CAUSE]
v1 space cache has tons of hard coded PAGE_SIZE usage, and considering
v2 space cache is going to replace it (which is already the new default
since v5.15 btrfs-progs), thus for btrfs subpage support, we just simply
reject the v1 space cache, and utilize v2 space cache when possible.

But there is special catch in btrfs-convert, although we're specifying
v2 space cache as the new default for btrfs-convert, it doesn't really
follow the specification at all.

Thus the converted filesystem will still go v1 space cache.

[FIX]
It can be a huge change to btrfs-convert to make the initial btrfs image
to support v2 cache.

Thus this patch would change the fs at the final stage, just before we
finalize the btrfs.

This patch would drop all the v1 cache created, then call
btrfs_create_free_space_tree() to populate the free space tree and
commit the superblock with needed compat_ro flags.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-01 01:42:03 +02:00
Anand Jain a79cf3b65c btrfs-progs: add CHANGING_FSID_V2 to print-tree
Add the DEF_SUPER_FLAG_ENTRY for CHANGING_FSID_V2 to our btrfs-progs'
print-tree.c, as it is currently missing in the dump-super output, which
was too confusing.

Before:
flags			0x1000000001
			( WRITTEN )

After:
flags			0x1000000001
			( WRITTEN |
			  CHANGING_FSID_V2 )

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-06-01 01:42:00 +02:00
David Sterba 9d2c8c364a
Btrfs progs v6.3.1
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-29 16:53:31 +02:00
David Sterba 5bc1c1f467 btrfs-progs: update CHANGES for 6.3.1
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-29 16:51:29 +02:00
David Sterba ae73e89f28 btrfs-progs: mkfs: more verbose output for --rootdir
Print the source directory for --rootdir and if --shrink is used. With
-vv then print the individual files as added:

  $ mkfs.btrfs --rootdir dir --shrink -vv img
  ...
  Rootdir from:       Documentation
  ADD: /btrfs-progs/Documentation/btrfs-check.rst
  ...
  ADD: /btrfs-progs/Documentation/btrfs-send.rst
    Shrink:           yes
  Label:              (null)
  UUID:               40d3a16f-02d8-40d7-824b-239cee528093
  ...

The 'Rootdir from' is printed before the files are added so there's now
message before the files are added which could take some time.

Issue: #627
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 22:17:33 +02:00
David Sterba 95c1fa1871 btrfs-progs: mkfs: remove redundant variable for source dir
Validity of source dir can be determined by the variable itself, no need
to track it separately.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 22:17:33 +02:00
David Sterba e1eddbeb4c btrfs-progs: build: reuse config/ directory for m4 macros
Move files from m4/ to config that is also used for build and we can
reduce the number of toplevel directories.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 21:08:17 +02:00
Nathan Mills 3c1b96bff7 btrfs-progs: build: fix undefined macro AC_DEFINE
If I run autoreconf -fi in btrfs-progs repo in VirtualBox, it fails with
possibly undefined macro AC_DEFINE. To fix this, I added m4 as the macro
directory in configure.ac as follows. Adding that line fixes the error
when running autoreconf.

  Versions:
  autoreconf 2.69
  automake 1.15.1
  btrfs-progs v6.3-fba31d63
  openSUSE 15.5
  VirtualBox 6.1.40

  configure.ac:7: error: possibly undefined macro: AC_DEFINE
	If this token and others are legitimate, please use m4_pattern_allow.
	See the Autoconf documentation.
  configure.ac:63: error: possibly undefined macro: AC_MSG_ERROR
  configure.ac:276: error: possibly undefined macro: AC_MSG_WARN
  autoreconf: /usr/bin/autoconf failed with exit status: 1

Issue: #632
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 20:36:09 +02:00
David Sterba adfc8a943a btrfs-progs: ci: enable more tests for devel workflow
More complete test coverage:

- json an string table formatters
- fuzz tests (no mount)
- libbtrfs build test
- libbtrfsutil python test
- ioctl build test
- hash tests

Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 19:53:44 +02:00
David Sterba d64d62cce8 btrfs-progs: docs: fix links and update Developer's FAQ
Issue: #628
Signed-off-by: David Sterba <dsterba@suse.com>
2023-05-26 19:03:04 +02:00