Commit graph

6966 commits

Author SHA1 Message Date
David Sterba 335116e359 btrfs-progs: ci: update image management scripts
Add new script to upload updated images to my docker hub, add comments
in which order.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-26 05:52:33 +01:00
David Sterba a42b07077f
Btrfs progs v6.7
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-22 20:00:25 +01:00
David Sterba bfab48178b btrfs-progs: update CHANGES for 6.7
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-22 19:59:33 +01:00
David Sterba d6a31c522a btrfs-progs: ci: extend pattern for branches picked by devel workflow
Add a possibility to test branches independent of devel, the pattern is
prefix "ci/" or "CI/".

[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-22 17:45:35 +01:00
David Sterba d7be6ed156 btrfs-progs: docs: mkfs and sectorsize updates
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:44:58 +01:00
Neal Gompa e3232c2abb btrfs-progs: mkfs: make 4k sectorsize default
We have had working subpage support in Btrfs for many cycles now.
Generally, we do not want people creating filesystems by default
with non-4k sectorsizes since it creates portability problems.

As the subpage has stabilized it seems to be safe to do the switch.
This may still affect users that relying on the previous behaviour.

Issue: #604
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
Signed-off-by: Neal Gompa <neal@gompa.dev>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:37:45 +01:00
Goffredo Baroncelli fdf7f35d3e btrfs-progs: fi usage: wrong values in case of raid56 and not root
In case of a raid5/6 filesystem 'btrfs fi us' returns wrong values
without the root capabilities:

  $ sudo btrfs fi us /tmp/raid5fs  # as root
  Overall:
      Device size:                   3.00GiB
      Device allocated:              1.51GiB		<--- OK
      Device unallocated:            1.49GiB		<--- OK
      Device missing:                  0.00B
      Device slack:                    0.00B
      Used:                        769.03MiB		<--- OK
      Free (estimated):              1.32GiB      (min: 1.32GiB) <-OK
      Free (statfs, df):             1.32GiB
      Data ratio:                       1.50		<--- OK
      Metadata ratio:                   1.50		<--- OK
      Global reserve:                5.50MiB      (used: 0.00B)
      Multiple profiles:                  no
  [...]

  $ btrfs fi us /tmp/raid5fs      # as user
  WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root
  Overall:
      Device size:                   3.00GiB
      Device allocated:                0.00B		<--- WRONG
      Device unallocated:            3.00GiB		<--- WRONG
      Device missing:                  0.00B
      Device slack:                    0.00B
      Used:                            0.00B		<--- WRONG
      Free (estimated):                0.00B      (min: 8.00EiB) <- WRONG
      Free (statfs, df):             1.32GiB
      Data ratio:                       0.00		<--- WRONG
      Metadata ratio:                   0.00		<--- WRONG
      Global reserve:                5.50MiB      (used: 0.00B)
      Multiple profiles:                  no
  [...]

The reason is that the BTRFS_IOC_SPACE_INFO ioctl doesn't return enough
information. To bypass it a scan of the chunks is required when a
raid5/6 profile is present.

To avoid providing wrong information, in case of a raid5/6 filesystem
without the root capabilities the "btrfs fi us" is not executed at all
and a warning with a suggestion to run it as root is printed.

  $ ./btrfs fi us /tmp/t/
  WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root
  WARNING: due to the presence of a raid5/raid6 profile, we cannots compute some values;
  WARNING: run as root instead.

Signed-off-by: Goffredo Baroncelli <kreijack@libero.it>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:14:23 +01:00
Goffredo Baroncelli c653596cff btrfs-progs: dev usage: don't print incorrect unallocated data
If "btrfs dev us" is invoked by a not root user, it is impossible to
collect the chunk info data (not enough privileges). This causes
"btrfs dev us" to print as "Unallocated" value the size of the disk.

This patch handles the case where print_device_chunks() is invoked
without the chunk info data, printing "Unallocated N/A":

Before the patch:

  $ btrfs dev us t/
  WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root
  /dev/loop0, ID: 1
     Device size:             5.00GiB
     Device slack:              0.00B
     Unallocated:             5.00GiB  <-- Wrong

  $ sudo btrfs dev us t/
  [sudo] password for ghigo:
  /dev/loop0, ID: 1
     Device size:             5.00GiB
     Device slack:              0.00B
     Data,single:             8.00MiB
     Metadata,DUP:          512.00MiB
     System,DUP:             16.00MiB
     Unallocated:             4.48GiB  <-- Correct

After the patch:

  $ ./btrfs dev us /tmp/t/
  WARNING: cannot read detailed chunk info, per-device usage will not be shown, run as root
  /dev/loop0, ID: 1
     Device size:             5.00GiB
     Device slack:              0.00B
     Unallocated:                 N/A

  $ sudo ./btrfs dev us /tmp/t/
  [sudo] password for ghigo:
  /dev/loop0, ID: 1
     Device size:             5.00GiB
     Device slack:              0.00B
     Data,single:             8.00MiB
     Metadata,DUP:          512.00MiB
     System,DUP:             16.00MiB
     Unallocated:             4.48GiB

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Goffredo Baroncelli <kreijack@libero.it>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:14:23 +01:00
Qu Wenruo 389c959d6d btrfs-progs: implement arg_strtou64_with_suffix() with a new helper
This patch introduces a new parser helper, parse_u64_with_suffix(),
which has a better error handling, following all the parse_*()
helpers to return non-zero value for errors.

This new helper is going to replace parse_size_from_string(), which
would directly call exit(1) to stop the whole program.

Furthermore most callers of parse_size_from_string() are expecting
exit(1) for error, so that they can skip the error handling.

For those call sites, introduce a wrapper, arg_strtou64_with_suffix(),
to do that.  The only disadvantage is a little less detailed error
report for why the parse failed, but for most cases the generic error
string should be enough.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:14:23 +01:00
Qu Wenruo 8f8d94b8c9 btrfs-progs: use parse_u64() to implement arg_strtou64()
Both functions are just doing the same thing, the only difference is
only in error handling, as parse_u64() requires callers to handle it,
meanwhile arg_strtou64() would call exit(1).

This patch would convert arg_strtou64() to utilize parse_u64(), and use
the return value to output different error messages.

This also means the return value of parse_u64() would be more than just
0 or 1, but -EINVAL for invalid string (including no numeric string at
all, has any tailing characters, or minus value), and -ERANGE for
overflow.

The existing callers are only checking if the return value is 0, thus
not really affected.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-18 02:09:07 +01:00
David Sterba 2608354dc3 btrfs-progs: ci: temporarily disable Tumbleweed crypto backend test
The CI test uses openssl 3.2 but it still hasn't made it to Tumbleweed,
it's still waiting in the queue. It'll be enabled again.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 20:20:57 +01:00
David Sterba 54b2e4b6e7 btrfs-progs: tests: enable ntfs2btrfs conversion
Enhance the conversion macro to recognize the filesystem type in case
the ntfs-specific converter utility has to be used. Its current feature
set does not match btrfs-convert.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 17:42:50 +01:00
David Sterba 2b16f7d4ad btrfs-progs: tests: enable convet tests again in devel and coverage
The convert tests weren't enabled in the CI due to some problems that
seem to be fixed now. Add it to the default and coverage workflows, the
run time is about 2 minutes which is acceptable for coverage and for
devel it's running in parallel.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 03:28:14 +01:00
David Sterba bbf5a3f72c btrfs-progs: tests: fix 022-reiserfs-parent-ref setup
The test does not pass in environments where /bin/sh is not bash (like
github CI). Unify the initial setup like the other tests do: source,
compatibility, prerequisities, the rest.

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 03:21:19 +01:00
Qu Wenruo 517ba2d9e5 btrfs-progs: convert: insert a dummy inode item before inode ref for ext2/4
[BUG]
There is a report about failed btrfs-convert, which shows the following
error:

  Create btrfs metadata
  corrupt leaf: root=5 block=5001931145216 slot=1 ino=89911763, invalid previous key objectid, have 89911762 expect 89911763
  leaf 5001931145216 items 336 free space 7 generation 90 owner FS_TREE
  leaf 5001931145216 flags 0x1(WRITTEN) backref revision 1
  fs uuid 8b69f018-37c3-4b30-b859-42ccfcbe2449
  chunk uuid 448ce78c-ea41-49f6-99dc-46ad80b93da9
          item 0 key (89911762 INODE_REF 3858733) itemoff 16222 itemsize 61
                  index 171 namelen 51 name: [FILENAME1]
          item 1 key (89911763 INODE_REF 3858733) itemoff 16161 itemsize 61
                  index 103 namelen 51 name: [FILENAME2]

[CAUSE]
When iterating a directory, btrfs-convert would insert the DIR_ITEMs,
along with the INODE_REF of that inode.

This leads to above stray INODE_REFs, and trigger the tree-checker.

This can only happen for large fs, as for most cases we have all these
modified tree blocks cached, thus tree-checker won't be triggered.
But when the tree block cache is not hit, and we have to read from disk,
then such behavior can lead to above tree-checker error.

[FIX]
Insert a dummy INODE_ITEM for the INODE_REF first, the inode items would
be updated when iterating the child inode of the directory.

Issue: #731
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-17 01:47:39 +01:00
Qu Wenruo 04f3efaa0d btrfs-progs: tests: enable strict chunk alignment check
The strict check is enabled for both check_image() and
convert_test_do_convert() to detect chunk alignment related problems.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-16 19:15:15 +01:00
Qu Wenruo 6dfc69104b btrfs-progs: add extra chunk alignment checks
Recently we had a scrub use-after-free caused by unaligned chunk
length, although the fix was submitted, we may want to do extra checks
for a chunk's alignment.

This patch adds such check for the starting bytenr and length of a
chunk, to make sure they are properly aligned to 64K stripe boundary.

By default, the check only leads to a warning but is not treated as an
error, as we expect kernel to handle such unalignment without any
problem.

But if the new debug environmental variable,
BTRFS_PROGS_DEBUG_STRICT_CHUNK_ALIGNMENT, is specified, then we will
treat it as an error.  So that we can detect unexpected chunks from
btrfs-progs, and fix them before reaching the end users.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-16 19:14:37 +01:00
Qu Wenruo 136c58617c btrfs-progs: convert: make sure the length of data chunks are also stripe aligned
Although kernel scrub code has been updated to handle the unaligned
chunk length, there is also no harm if we can allocate data chunk with
both start and length aligned.

This patch handles this by rounding up the end bytenr when allocating
data chunks for the conversion.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-16 19:11:54 +01:00
Jonas Malaco 1d37d3ef91 btrfs-progs: scrub start: consider the lowest non-zero limit
On multi-device filesystems, a scrub limit may be applied to any of the
devices. Ensure that any limit found is not disregarded.

Since it's more intuitive, keep the lowest non-zero limit found, even
though at the present we don't actually use the exact value.

Pull-request: #733
Issue: #727
Fixes: 7e4a235df1 ("btrfs-progs: scrub status: print device speed limit in status if set")
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-15 17:07:22 +01:00
Jonas Malaco 96011debe4 btrfs-progs: scrub status: consider the lowest non-zero limit
On multi-device filesystems, a scrub limit may be applied to any of the
devices. Ensure that any limit found is not disregarded.

Since it's more intuitive, keep the lowest non-zero limit found, even
though at the present we don't actually use the exact value.

Pull-request: #733
Issue: #727
Fixes: 7e4a235df1 ("btrfs-progs: scrub status: print device speed limit in status if set")
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-15 17:07:22 +01:00
Jonas Malaco 8bca55d1e7 btrfs-progs: scrub status: only report limits if at least one exists
On multi-device filesystems, scrub status should report "some limits
set" if at least one device has a scrub limit set.

However, with btrfs-progs 6.6.3, this was being reported regardless of
whether any limit actually being set:

    # sudo btrfs scrub limit /more/butter
    UUID: 989129d9-c96f-4d52-9d68-cbb6d9b2c499
    Id  Limit       Path
    --  -----  ---------
     1      -  /dev/sdc1
     2      -  /dev/sdd1

    # sudo btrfs scrub status /more/butter/
    UUID:             989129d9-c96f-4d52-9d68-cbb6d9b2c499
    Scrub started:    Mon Jan 15 02:00:30 2024
    Status:           running
    Duration:         6:23:19
    Time left:        0:49:08
    ETA:              Mon Jan 15 09:12:57 2024
    Total to scrub:   9.83TiB
    Bytes scrubbed:   8.72TiB  (88.64%)
    Rate:             397.47MiB/s (some device limits set)
    Error summary:    no errors found

Fix it by only setting `limit` to the special marker value 1 if at least
one actual limit is found.

Pull-request: #733
Issue: #727
Fixes: 7e4a235df1 ("btrfs-progs: scrub status: print device speed limit in status if set")
Signed-off-by: Jonas Malaco <jonas@protocubo.io>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-15 17:07:19 +01:00
Qu Wenruo 631ee66639 btrfs-progs: convert: for ext2, fix possible tree-checker error when converting a large fs
[BUG]
There is a report about failed btrfs-convert, which shows the following
error:

  corrupt leaf: root=5 block=5001928998912 slot=1 ino=89911763, invalid previous key objectid, have 89911762 expect 89911763
  ERROR: failed to copy ext2 inode 89911320: -5
  ERROR: error during copy_inodes -5
  WARNING: error during conversion, the original filesystem is not modified

[CAUSE]
Above error is triggered when checking the following items inside a
subvolume:

- inode ref
- dir item/index
- file extent
- xattr

This is to make sure these items have correct previous key.

However btrfs-convert is not following this requirement, it always
inserts those items first, then creates a btrfs_inode for it.

Thus it can lead to the error.

This can only happen for large fs, as for most cases we have all these
modified tree blocks cached, thus tree-checker won't be triggered.
But when the tree block cache is not hit, and we have to read from disk,
then such behavior can lead to above tree-checker error.

[FIX]
Make sure we insert the inode item first, then the file extents/dir
items/xattrs.  And after the file extents/dir items/xattrs inserted, we
update the existing inode (to update its size and bytes).

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-12 16:36:36 +01:00
Qu Wenruo 94ace90508 btrfs-progs: tree-checker: dump the tree block when hitting an error
Unlike kernel where tree-checker would provide enough info so later we
can use "btrfs inspect dump-tree" to catch the offending tree block, in
progs we may not even have a btrfs to start "btrfs inspect dump-tree".
E.g during btrfs-convert.

To make later debuging easier, let's call btrfs_print_tree() for every
error we hit inside tree-checker.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-12 16:34:44 +01:00
Anand Jain 8049446bb0 btrfs-progs: docs: placeholder for contents.rst file on older sphinx version
Older versions of sphinx require the contents.rst file otherwise the
build fails, while new versions don't need it and use index.rst.

Sphinx error:

master file btrfs-progs/Documentation/contents.rst not found
make[1]: *** [Makefile:37: man] Error 2
make: *** [Makefile:502: build-Documentation] Error 2

This build error is seen on version 1.7.6-3.

To make it work on old and new versions create a placeholder empty file
but make it a phony build target so new sphinx does not see it and
report as not in any TOC.

[ci skip]

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-11 17:04:48 +01:00
Anand Jain 2b3d95519e btrfs-progs: docs: fix sphinx code-block warnings
There are several warnings regarding the absence of an argument for the
code-block directive on some build servers using python3-sphinx 0.2.2-17.

For example:

Making all in Documentation
    [SPHINX] man
ch-subvolume-intro.rst:141: WARNING: Error in "code-block" directive:
1 argument(s) required, 0 supplied.

.. code-block::

   27 21 0:19 /subv1 /mnt rw,relatime - btrfs /dev/sda rw,space_cache

 Etc...

Add the none argument.

[ci skip]

Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-10 22:49:06 +01:00
Qu Wenruo dbd175734a btrfs-progs: cli-tests: add test case for return value of "btrfs subvlume create"
The test case would check if "btrfs subvolume create":

- Report error on an existing path
- Still report error if mulitple paths are given and one of them already
  exists
- For above case, still created a subvolume for the good parameter

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-10 16:31:39 +01:00
Qu Wenruo 3f988c9176 btrfs-progs: subvolume: fix return value when the target exists
[BUG]
When try to create a subvolume where the target path already exists, the
"btrfs" command doesn't return error code correctly.

  # mkfs.btrfs -f $dev
  # mount $dev $mnt
  # touch $mnt/subv1
  # btrfs subvolume create $mnt/subv1
  ERROR: target path already exists: $mnt/subv1
  # echo $?
  0

[CAUSE]
The check on whether target exists is done by path_is_dir(), if it
returns 0 or 1, it means there is something in that path already.

But unfortunately commit 5aa959fb34 ("btrfs-progs: subvolume create:
accept multiple arguments") only changed the out label, which would
directly return @ret, not updating the return value correctly.

[FIX]
Make sure all error out branch has their @ret manually updated.

Fixes: 5aa959fb34 ("btrfs-progs: subvolume create: accept multiple arguments")
Issue: #730
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-10 04:16:13 +01:00
David Sterba faa75347f6 btrfs-progs: docs: update status
Bump version, all the new features in 6.7 have been already added.

[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-09 17:00:39 +01:00
David Sterba 228848aabe btrfs-progs: docs: add 6.7 kernel development statistics
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-09 16:53:17 +01:00
Sam James 46101b0137 btrfs-progs: build: use AS_IF for target_cpu condition
The autoconf manual recommends AS_IF [1] nowadays rather than bare shell
if tests as they can interfere with quoting and macro expansion.

[1] https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/autoconf.html#index-AS_005fIF-1

Pull-request: #721
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-04 18:43:05 +01:00
Sam James a79560163c btrfs-progs: build: fix bashism in target_cpu comparison
The "=" operator should be used as configure may be run by a POSIX shell
at /bin/sh (like dash). Bash recognises "=" too so this retains
compatibility with it.

Pull-request: #721
Signed-off-by: Sam James <sam@gentoo.org>
Signed-off-by: David Sterba <dsterba@suse.com>
2024-01-04 18:43:02 +01:00
David Sterba 92e18dbce5
Btrfs progs v6.6.3
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-14 15:27:36 +01:00
David Sterba d11bd4cb6a btrfs-progs: update CHANGES for 6.6.3
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-14 15:26:13 +01:00
David Sterba eaa54973b6 btrfs-progs: scrub limit: add option to apply the limit to all devices
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:57:29 +01:00
David Sterba 30d1a2d390 btrfs-progs: scrub limit: allow to set the limit
Add new options to set the per-device limit (requires root privileges as
it writes to the sysfs files).

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:57:27 +01:00
David Sterba 87dba20daf btrfs-progs: change all sysfs helpers to return errno
To be consistent with the rest of the code the sysfs helper should
return the -errno instead of passing -1 from various syscalls. Update
callers that relied on -1 as the invalid file descriptor.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba 4576029dfd btrfs-progs: add write helpers for sysfs files
Add convenience wrappers for writing a buffer or u64 to toplevel or FSID
file in sysfs.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Disseldorp b3b38751e9 btrfs-progs: scrub status: improve Rate reporting for sub-second durations
Scrubs which complete in under one second may carry a duration rounded
down to zero. This subsequently results in a bytes_per_sec value of
zero, which corresponds to the Rate metric output, causing intermittent
tests/btrfs/282 failures.

This change ensures that Rate reflects any sub-second bytes processed.
Time left and ETA metrics are also affected by this change, in that they
increase to account for (sub-second) bytes_per_sec.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba 7f869161b7 btrfs-progs: docs: update scrub io limiting
[ci skip]

Issue: #402
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba 9a044fa0ff btrfs-progs: scrub start: print device limit if set
Print one message per scrubbed device and also print the limit if set:

  $ btrfs scrub start /mnt
  scrub started on /mnt, fsid 9ee93131-f680-4d6c-8ca4-a194506e3081 (pid=27257)
  Starting scrub on devid 1 (limit 100.00MiB/s)

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba 6e96df640b btrfs-progs: tests: add case for scrub limit
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba fbf211459a btrfs-progs: srcub: new subcommand limit
Add new command to read the scrub limits set via the sysfs file (no root
access needed).

Example output:

  $ btrfs scrub limit /mnt
  UUID: 57a05502-9e81-4b21-ad9d-0fc31863ed11
  Id  Limit            Path
  --  -----  --------------
   1      -  /dev/nvme0n1p1
   2      -  /dev/nvme0n1p2
   3      -  /dev/nvme0n1p3
   4      -  /dev/nvme2n1p4
   5      -  /dev/nvme0n1p5
   6      -  /dev/nvme0n1p6

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-09 01:17:22 +01:00
David Sterba deffef9cec btrfs-progs: README: add compatibility
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-08 17:08:55 +01:00
David Sterba b5909e62b2 btrfs-progs: use statvfs() in print_filesystem_usage_overall
The statfs(2) syscall is deprecated by LSB in favor of statvfs(2),
however we can't replace all uses because we still need the
statfs::f_type to determine the filesystem by magic numer.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-08 17:08:55 +01:00
David Sterba 71ad6f2f53 btrfs-progs: subvol sync: check if the filesystem is writable
The subvolume cleaning is done by polling but it's possible that the
filesystem turns to read-only (as reported), either due to an error
intentionally. In that case the waiting would be indefinite without an
obvious reason.

To fix that check if the filesystem is still writable in each iteration.

Issue: #535
Link: https://github.com/btrfs/fstests/issues/40
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-08 17:08:55 +01:00
David Sterba 7e4a235df1 btrfs-progs: scrub status: print device speed limit in status if set
When there's a speed limit set for a device via
/sysfs/fs/btrfs/FSID/devinfo/scrub_speed_max, show it in the scrub status
output like below:

  $ btrfs scrub status -d /mnt
  ...
  Rate:              47.98MiB/s (limit 60MiB/s)
  ...

If the limit is 0 this means unlimited and is not printed.

For a single device filesystem the limit is printed even without '-d' as
it's clear which device limit applies. For multi-device filesysetms,
without any limits nothing is printed, if there at least one device
limit set then the following is printed:

  Rate:             36.37MiB/s (some device limits set)

More details with the -d option.

Issue: #531
Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-08 17:08:33 +01:00
David Sterba f8711016eb btrfs-progs: receive: properly report lack of zstd support
If zstd is not compiled in then a stream fails with a generic error
message:

ERROR: unknown compression: 2

Where BTRFS_ENCODED_IO_COMPRESSION_ZSTD is 2 and there's a case for that
but behind the '#if COMPRESSION_ZSTD'.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-07 14:29:54 +01:00
David Sterba 9aafb384cb btrfs-progs: docs: cross references, ioctl updates
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-06 17:44:28 +01:00
David Sterba 478a295b00 btrfs-progs: docs: document label ioctls
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-06 17:44:28 +01:00
David Sterba f9ebee6838 btrfs-progs: ci: install RTD sphinx theme for devel workflow
With the recent updates to documentation build the theme must be now
installed as a package. Disable building documentation in all workflows
that do functional tests.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-12-06 16:03:37 +01:00