Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package btrfsprogs for openSUSE:Factory checked in at 2023-01-29 14:10:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/btrfsprogs (Old) and /work/SRC/openSUSE:Factory/.btrfsprogs.new.32243 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "btrfsprogs" Sun Jan 29 14:10:37 2023 rev:137 rq:1061779 version:6.1.3 Changes: -------- --- /work/SRC/openSUSE:Factory/btrfsprogs/btrfsprogs.changes 2023-01-07 17:16:48.233114147 +0100 +++ /work/SRC/openSUSE:Factory/.btrfsprogs.new.32243/btrfsprogs.changes 2023-01-29 14:26:40.540197064 +0100 @@ -1,0 +2,8 @@ +Sat Jan 28 18:29:53 UTC 2023 - Dirk Müller <dmuel...@suse.com> + +- update to 6.1.3: + * fi mkswapfile: fix setting size + * mkfs: check zoned support of libblkid + * check: improve error messages for mismatched references + +------------------------------------------------------------------- Old: ---- btrfs-progs-v6.1.2.tar.gz btrfs-progs-v6.1.2.tar.sign New: ---- btrfs-progs-v6.1.3.tar.gz btrfs-progs-v6.1.3.tar.sign ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ btrfsprogs.spec ++++++ --- /var/tmp/diff_new_pack.hU5gP3/_old 2023-01-29 14:26:41.092200114 +0100 +++ /var/tmp/diff_new_pack.hU5gP3/_new 2023-01-29 14:26:41.096200137 +0100 @@ -34,7 +34,7 @@ %define _dracutmodulesdir %(pkg-config --variable dracutmodulesdir dracut) Name: btrfsprogs -Version: 6.1.2 +Version: 6.1.3 Release: 0 Summary: Utilities for the Btrfs filesystem License: GPL-2.0-only ++++++ btrfs-progs-v6.1.2.tar.gz -> btrfs-progs-v6.1.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/CHANGES new/btrfs-progs-v6.1.3/CHANGES --- old/btrfs-progs-v6.1.2/CHANGES 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/CHANGES 2023-01-25 19:39:27.000000000 +0100 @@ -25,6 +25,15 @@ """""""""""""""""""""""""""""" * revert libbtrfs changes to v6.0.2, fix remaining build problems +btrfs-progs-6.1.3 (2023-01-25) +"""""""""""""""""""""""""""""" + * fi mkswapfile: fix setting size + * mkfs: check zoned support of libblkid + * check: improve error messages for mismatched references + * other: + * pass CFLAGS to static build + * documentation updates + btrfs-progs-6.0 (2022-10-11) ---------------------------- * fi usage: in tabular output, print total size and slack size diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/btrfs-filesystem.rst new/btrfs-progs-v6.1.3/Documentation/btrfs-filesystem.rst --- old/btrfs-progs-v6.1.2/Documentation/btrfs-filesystem.rst 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/btrfs-filesystem.rst 2023-01-25 19:39:27.000000000 +0100 @@ -190,7 +190,7 @@ mkswapfile [-s size] file Create a new file that's suitable and formatted as a swapfile. Default - size is 2GiB, minimum size is 40KiB. + size is 2GiB, fixed page size 4KiB, minimum size is 40KiB. A swapfile must be created in a specific way: NOCOW and preallocated. Subvolume containing a swapfile cannot be snapshotted and blocks of an @@ -200,6 +200,10 @@ needs to be done by command ``swapon(8)``. See also command ``btrfs inspect-internal map-swapfile`` and the :doc:`Swapfile feature<Swapfile>` description. + .. note:: + The command is a simplified version of 'mkswap', if you want to set + label, page size, or other parameters please use 'mkswap' proper. + ``Options`` -s|--size SIZE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/btrfs-ioctl.rst new/btrfs-progs-v6.1.3/Documentation/btrfs-ioctl.rst --- old/btrfs-progs-v6.1.2/Documentation/btrfs-ioctl.rst 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/btrfs-ioctl.rst 2023-01-25 19:39:27.000000000 +0100 @@ -41,7 +41,68 @@ }; __u64 unused[4]; }; - char name[BTRFS_SUBVOL_NAME_MAX + 1]; + union { + char name[BTRFS_SUBVOL_NAME_MAX + 1]; + __u64 devid; + __u64 subvolid; + }; + }; + +.. code-block:: + + struct btrfs_ioctl_get_subvol_info_args { + /* Id of this subvolume */ + __u64 treeid; + + /* Name of this subvolume, used to get the real name at mount point */ + char name[BTRFS_VOL_NAME_MAX + 1]; + + /* + * Id of the subvolume which contains this subvolume. + * Zero for top-level subvolume or a deleted subvolume. + */ + __u64 parent_id; + + /* + * Inode number of the directory which contains this subvolume. + * Zero for top-level subvolume or a deleted subvolume + */ + __u64 dirid; + + /* Latest transaction id of this subvolume */ + __u64 generation; + + /* Flags of this subvolume */ + __u64 flags; + + /* UUID of this subvolume */ + __u8 uuid[BTRFS_UUID_SIZE]; + + /* + * UUID of the subvolume of which this subvolume is a snapshot. + * All zero for a non-snapshot subvolume. + */ + __u8 parent_uuid[BTRFS_UUID_SIZE]; + + /* + * UUID of the subvolume from which this subvolume was received. + * All zero for non-received subvolume. + */ + __u8 received_uuid[BTRFS_UUID_SIZE]; + + /* Transaction id indicating when change/create/send/receive happened */ + __u64 ctransid; + __u64 otransid; + __u64 stransid; + __u64 rtransid; + /* Time corresponding to c/o/s/rtransid */ + struct btrfs_ioctl_timespec ctime; + struct btrfs_ioctl_timespec otime; + struct btrfs_ioctl_timespec stime; + struct btrfs_ioctl_timespec rtime; + + /* Must be zero */ + __u64 reserved[8]; }; .. code-block:: @@ -111,10 +172,10 @@ * BTRFS_IOC_SPACE_INFO * BTRFS_IOC_START_SYNC * BTRFS_IOC_WAIT_SYNC -* BTRFS_IOC_SNAP_CREATE_V2 +* BTRFS_IOC_SNAP_CREATE_V2 -- create a snapshot of a subvolume * BTRFS_IOC_SUBVOL_CREATE_V2 -- create a subvolume -* BTRFS_IOC_SUBVOL_GETFLAGS -* BTRFS_IOC_SUBVOL_SETFLAGS +* BTRFS_IOC_SUBVOL_GETFLAGS -- get flags of a subvolume +* BTRFS_IOC_SUBVOL_SETFLAGS -- set flags of a subvolume * BTRFS_IOC_SCRUB * BTRFS_IOC_SCRUB_CANCEL * BTRFS_IOC_SCRUB_PROGRESS @@ -143,6 +204,12 @@ * BTRFS_IOC_GET_FEATURES * BTRFS_IOC_SET_FEATURES * BTRFS_IOC_GET_SUPPORTED_FEATURES +* BTRFS_IOC_RM_DEV_V2 +* BTRFS_IOC_LOGICAL_INO_V2 +* BTRFS_IOC_GET_SUBVOL_INFO -- get information about a subvolume +* BTRFS_IOC_GET_SUBVOL_ROOTREF +* BTRFS_IOC_INO_LOOKUP_USER +* BTRFS_IOC_SNAP_DESTROY_V2 -- destroy a (snapshot or regular) subvolume DETAILED DESCRIPTION -------------------- @@ -166,6 +233,28 @@ size is limited by Linux VFS to 255 characters and must not contain a slash ('/') +BTRFS_IOC_SNAP_CREATE_V2 +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. note:: + obsoletes BTRFS_IOC_SNAP_CREATE + +Create a snapshot of a subvolume. + +ioctl fd + file descriptor of the directory inside which to create the new snapshot +argument type + struct btrfs_ioctl_vol_args_v2 +fd + file descriptor of any directory inside the subvolume to snapshot +transid + ignored +flags + any subset of `BTRFS_SUBVOL_RDONLY` to make the new snapshot read-only, or + `BTRFS_SUBVOL_QGROUP_INHERIT` to apply the `qgroup_inherit` field +name + the name, under the ioctl fd, for the new subvolume + BTRFS_IOC_SUBVOL_CREATE_V2 ~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -194,6 +283,65 @@ devid ... +BTRFS_IOC_SUBVOL_GETFLAGS +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Read the flags of a subvolume. The returned flags are either 0 or +`BTRFS_SUBVOL_RDONLY`. + +ioctl fd + file descriptor of the subvolume to examine +argument type + uint64_t + +BTRFS_IOC_SUBVOL_SETFLAGS +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Change the flags of a subvolume. + +ioctl fd + file descriptor of the subvolume to modify +argument type + uint64_t, either 0 or `BTRFS_SUBVOL_RDONLY` + +BTRFS_IOC_GET_SUBVOL_INFO +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Get information about a subvolume. + +ioctl fd + file descriptor of the subvolume to examine +argument type + struct btrfs_ioctl_get_subvol_info_args + +BTRFS_IOC_SNAP_DESTROY_V2 +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Destroy a subvolume, which may or may not be a snapshot. + +ioctl fd + if `flags` does not include `BTRFS_SUBVOL_SPEC_BY_ID`, or if executing in a + non-root user namespace, file descriptor of the parent directory containing + the subvolume to delete; otherwise, file descriptor of any directory on the + same filesystem as the subvolume to delete, but not within the same + subvolume +argument type + struct btrfs_ioctl_vol_args_v2 +fd + ignored +transid + ignored +flags + 0 if the `name` field identifies the subvolume by name in the specified + directory, or `BTRFS_SUBVOL_SPEC_BY_ID` if the `subvolid` field specifies + the ID of the subvolume +name + only if `flags` does not contain `BTRFS_SUBVOL_SPEC_BY_ID`, the name + (within the directory identified by `fd`) of the subvolume to delete +subvolid + only if `flags` contains `BTRFS_SUBVOL_SPEC_BY_ID`, the subvolume ID of the + subvolume to delete + AVAILABILITY ------------ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/btrfs-man5.rst new/btrfs-progs-v6.1.3/Documentation/btrfs-man5.rst --- old/btrfs-progs-v6.1.2/Documentation/btrfs-man5.rst 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/btrfs-man5.rst 2023-01-25 19:39:27.000000000 +0100 @@ -11,6 +11,7 @@ #. filesystem features #. checksum algorithms #. compression +#. sysfs interface #. filesystem exclusive operations #. filesystem limits #. bootloader support @@ -191,6 +192,11 @@ .. include:: ch-compression.rst +SYSFS INTERFACE +--------------- + +.. include:: ch-sysfs.rst + FILESYSTEM EXCLUSIVE OPERATIONS ------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/btrfs.rst new/btrfs-progs-v6.1.3/Documentation/btrfs.rst --- old/btrfs-progs-v6.1.2/Documentation/btrfs.rst 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/btrfs.rst 2023-01-25 19:39:27.000000000 +0100 @@ -35,6 +35,12 @@ If the command name is ambiguous, the list of conflicting options is printed. +*Sizes*, both upon input and output, can be expressed in either SI or IEC-I +units (see `numfmt(1) <https://www.man7.org/linux/man-pages/man1/numfmt.1.html>`_) +with the suffix `B` appended. +All numbers will be formatted according to the rules of the `C` locale +(ignoring the shell locale, see `locale(7) <https://man7.org/linux/man-pages/man7/locale.7.html>`_). + For an overview of a given command use **btrfs command --help** or **btrfs [command...] --help --full** to print all available options. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/ch-mount-options.rst new/btrfs-progs-v6.1.3/Documentation/ch-mount-options.rst --- old/btrfs-progs-v6.1.2/Documentation/ch-mount-options.rst 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/ch-mount-options.rst 2023-01-25 19:39:27.000000000 +0100 @@ -1,3 +1,6 @@ +BTRFS SPECIFIC MOUNT OPTIONS +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + This section describes mount options specific to BTRFS. For the generic mount options please refer to ``mount(8)`` manual page. The options are sorted alphabetically (discarding the *no* prefix). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/ch-sysfs.rst new/btrfs-progs-v6.1.3/Documentation/ch-sysfs.rst --- old/btrfs-progs-v6.1.2/Documentation/ch-sysfs.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/ch-sysfs.rst 2023-01-25 19:39:27.000000000 +0100 @@ -0,0 +1,249 @@ +Btrfs has a sysfs interface to provide extra knobs. + +The top level path is `/sys/fs/btrfs/`, and the main directory layout is the following: + +============================= =================================== ======== +Relative Path Description Version +============================= =================================== ======== +features/ All supported features 3.14+ +<UUID>/ Mounted fs UUID 3.14+ +<UUID>/allocation/ Space allocation info 3.14+ +<UUID>/features/ Features of the filesystem 3.14+ +<UUID>/devices/<DEVID>/ Symlink to each block device sysfs 5.6+ +<UUID>/devinfo/<DEVID>/ Btrfs specific info for each device 5.6+ +<UUID>/qgroups/ Global qgroup info 5.9+ +<UUID>/qgroups/<LEVEL>_<ID>/ Info for each qgroup 5.9+ +============================= =================================== ======== + +For `/sys/fs/btrfs/features/` directory, each file means a supported feature +for the current kernel. + +For `/sys/fs/btrfs/<UUID>/features/` directory, each file means an enabled +feature for the mounted filesystem. + +The features shares the same name in section *FILESYSTEM FEATURES*. + + +Files in `/sys/fs/btrfs/<UUID>/` directory are: + +bg_reclaim_threshold + (RW, since: 5.19) + + Used space percentage of total device space to start auto block group claim. + Mostly for zoned devices. + +checksum + (RO, since: 5.5) + + The checksum used for the mounted filesystem. + This includes both the checksum type (see section *CHECKSUM ALGORITHMS*) + and the implemented driver (mostly shows if it's hardware accelerated). + +clone_alignment + (RO, since: 3.16) + + The bytes alignment for *clone* and *dedupe* ioctls. + +commit_stats + (RW, since: 6.0) + + The performance statistics for btrfs transaction commit. + Mostly for debug purposes. + + Writing into this file will reset the maximum commit duration to + the input value. + +exclusive_operation + (RO, since: 5.10) + + Shows the running exclusive operation. + Check section *FILESYSTEM EXCLUSIVE OPERATIONS* for details. + +generation + (RO, since: 5.11) + + Show the generation of the mounted filesystem. + +label + (RW, since: 3.14) + + Show the current label of the mounted filesystem. + +metadata_uuid + (RO, since: 5.0) + + Shows the metadata uuid of the mounted filesystem. + Check `metadata_uuid` feature for more details. + +nodesize + (RO, since: 3.14) + + Show the nodesize of the mounted filesystem. + +quota_override + (RW, since: 4.13) + + Shows the current quota override status. + 0 means no quota override. + 1 means quota override, quota can ignore the existing limit settings. + +read_policy + (RW, since: 5.11) + + Shows the current balance policy for reads. + Currently only "pid" (balance using pid value) is supported. + +sectorsize + (RO, since: 3.14) + + Shows the sectorsize of the mounted filesystem. + + +Files and directories in `/sys/fs/btrfs/<UUID>/allocations` directory are: + +global_rsv_reserved + (RO, since: 3.14) + + The used bytes of the global reservation. + +global_rsv_size + (RO, since: 3.14) + + The total size of the global reservation. + +`data/`, `metadata/` and `system/` directories + (RO, since: 5.14) + + Space info accounting for the 3 chunk types. + Mostly for debug purposes. + +Files in `/sys/fs/btrfs/<UUID>/allocations/{data,metadata,system}` directory are: + +bg_reclaim_threshold + (RW, since: 5.19) + + Reclaimable space percentage of block group's size (excluding + permanently unusable space) to reclaim the block group. + Can be used on regular or zoned devices. + +chunk_size + (RW, since: 6.0) + + Shows the chunk size. Can be changed for data and metadata. + Cannot be set for zoned devices. + +Files in `/sys/fs/btrfs/<UUID>/devinfo/<DEVID>` directory are: + +error_stats: + (RO, since: 5.14) + + Shows all the history error numbers of the device. + +fsid: + (RO, since: 5.17) + + Shows the fsid which the device belongs to. + It can be different than the `<UUID>` if it's a seed device. + +in_fs_metadata + (RO, since: 5.6) + + Shows whether we have found the device. + Should always be 1, as if this turns to 0, the `<DEVID>` directory + would get removed automatically. + +missing + (RO, since: 5.6) + + Shows whether the device is missing. + +replace_target + (RO, since: 5.6) + + Shows whether the device is the replace target. + If no dev-replace is running, this value should be 0. + +scrub_speed_max + (RW, since: 5.14) + + Shows the scrub speed limit for this device. The unit is Bytes/s. + 0 means no limit. + +writeable + (RO, since: 5.6) + + Show if the device is writeable. + +Files in `/sys/fs/btrfs/<UUID>/qgroups/` directory are: + +enabled + (RO, since: 6.1) + + Shows if qgroup is enabled. + Also, if qgroup is disabled, the `qgroups` directory would + be removed automatically. + +inconsistent + (RO, since: 6.1) + + Shows if the qgroup numbers are inconsistent. + If 1, it's recommended to do a qgroup rescan. + +drop_subtree_threshold + (RW, since: 6.1) + + Shows the subtree drop threshold to automatically mark qgroup inconsistent. + + When dropping large subvolumes with qgroup enabled, there would be a huge + load for qgroup accounting. + If we have a subtree whose level is larger than or equal to this value, + we will not trigger qgroup account at all, but mark qgroup inconsistent to + avoid the huge workload. + + Default value is 8, where no subtree drop can trigger qgroup. + + Lower value can reduce qgroup workload, at the cost of extra qgroup rescan + to re-calculate the numbers. + +Files in `/sys/fs/btrfs/<UUID>/<LEVEL>_<ID>/` directory are: + +exclusive + (RO, since: 5.9) + + Shows the exclusively owned bytes of the qgroup. + +limit_flags + (RO, since: 5.9) + + Shows the numeric value of the limit flags. + If 0, means no limit implied. + +max_exclusive + (RO, since: 5.9) + + Shows the limits on exclusively owned bytes. + +max_referenced + (RO, since: 5.9) + + Shows the limits on referenced bytes. + +referenced + (RO, since: 5.9) + + Shows the referenced bytes of the qgroup. + +rsv_data + (RO, since: 5.9) + + Shows the reserved bytes for data. + +rsv_meta_pertrans + (RO, since: 5.9) + + Shows the reserved bytes for per transaction metadata. + +rsv_meta_prealloc + (RO, since: 5.9) + + Shows the reserved bytes for preallocated metadata. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Documentation/conf.py new/btrfs-progs-v6.1.3/Documentation/conf.py --- old/btrfs-progs-v6.1.2/Documentation/conf.py 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Documentation/conf.py 2023-01-25 19:39:27.000000000 +0100 @@ -18,8 +18,6 @@ # -- Project information ----------------------------------------------------- project = 'BTRFS' -# TODO: get from date -copyright = '2022' version = pathlib.Path("../VERSION").read_text().strip('v\n') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/Makefile new/btrfs-progs-v6.1.3/Makefile --- old/btrfs-progs-v6.1.2/Makefile 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/Makefile 2023-01-25 19:39:27.000000000 +0100 @@ -134,7 +134,7 @@ # Static compilation flags STATIC_CFLAGS = $(CFLAGS) -ffunction-sections -fdata-sections -DSTATIC_BUILD -STATIC_LDFLAGS = -static -Wl,--gc-sections +STATIC_LDFLAGS = $(SUBST_LDFLAGS) $(EXTRA_LDFLAGS) -static -Wl,--gc-sections STATIC_LIBS = $(STATIC_LIBS_BASE) # don't use FORTIFY with sparse because glibc with FORTIFY can diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/VERSION new/btrfs-progs-v6.1.3/VERSION --- old/btrfs-progs-v6.1.2/VERSION 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/VERSION 2023-01-25 19:39:27.000000000 +0100 @@ -1 +1 @@ -v6.1.2 +v6.1.3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/check/main.c new/btrfs-progs-v6.1.3/check/main.c --- old/btrfs-progs-v6.1.2/check/main.c 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/check/main.c 2023-01-25 19:39:27.000000000 +0100 @@ -3991,10 +3991,115 @@ return ret; } +/* + * Define the minimal size for a buffer to describe the data backref. + * It needs to support something like: + * + * root <U64_MAX> owner <U64_MAX> offset <U64_MAX> + * + * Or + * + * parent <U64_MAX> + * + * Obviously the first pattern needs longer buffer size. The minimal size + * (including the tailing NUL) would be: + * + * 5 + 20 + 7 + 20 + 8 + 20 = 80. + * + * Just round it to 128 to provide extra wiggle room. + */ +#define DATA_EXTENT_DESC_BUF_LEN (128) +static void describe_data_extent_backref(char *buf, struct data_backref *dback) +{ + if (dback->node.full_backref) + sprintf(buf, "parent %llu", dback->parent); + else + sprintf(buf, "root %llu owner %llu offset %llu", + dback->root, dback->owner, dback->offset); +} + +static void print_data_backref_error(struct extent_record *rec, + struct data_backref *dback) +{ + struct extent_backref *back = &dback->node; + char desc[DATA_EXTENT_DESC_BUF_LEN] = { 0 }; + u32 found_refs; + u32 expected_refs; + + if (!back->found_extent_tree) { + /* No backref item in extent tree. Thus expected refs should be 0. */ + expected_refs = 0; + found_refs = dback->found_ref; + } else { + expected_refs = dback->num_refs; + found_refs = dback->found_ref; + } + + /* Extent item bytenr mismatch with found file extent item. */ + if (dback->disk_bytenr != rec->start) + fprintf(stderr, +"data extent[%llu, %llu] bytenr mimsmatch, extent item bytenr %llu file item bytenr %llu\n", + rec->start, rec->max_size, rec->start, + dback->disk_bytenr); + + /* Extent item size mismatch with found file item. */ + if (dback->bytes != rec->nr) + fprintf(stderr, +"data extent[%llu, %llu] size mimsmatch, extent item size %llu file item size %llu\n", + rec->start, rec->max_size, rec->nr, dback->bytes); + + if (expected_refs != found_refs) { + describe_data_extent_backref(desc, dback); + fprintf(stderr, +"data extent[%llu, %llu] referencer count mismatch (%s) wanted %u have %u\n", + rec->start, rec->max_size, desc, expected_refs, + found_refs); + } +} + +static void print_tree_backref_error(struct extent_record *rec, struct tree_backref *tback) +{ + struct extent_backref *back = &tback->node; + + /* + * For tree blocks, we only handle two cases here: + * + * - No backref item in extent tree + * - No tree block found (but with backref item) + * + * The refs count check is done by the global backref check at + * all_backpointers_checked(). + */ + if (!back->found_extent_tree) { + fprintf(stderr, +"tree extent[%llu, %llu] %s %llu has no backref item in extent tree\n", + rec->start, rec->max_size, + (back->full_backref ? "parent" : "root"), + (back->full_backref ? tback->parent : tback->root)); + return; + } + if (!back->found_ref) { + fprintf(stderr, +"tree extent[%llu, %llu] %s %llu has no tree block found\n", + rec->start, rec->max_size, + (back->full_backref ? "parent" : "root"), + (back->full_backref ? tback->parent : tback->root)); + return; + } +} + +static void print_backref_error(struct extent_record *rec, + struct extent_backref *back) +{ + if (back->is_data) + print_data_backref_error(rec, to_data_backref(back)); + else + print_tree_backref_error(rec, to_tree_backref(back)); +} + static int all_backpointers_checked(struct extent_record *rec, int print_errs) { struct extent_backref *back, *tmp; - struct tree_backref *tback; struct data_backref *dback; u64 found = 0; int err = 0; @@ -4005,42 +4110,11 @@ err = 1; if (!print_errs) goto out; - if (back->is_data) { - dback = to_data_backref(back); - fprintf(stderr, -"data backref %llu %s %llu owner %llu offset %llu num_refs %lu not found in extent tree\n", - (unsigned long long)rec->start, - back->full_backref ? - "parent" : "root", - back->full_backref ? - (unsigned long long)dback->parent : - (unsigned long long)dback->root, - (unsigned long long)dback->owner, - (unsigned long long)dback->offset, - (unsigned long)dback->num_refs); - } else { - tback = to_tree_backref(back); - fprintf(stderr, -"tree backref %llu %s %llu not found in extent tree\n", - (unsigned long long)rec->start, - back->full_backref ? "parent" : "root", - back->full_backref ? - (unsigned long long)tback->parent : - (unsigned long long)tback->root); - } } - if (!back->is_data && !back->found_ref) { + if (!back->found_ref) { err = 1; if (!print_errs) goto out; - tback = to_tree_backref(back); - fprintf(stderr, - "backref %llu %s %llu not referenced back %p\n", - (unsigned long long)rec->start, - back->full_backref ? "parent" : "root", - back->full_backref ? - (unsigned long long)tback->parent : - (unsigned long long)tback->root, back); } if (back->is_data) { dback = to_data_backref(back); @@ -4048,38 +4122,17 @@ err = 1; if (!print_errs) goto out; - fprintf(stderr, -"incorrect local backref count on %llu %s %llu owner %llu offset %llu found %u wanted %u back %p\n", - (unsigned long long)rec->start, - back->full_backref ? - "parent" : "root", - back->full_backref ? - (unsigned long long)dback->parent : - (unsigned long long)dback->root, - (unsigned long long)dback->owner, - (unsigned long long)dback->offset, - dback->found_ref, dback->num_refs, - back); } if (dback->disk_bytenr != rec->start) { err = 1; if (!print_errs) goto out; - fprintf(stderr, -"backref disk bytenr does not match extent record, bytenr=%llu, ref bytenr=%llu\n", - (unsigned long long)rec->start, - (unsigned long long)dback->disk_bytenr); } if (dback->bytes != rec->nr) { err = 1; if (!print_errs) goto out; - fprintf(stderr, -"backref bytes do not match extent backref, bytenr=%llu, ref bytes=%llu, backref bytes=%llu\n", - (unsigned long long)rec->start, - (unsigned long long)rec->nr, - (unsigned long long)dback->bytes); } } if (!back->is_data) { @@ -4088,6 +4141,8 @@ dback = to_data_backref(back); found += dback->found_ref; } + if (err) + print_backref_error(rec, back); } if (found != rec->refs) { err = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/cmds/filesystem.c new/btrfs-progs-v6.1.3/cmds/filesystem.c --- old/btrfs-progs-v6.1.2/cmds/filesystem.c 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/cmds/filesystem.c 2023-01-25 19:39:27.000000000 +0100 @@ -1449,26 +1449,26 @@ }; /* - * Swap signature in the first 4KiB, v2: + * Swap signature in the first 4KiB, v2, no label: * * 00000400 .. = 01 00 00 00 ff ff 03 00 00 00 00 00 cb 70 8e 60 - * ^^^^^^^^^^^ - * uuid 4B + * ^^^^^^^^^^^ ^^^^^^^^^^^ + * page count 4B uuid 4B * 00000420 .. = 1d fb 4e ca be d4 3f 1f 6a 6b 0c 03 00 00 00 00 * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * uuid 8B * 00000ff0 .. = 00 00 00 00 00 00 53 57 41 50 53 50 41 43 45 32 * S W A P S P A C E 2 */ -static int write_swap_signature(int fd) +static int write_swap_signature(int fd, u32 page_count) { int ret; - static unsigned char swap[4096] = { + static unsigned char swap[SZ_4K] = { [0x400] = 0x01, - [0x404] = 0xff, - [0x405] = 0xff, - [0x406] = 0x03, + /* 0x404 .. 0x407 number of pages (little-endian) */ + /* 0x408 .. 0x40b number of bad pages (unused) */ /* 0x40c .. 0x42b UUID */ + /* Last bytes of the page */ [0xff6] = 'S', [0xff7] = 'W', [0xff8] = 'A', @@ -1480,9 +1480,11 @@ [0xffe] = 'E', [0xfff] = '2', }; + u32 *pages = (u32 *)&swap[0x404]; + *pages = cpu_to_le32(page_count); uuid_generate(&swap[0x40c]); - ret = pwrite(fd, swap, 4096, 0); + ret = pwrite(fd, swap, SZ_4K, 0); return ret; } @@ -1494,6 +1496,7 @@ const char *fname; unsigned long flags; u64 size = SZ_2G; + u64 page_count; optind = 0; while (1) { @@ -1545,7 +1548,22 @@ ret = 1; goto out; } - pr_verbose(LOG_INFO, "fallocate to size %llu\n", size); + page_count = size / SZ_4K; + if (page_count <= 10) { + error("file too short"); + ret = 1; + goto out; + } + /* First file page with header */ + page_count--; + if (page_count > (u32)-1) { + error("file too big"); + ret = 1; + goto out; + } + size = round_down(size, SZ_4K); + pr_verbose(LOG_INFO, "fallocate to size %llu, page size %u, %llu pages\n", + size, SZ_4K, page_count); ret = fallocate(fd, 0, 0, size); if (ret < 0) { error("cannot fallocate file: %m"); @@ -1553,7 +1571,7 @@ goto out; } pr_verbose(LOG_INFO, "write swap signature\n"); - ret = write_swap_signature(fd); + ret = write_swap_signature(fd, page_count); if (ret < 0) { error("cannot write swap signature: %m"); ret = 1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/configure new/btrfs-progs-v6.1.3/configure --- old/btrfs-progs-v6.1.2/configure 2023-01-05 19:13:02.000000000 +0100 +++ new/btrfs-progs-v6.1.3/configure 2023-01-25 19:45:37.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for btrfs-progs v6.1.2. +# Generated by GNU Autoconf 2.71 for btrfs-progs v6.1.3. # # Report bugs to <linux-bt...@vger.kernel.org>. # @@ -611,8 +611,8 @@ # Identity of this package. PACKAGE_NAME='btrfs-progs' PACKAGE_TARNAME='btrfs-progs' -PACKAGE_VERSION='v6.1.2' -PACKAGE_STRING='btrfs-progs v6.1.2' +PACKAGE_VERSION='v6.1.3' +PACKAGE_STRING='btrfs-progs v6.1.3' PACKAGE_BUGREPORT='linux-bt...@vger.kernel.org' PACKAGE_URL='http://btrfs.wiki.kernel.org' @@ -1391,7 +1391,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures btrfs-progs v6.1.2 to adapt to many kinds of systems. +\`configure' configures btrfs-progs v6.1.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1457,7 +1457,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of btrfs-progs v6.1.2:";; + short | recursive ) echo "Configuration of btrfs-progs v6.1.3:";; esac cat <<\_ACEOF @@ -1617,7 +1617,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -btrfs-progs configure v6.1.2 +btrfs-progs configure v6.1.3 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1938,7 +1938,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by btrfs-progs $as_me v6.1.2, which was +It was created by btrfs-progs $as_me v6.1.3, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -8835,7 +8835,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by btrfs-progs $as_me v6.1.2, which was +This file was extended by btrfs-progs $as_me v6.1.3, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -8900,7 +8900,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -btrfs-progs config.status v6.1.2 +btrfs-progs config.status v6.1.3 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/btrfs-progs-v6.1.2/mkfs/main.c new/btrfs-progs-v6.1.3/mkfs/main.c --- old/btrfs-progs-v6.1.2/mkfs/main.c 2023-01-05 19:07:04.000000000 +0100 +++ new/btrfs-progs-v6.1.3/mkfs/main.c 2023-01-25 19:39:27.000000000 +0100 @@ -28,6 +28,7 @@ #include <string.h> #include <pthread.h> #include <uuid/uuid.h> +#include <blkid/blkid.h> #include "kernel-lib/list.h" #include "kernel-lib/list_sort.h" #include "kernel-lib/rbtree.h" @@ -1346,6 +1347,8 @@ exit(1); } if (opt_zoned) { + const int blkid_version = blkid_get_library_version(NULL, NULL); + if (source_dir_set) { error("the option -r and zoned mode are incompatible"); exit(1); @@ -1360,6 +1363,9 @@ error("cannot enable RAID5/6 in zoned mode"); exit(1); } + + if (blkid_version < 2380) + warning("libblkid < 2.38 does not support zoned mode's superblock location, update recommended"); } if (btrfs_check_nodesize(nodesize, sectorsize, &features))