Commit Graph

7519 Commits

Author SHA1 Message Date
David Sterba
5ad147c9ec
Btrfs progs v6.14
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-26 20:39:32 +01:00
David Sterba
d8eb2ce584 btrfs-progs: update CHANGES for 6.14
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-26 20:32:02 +01:00
David Sterba
9575844948 btrfs-progs: ci: add configure option build tests
Pre-release build checks are not yet done in the CI, so add a workflow
for that and only for the release-test branch as this usually does not
break and can take a long time due to the number of options (even with
ccache).

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-26 20:32:02 +01:00
David Sterba
05402d22fc btrfs-progs: tests: add more configure option test coverage
Update the build test script with LZO optional build and add combination
of all existing options with the experimental build (this effectively
doubles the number of build runs).

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-26 20:32:02 +01:00
David Sterba
9b5cc554fe btrfs-progs: docs: update Glossary and add it to btrfs(5)
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-26 20:31:58 +01:00
David Sterba
c44f0bea76 btrfs-progs: docs: update 6.14 contribution graphs
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-24 22:05:33 +01:00
David Sterba
c85e177e53 btrfs-progs: docs: add 6.14 kernel development statistics
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-24 22:05:33 +01:00
David Sterba
4ba164d759 btrfs-progs: use new libbtrfsutil API in internal code
The unified naming API of libbtrfsutil is exported in the library, we
should use it in the internal code as well. In the future the old naming
scheme will be deprecated and remove.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-24 22:05:33 +01:00
David Sterba
ecf62d926e btrfs-progs: docs: various fixups and updates
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-24 22:05:32 +01:00
David Sterba
6f307522f3 btrfs-progs: docs: add kernel changelogs for 6.12, 6.13 and 6.14
[ci skip]

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-20 16:47:52 +01:00
Allison Karlitskaya
61543d43e2 btrfs-progs: docs: add FS_IOC_READ_VERITY_METADATA support
As of bfcf6d04f8ee ("btrfs: handle FS_IOC_READ_VERITY_METADATA ioctl")
the kernel supports FS_IOC_READ_VERITY_METADATA for btrfs (6.14).  Add
that to the docs.

Pull-request: #970
Signed-off-by: Allison Karlitskaya <allison.karlitskaya@redhat.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-20 01:25:40 +01:00
David Sterba
4b892f8aaa btrfs-progs: update help texts to better explain global options
There was a question in the mailing list regarding option --quiet and
why it's not working as 'btrfs subvolume create --quiet ...'.
Historically there were per-command verbosity options but this was
unified under the global options with it's specific syntax. This is not
uncommon and e.g. git also does have this option split.

The documentation and help strings are not making this clear enough, so
print syntax examples at the end of the help of 'btrfs', and do other
adjustments.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-20 01:17:48 +01:00
Qu Wenruo
663244e26b btrfs-progs: qgroup show: use sysfs to detect inconsistent state early
Currently if "btrfs qgroup show" detects the qgroup is in an
inconsistent state, it will print a warning:

  WARNING: qgroup data inconsistent, rescan recommended

But the detection is based on the tree search ioctl, and qgroup tree is
only updated at transaction commit time.

This means if qgroup is marked inconsistent, and the transaction is not
commit, there can be a time window as long as 30s before "btrfs qgroup
show" gives a proper warning about inconsistent qgroup numbers.

To address this, use the
'/sys/fs/btrfs/<fsid>/qgroup/inconsistent' file to do extra check.

That file is updated at real time, thus there is no delay, and can give
an early warning about inconsistent qgroup numbers.

Link: https://bugzilla.suse.com/show_bug.cgi?id=1235765
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 23:17:28 +01:00
David Sterba
c7fce0e6ef btrfs-progs: document 2K sector size
Update help text of mkfs and documentation mentioning that 2K size is
allowed in experimental mode.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 23:17:28 +01:00
David Sterba
f033b8cc6c btrfs-progs: tests: update convert/007 to handle 2K block size
The experimental build allows 2K block size so test would unexpectedly
succeed, add the exception.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 23:17:28 +01:00
Qu Wenruo
2ca990c4fc btrfs-progs: convert: check the sectorsize against BTRFS_MIN_BLOCKSIZE
This allows experimental btrfs-convert builds to handle 2K block sized
ext4, which is needed to pass convert related test cases in fstests.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:30:09 +01:00
Qu Wenruo
d421c85ea5 btrfs-progs: mkfs: support 2K block size
Since btrfs only supports block size 4K and PAGE_SIZE, on x86_64 it
means we can not test subpage block size easily.

With the recent kernel change to support 2K block size for debug builds,
also add 2K block size support for btrfs-progs, so that we can do proper
subpage block size testing on x86_64, without acquiring an aarch64
machine.

There is a limitation:

- No support for 2K node size
  The limitation is from the initial mkfs tree root, which can only have
  a single leaf to contain all root items.
  But 2K leaf cannot handle all the root items, thus we have to disable
  it.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:28:03 +01:00
Qu Wenruo
84aa7cc830 btrfs-progs: fix the incorrect buffer size for super block structure
Inside the function btrfs_add_to_fsid(), we allocate a buffer to write
the superblock to disk.

However the buffer size is based on block size, which can cause two
problems:

- 2K block size
  The block size is too small for the super block, and we will write
  beyond the buffer and corrupt the memory.

- 16/64K block size
  The block size will be larger than super block size, this will not
  cause any problem but waste some memory.

Fix the bug by using BTRFS_SUPER_INFO_SIZE as the correct buffer size.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:26:07 +01:00
David Sterba
17b49b9dbd btrfs-progs: ci: update version of tj-actions/changed-files
There was an attack on the changed-files action [1] that is used in the
devel workflow, started only after the branch devel is pushed, currently
possible only by 2 people. There was one run of GH actions that used the
compromised version and only the temporary github tokens (github_token,
system.github.token, with the "ghs_" prefix) were visible in the logs.
Their lifetime is said to be 24hours. No other tokens or secretes were
affected.

As recommended, bump the version to v46. We may reimplement the action
eventually as it's quite simple for our needs.

[1] https://www.ox.security/15-hours-of-open-sourced-hell-lessons-learned-from-tj-actions-changed-files/

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:24:41 +01:00
David Sterba
8f9e86e2a1 btrfs-progs: ci: drop forced exit from docker image updater
Print the warning instead of hard exit when updating source CI docker
images, it will fail for everyone else anyway.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:24:41 +01:00
Anand Jain
1f6877b413 btrfs-progs: resize: remove the misleading warning for the 'max' option
The disk max size cannot be 256MiB because Btrfs does not allow creating
a filesystem on disks smaller than 256MiB.

Remove the incorrect warning for the 'max' option.`

$ btrfs fi resize max /btrfs
Resize device id 1 (/dev/sda) from 3.00GiB to max
WARNING: the new size 0 (0.00B) is < 256MiB, this may be rejected by kernel

Fixes: 158a25af0d ("btrfs-progs: fi resize: warn if new size is < 256M")
Reviewed-by: Dominique Martinet <dominique.martinet@atmark-techno.com>
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-19 22:24:35 +01:00
Daniel Vacek
0cfc20b374 btrfs-progs: defrag: allow passing compression levels
The zlib and zstd compression methods support using compression levels.
Enable defrag to pass them to kernel.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: Daniel Vacek <neelx@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 23:16:24 +01:00
Wang Mingyu
6be1d80a64 btrfs-progs: mkfs: add break to case BTRFS_COMPRESS_NONE
When compression is null the code always goes through the LZO case,
or prints "lzo support not compiled in".

This bug was added by commit c6d24a363d ("btrfs-progs: mkfs: add lzo
to --compress option").

Pull-request: #967
Signed-off-by: Wang Mingyu <wangmy@fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Junxuan
ee53b498d5 libbtrfsutil: update btrfs_util_create_snapshot doc
The alias should be for btrfs_util_subvolume_snapshot instead of
btrfs_util_snapshot_snapshot.

Pull-request: #969
Signed-off-by: Junxuan Liao <ljx@cs.wisc.edu>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Artur Klauser
7e3e89c0cf btrfs-progs: docs: fix typos in documentation
Pull-request: #968
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Noor Christensen
99e6004231 btrfs-progs: docs: expand abbreviations for clarity
Replace the use of IOW as abbreviation of "In other words" with the
original expanded meaning, as users who don't have English as their
first language may not know what it means.

Pull-request: #966
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Naohiro Aota
1e85aa96e1 btrfs-progs: zoned: fix alloc_offset calculation for partly conventional block groups
When one of two zones composing a DUP block group is a conventional zone, we
have the zone_info[i]->alloc_offset = WP_CONVENTIONAL. That will, of course,
not match the write pointer of the other zone, and fails that block group.

This commit solves that issue by properly recovering the emulated write pointer
from the last allocated extent. The offset for the SINGLE, DUP, and RAID1 are
straight-forward: it is same as the end of last allocated extent. The RAID0 and
RAID10 are a bit tricky that we need to do the math of striping.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Naohiro Aota
5042af1c4f btrfs-progs: zoned: implement RAID10 zone info loading
Just same as the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Naohiro Aota
915e15da2e btrfs-progs: zoned: implement RAID0 zone info loading
Implement it just like the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Naohiro Aota
03a70d0a9f btrfs-progs: zoned: implement RAID1 zone info loading
Implement it just like the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:10 +01:00
Naohiro Aota
8a04df97cc btrfs-progs: zoned: implement DUP zone info loading
DUP support is added like the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
32ad46863c btrfs-progs: zoned: factor out SINGLE zone info loading
Currently, the userland tool only considers the SINGLE profile, which make it
fail when a DUP block group is created over one conventional zone and one
sequential required zone.

Before adding the other profiles support, let's factor out per-profile code
(actually, SINGLE only) into functions just like as the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
3a24570ebd btrfs-progs: zoned: factor out btrfs_load_zone_info()
Now that, we have zone capacity and (basic) zone activeness support. It's time
to factor out btrfs_load_zone_info() as same as the kernel side.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
6936ffa265 btrfs-progs: zoned: activate block group on loading
Introduce "zone_is_active" member to struct btrfs_block_group and activate it
on loading a block group.

Note that activeness check for the extent allocation is currently not
implemented. The activeness checking requires to activate a non-active block
group on the extent allocation, which also require finishing a zone in the case
of hitting the active zone limit. Since mkfs should not hit the limit,
implementing the zone finishing code would not be necessary at the moment.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
936c947728 btrfs-progs: zoned: load zone activeness
Properly load the zone activeness on the userland tool. Also, check if a device
has enough active zone limit to run btrfs.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
be43b47535 btrfs-progs: zoned: support zone capacity
The userland tools did not load and use the zone capacity. Support it properly.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
11fe76f4b7 btrfs-progs: zoned: introduce a zone_info struct in btrfs_load_block_group_zone_info
This is an userland side update to follow kernel-side commit 15c12fcc50a1
("btrfs: zoned: introduce a zone_info struct in
btrfs_load_block_group_zone_info"). This will make the code unification easier.

This commit introduces zone_info structure to hold per-zone information in
btrfs_load_block_group_zone_info.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Naohiro Aota
e9d0e003ab btrfs-progs: kerncompat: introduce min_not_zero()
Introduce min_not_zero() macro from the kernel.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
David Sterba
ce509fb738 btrfs-progs: ci: enable experimental build on devel and pull workflows
Some tests in mkfs or misc require the experimental build. Enable it on
the development workflows. Build coverage with or without experimental
build is covered by the CI image build tests.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
David Sterba
23e222bc81 btrfs-progs: check: use on-stack ulist for squota extent accounting
Commit 5bd97022f3 ("btrfs-progs: check: add support for squota")
does ulist node allocation but this leaks on any error before the final
accounting. As it's freed right after that we can use on-stack variable
for that.

This was reported by 067-btrfstune-simple-quota with enabled ASAN with
enabled experimental features.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
David Sterba
b75949044b btrfs-progs: tests: add case for recursive subvolume deletion printing child subvolumes
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Sidong Yang
94fee22114 btrfs-progs: subvol delete: show nested subvolumes during recursive delete
When a subvolume is deleted with the recursive option, any nested
subvolumes also get removed without reporting it. Update the subvolume
delete command to print the list of nested subvolumes.

Issue: #923
Signed-off-by: Sidong Yang <realwakka@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Sebastian Pucilowski
fdb81b170b btrfs-progs: mkfs: fix typo in default-ro help text
Fix a option typo in the mkfs help (`mkfs.btrfs -h`) introduced in the
most recent public release: `defalut-ro` instead of `default-ro`.

Pull-request: #958
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Racz Zoltan
ed8b167de9 btrfs-progs: add duration format to fmt_print
Add "duration" format in seconds to fmt_print which will convert the
input to one of the following strings:

1. if number of seconds represents more than one day, the output will be
   for example: "1 days 01:30:00" (left the plural so parsing back the
   string is easier)
2. if less then a day: "23:30:10"

Author: Racz Zoltan <racz.zoli@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
Qu Wenruo
0416dafaea btrfs-progs: docs: add an extra note to btrfs data checksum and directIO
In v6.14 kernel release, btrfs will force a direct IO to fall back to
a buffered one if the inode requires a data checksum.

This will cause a small performance drop, to solve the false data
checksum mismatch problem caused by direct IOs.

Although such a change is small to most end users, for those requiring
such a zero-copy direct IO this will be a behavior change, and this
requires a proper documentation update.

Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
2025-03-11 22:15:09 +01:00
David Sterba
46b3318556 libbtrfsutil: python: also add version.py to the packaged files
Commit 83bd999c3e ("libbtrfsutil: python: use version from primary
VERSION file") still does not fix all packaging problems. The release
build does not see the file.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-03-11 22:15:09 +01:00
David Sterba
26e4d9174c
Btrfs progs v6.13
Signed-off-by: David Sterba <dsterba@suse.com>
2025-02-15 00:18:32 +01:00
David Sterba
b1eef5de06 btrfs-progs: update CHANGES for 6.13
Signed-off-by: David Sterba <dsterba@suse.com>
2025-02-15 00:16:14 +01:00
David Sterba
83bd999c3e libbtrfsutil: python: use version from primary VERSION file
The version file of the python subpackage had to have the version set
manually in setup.py due to the out-of-tree build where it was not
possible to access the file VERSION. Manual update was error prone.

Improve that by adding a separate file template that is finalized with
the version during the configure phase. Then it's inclded in setup.py as
it's in the same directory.

There are two exceptions when the file is not required to run setup.py:

- clean - allow running 'make clean' in partially configured directory
- (no arguments) - show the help and commands

In all other cases the file version.py must exist.

Signed-off-by: David Sterba <dsterba@suse.com>
2025-02-15 00:08:32 +01:00
David Sterba
6cf93a2504 btrfs-progs: ci: enable extended security CodeQL queries
Signed-off-by: David Sterba <dsterba@suse.com>
2025-02-15 00:08:32 +01:00