diff --git a/Documentation/Auto-repair.rst b/Documentation/Auto-repair.rst index 0fb6b6d44d..5b682a260c 100644 --- a/Documentation/Auto-repair.rst +++ b/Documentation/Auto-repair.rst @@ -1,14 +1,16 @@ Auto-repair on read =================== -Data or metadata that are found to be damaged (e.g. because the checksum does -not match) at the time they're read from a device can be salvaged in case the -filesystem has another valid copy when using block group profile with redundancy -(DUP, RAID1-like, RAID5/6). The correct data are returned to the user application -and the damaged copy is replaced by it. When this happen a message is emitted -to the system log. - -If there are more copies of data and one of them is damaged but not read by -user application then this is not detected. To verify all data and metadata -copies there's :doc:`scrub` that needs to be started manually, automatic -repairs happens in that case. +If data or metadata that are found to be damaged at the time they’re read from a device, +for example because the checksum does not match, they can be salvaged if the filesystem +has another valid copy. This can be achieved by using a block group profile with redundancy +like `DUP`, RAID1-like, or RAID5/6. + +The correct data is returned to the user application and the damaged copy is replaced by it. +When this happens, a message is emitted to the system log. + +If there are multiple copies of data and one of them is damaged but not read by the user +application, then this is not detected. + +To ensure the verification and automatic repair of all data and metadata copies, the +:doc:`scrub` operation must be initiated manually. diff --git a/Documentation/Contributors.rst b/Documentation/Contributors.rst index 24ce52cd1b..caa2a6faa4 100644 --- a/Documentation/Contributors.rst +++ b/Documentation/Contributors.rst @@ -56,6 +56,7 @@ Statistics for 6.x series "6.9", "19", "110727", "161231", "147", "+2476 -1323" "6.10", "21", "110878", "161751", "154", "+2993 -2473" "6.11", "18", "111848", "163484", "188", "+5776 -4043" + "6.12", "20", "111881", "163548", "148", "+1868 -1804" Legend: diff --git a/Documentation/Introduction.rst b/Documentation/Introduction.rst index ca8fb51000..06fe03c7d0 100644 --- a/Documentation/Introduction.rst +++ b/Documentation/Introduction.rst @@ -34,7 +34,7 @@ Feature overview: * :doc:`Offline filesystem check` * :doc:`In-place conversion` of existing ext2/3/4 and reiserfs filesystems * :doc:`Seeding device.` Create a (readonly) filesystem that - acts as a template to seed other Btrfs filesystems. The original filesystem + acts as a template to seed other BTRFS filesystems. The original filesystem and devices are included as a readonly starting point for the new filesystem. Using copy on write, all modifications are stored on different devices; the original is unchanged. diff --git a/Documentation/Kernel-by-version.rst b/Documentation/Kernel-by-version.rst index e6d224ceb2..c76a9c0401 100644 --- a/Documentation/Kernel-by-version.rst +++ b/Documentation/Kernel-by-version.rst @@ -557,16 +557,137 @@ Fixes: 6.9 (May 2024) ^^^^^^^^^^^^^^ -TBD +Pull requests: +`v6.9-rc1 (1)`__, +`v6.9-rc1 (2)`__, +`v6.9-rc2 `__, +`v6.9-rc3 `__, +`v6.9-rc5 `__, +`v6.9-rc6 `__, +`v6.9-rc7 `__, +`v6.9-rc8 `__, + +Performance improvements: + +- minor speedup in logging when repeatedly allocated structure is preallocated + only once, improves latency and decreases lock contention + +- minor throughput increase (+6%), reduced lock contention after clearing + delayed allocation bits, applies to several common workload types + +- features under CONFIG_BTRFS_DEBUG: + - sysfs knob for setting the how checksums are calculated when submitting IO, + inline or offloaded to a thread, this affects latency and throughput on some + block group profiles + +Notable fixes: + +- fix device tracking in memory that broke grub-probe + +- zoned mode fixes: + - use zone-aware super block access during scrub + - delete zones that are 100% unusable to reclaim space + +Other notable changes: + +- additional validation of devices by major:minor numbers 6.10 (Jul 2024) ^^^^^^^^^^^^^^^ -TBD +Pull requests: +`v6.10-rc1 (1)`__, +`v6.10-rc1 (2)`__, +`v6.10-rc3 (1)`__, +`v6.10-rc3 (2)`__, +`v6.10-rc5 `__, +`v6.10-rc6 `__, +`v6.10-rc7 (1)`__, +`v6.10-rc7 (2)`__, +`v6.10-rc8 `__, + +Performance improvements: + +- inline b-tree locking functions, improvement in metadata-heavy changes + +- relax locking on a range that's being reflinked, allows read operations to + run in parallel + +- speed up NOCOW write checks (throughput +9% on a sample test) + +- extent locking ranges have been reduced in several places, namely around + delayed ref processing + +Notable fixes or changes: + +- add back mount option *norecovery*, deprecated long time ago and removed in + 6.8 but still in use + +- fix potential infinite loop when doing block group reclaim + +- extent map shrinker, allow memory consumption reduction for direct io loads + 6.11 (Sep 2024) ^^^^^^^^^^^^^^^ +Pull requests: +`v6.11-rc1 (1)`__, +`v6.11-rc1 (2)`__, +`v6.11-rc2 `__, +`v6.11-rc3 `__, +`v6.11-rc4 `__, +`v6.11-rc4 `__, +`v6.11-rc6 `__, +`v6.11-rc7 `__, + +User visible features: + +- dynamic block group reclaim: + - tunable framework to avoid situations where eager data allocations prevent + creating new metadata chunks due to lack of unallocated space + - reuse sysfs knob bg_reclaim_threshold (otherwise used only in zoned mode) + for a fixed value threshold + - new on/off sysfs knob "dynamic_reclaim" calculating the value based on + heuristics, aiming to keep spare working space for relocating chunks but + not to needlessly relocate partially utilized block groups or reclaim newly + allocated ones + - stats are exported in sysfs per block group type, files "reclaim_*" + - this may increase IO load at unexpected times but the corner case of no + allocatable block groups is known to be worse + +- automatically remove qgroup of deleted subvolumes: + - adjust qgroup removal conditions, make sure all related subvolume data are + already removed, or return EBUSY, also take into account setting of sysfs + drop_subtree_threshold + - also works in squota mode + +- mount option updates: new modes of 'rescue=' that allow to mount images + (read-only) that could have been partially converted by user space tools + - ignoremetacsums - invalid metadata checksums are ignored + - ignoresuperflags - super block flags that track conversion in progress + (like UUID or checksums) + +Other notable changes or fixes: + +- space cache v1 marked as deprecated (a warning printed in syslog), the + free-space tree (i.e. the v2) has been default in "mkfs.btrfs" since 5.15, + the kernel code will be removed in the future on a conservative schedule + +- tree checker improvements: + - validate data reference items + - validate directory item type + +- send also detects last extent suitable for cloning (and not a write) + +- extent map shrinker (a memory reclaim optimization) added in 6.10 now + available only under CONFIG_BTRFS_DEBUG due to performance problems + +- update target inode's ctime on unlink, + `mandated by POSIX `__ + +- in zoned mode, detect unexpected zone write pointer change + 5.x --- diff --git a/Documentation/btrfs-check.rst b/Documentation/btrfs-check.rst index cc39360cbe..f665bcaccd 100644 --- a/Documentation/btrfs-check.rst +++ b/Documentation/btrfs-check.rst @@ -19,6 +19,13 @@ by the option *--readonly*. :command:`btrfsck` is an alias of :command:`btrfs check` command and is now deprecated. +.. note:: + Even though the filesystem checker requires a device argument, it scans for all + devices belonging to the same filesystem, thus it should not cause a difference + using different devices of the same filesystem. + Furthermore `btrfs check` will automatically choose the good mirror, thus as long + as there is a good copy for metadata, it will not report such case as an error. + .. warning:: Do not use *--repair* unless you are advised to do so by a developer or an experienced user, and then only after having accepted that no *fsck* diff --git a/Documentation/ch-checksumming.rst b/Documentation/ch-checksumming.rst index 1554c58002..5e47a6bfb4 100644 --- a/Documentation/ch-checksumming.rst +++ b/Documentation/ch-checksumming.rst @@ -1,32 +1,32 @@ -Data and metadata are checksummed by default, the checksum is calculated before -write and verified after reading the blocks from devices. The whole metadata -block has a checksum stored inline in the b-tree node header, each data block +Data and metadata are checksummed by default. The checksum is calculated before +writing and verified after reading the blocks from devices. The whole metadata +block has an inline checksum stored in the b-tree node header. Each data block has a detached checksum stored in the checksum tree. There are several checksum algorithms supported. The default and backward -compatible is *crc32c*. Since kernel 5.5 there are three more with different +compatible algorithm is *crc32c*. Since kernel 5.5 there are three more with different characteristics and trade-offs regarding speed and strength. The following list may help you to decide which one to select. -CRC32C (32bit digest) - default, best backward compatibility, very fast, modern CPUs have +CRC32C (32 bits digest) + Default, best backward compatibility. Very fast, modern CPUs have instruction-level support, not collision-resistant but still good error - detection capabilities + detection capabilities. -XXHASH (64bit digest) - can be used as CRC32C successor, very fast, optimized for modern CPUs utilizing - instruction pipelining, good collision resistance and error detection +XXHASH (64 bits digest) + Can be used as CRC32C successor. Very fast, optimized for modern CPUs utilizing + instruction pipelining, good collision resistance and error detection. -SHA256 (256bit digest) - a cryptographic-strength hash, relatively slow but with possible CPU - instruction acceleration or specialized hardware cards, FIPS certified and - in wide use +SHA256 (256 bits digest) + Cryptographic-strength hash. Relatively slow but with possible CPU + instruction acceleration or specialized hardware cards. FIPS certified and + in wide use. -BLAKE2b (256bit digest) - a cryptographic-strength hash, relatively fast with possible CPU acceleration - using SIMD extensions, not standardized but based on BLAKE which was a SHA3 - finalist, in wide use, the algorithm used is BLAKE2b-256 that's optimized for - 64bit platforms +BLAKE2b (256 bits digest) + Cryptographic-strength hash. Relatively fast, with possible CPU acceleration + using SIMD extensions. Not standardized but based on BLAKE which was a SHA3 + finalist, in wide use. The algorithm used is BLAKE2b-256 that's optimized for + 64-bit platforms. The *digest size* affects overall size of data block checksums stored in the filesystem. The metadata blocks have a fixed area up to 256 bits (32 bytes), so @@ -61,8 +61,8 @@ The accelerated versions are however provided by the modules and must be loaded explicitly (:command:`modprobe sha256`) before mounting the filesystem to make use of them. You can check in :file:`/sys/fs/btrfs/FSID/checksum` which one is used. If you see *sha256-generic*, then you may want to unmount and mount the filesystem -again, changing that on a mounted filesystem is not possible. -Check the file :file:`/proc/crypto`, when the implementation is built-in, you'd find +again. Changing that on a mounted filesystem is not possible. +Check the file :file:`/proc/crypto`, when the implementation is built-in, you'd find: .. code-block:: none @@ -72,7 +72,7 @@ Check the file :file:`/proc/crypto`, when the implementation is built-in, you'd priority : 100 ... -while accelerated implementation is e.g. +While accelerated implementation is e.g.: .. code-block:: none diff --git a/Documentation/ch-scrub-intro.rst b/Documentation/ch-scrub-intro.rst index 7c01d51fb1..4fca221df7 100644 --- a/Documentation/ch-scrub-intro.rst +++ b/Documentation/ch-scrub-intro.rst @@ -1,14 +1,49 @@ -Scrub is a pass over all filesystem data and metadata and verifying the -checksums. If a valid copy is available (replicated block group profiles) then -the damaged one is repaired. All copies of the replicated profiles are validated. +Scrub is a validation pass over all filesystem data and metadata that detects +data checksum errors, basic super block errors, basic metadata block header errors, +and disk read errors. + +Scrub is done on a per-device base, if a device is specified to `btrfs scrub`, then +only that device will be scrubbed. Although btrfs will also try to read other device +to find a good copy, if the mirror on that specified device failed to be read or pass +verification. + +If a path of btrfs is specified to `btrfs scrub`, btrfs will scrub all devices +in parallel. + +On filesystems that use replicated block group profiles (e.g. raid1), read-write +scrub will also automatically repair any damage by copying verified good data +from one of the other replicas. + +Such automatic repair is also carried out when reading metadata or data from a +read-write mounted btrfs. + +.. warning:: + Setting the ``No_COW`` (``chattr +C``) attribute on a file implicitly enables + ``nodatasum``. This means that while metadata for these files continues to + be validated and corrected by scrub, the actual file data is not. + + Furthermore, btrfs does not currently mark missing or failed disks as + unreliable, so will continue to load-balance reads to potentially damaged + replicas. This is not a problem normally because damage is detected by + checksum validation, but because ``No_COW`` files are + not protected by checksum, btrfs has no idea which mirror is good thus it can + return the bad contents to the user space tool. + + Detecting and recovering from such failure requires manual intervention. + + Notably, `systemd sets +C on journals by default `_, + and `libvirt ≥ 6.6 sets +C on storage pool directories by default `_. + Other applications or distributions may also set +C to try to improve + performance. .. note:: - Scrub is not a filesystem checker (fsck) and does not verify nor repair - structural damage in the filesystem. It really only checks checksums of data - and tree blocks, it doesn't ensure the content of tree blocks is valid and - consistent. There's some validation performed when metadata blocks are read - from disk (:doc:`Tree-checker`) but it's not extensive and cannot substitute - full :doc:`btrfs-check` run. + Scrub is not a filesystem checker (fsck). It can only detect filesystem damage + using the checksum validation, and it can only repair + filesystem damage by copying from other known good replicas. + + :doc:`btrfs-check` performs more exhaustive checking and can sometimes be + used, with expert guidance, to rebuild certain corrupted filesystem structures + in the absence of any good replica. The user is supposed to run it manually or via a periodic system service. The recommended period is a month but it could be less. The estimated device bandwidth diff --git a/Documentation/ch-subvolume-intro.rst b/Documentation/ch-subvolume-intro.rst index 1ebead5451..2f5ee6fc3e 100644 --- a/Documentation/ch-subvolume-intro.rst +++ b/Documentation/ch-subvolume-intro.rst @@ -32,7 +32,7 @@ default, snapshots are created read-write. File modifications in a snapshot do not affect the files in the original subvolume. Subvolumes can be given capacity limits, through the qgroups/quota facility, but -otherwise share the single storage pool of the whole btrfs filesystem. They may +otherwise share the single storage pool of the whole BTRFS filesystem. They may even share data between themselves (through deduplication or snapshotting). .. note:: @@ -61,7 +61,7 @@ from read-only to read-write will break the assumptions and may lead to unexpected changes in the resulting incremental stream. A snapshot that was created by send/receive will be read-only, with different -last change generation, read-only and with set *received_uuid* which identifies +last change generation, and with set *received_uuid* which identifies the subvolume on the filesystem that produced the stream. The use case relies on matching data on both sides. Changing the subvolume to read-write after it has been received requires to reset the *received_uuid*. As this is a notable @@ -85,11 +85,10 @@ organize them, whether to have a flat layout (all subvolumes are direct descendants of the toplevel one), or nested. What should be mentioned early is that a snapshotting is not recursive, so a -subvolume or a snapshot is effectively a barrier and no files in the nested -appear in the snapshot. Instead there's a stub subvolume (also sometimes called -*empty subvolume* with the same name as original subvolume, with inode number -2). This can be used intentionally but could be confusing in case of nested -layouts. +subvolume or a snapshot is effectively a barrier and no files in the nested subvolumes +appear in the snapshot. Instead, there's a stub subvolume, also sometimes called +*empty subvolume*, with the same name as original subvolume and with inode number 2. +This can be used intentionally but could be confusing in case of nested layouts. .. code-block:: bash @@ -124,14 +123,14 @@ log files would get rolled back too, or any data that are stored on the root filesystem but are not meant to be rolled back either (database files, VM images, ...). -Here we could utilize the snapshotting barrier mentioned above, each directory -that stores data to be preserved across rollbacks is it's own subvolume. This -could be e.g. :file:`/var`. Further more-fine grained partitioning could be done, e.g. +Here we could utilize the snapshotting barrier mentioned above, making each directory +that stores data to be preserved across rollbacks its own subvolume. This +could be e.g. :file:`/var`. Further more fine-grained partitioning could be done, e.g. adding separate subvolumes for :file:`/var/log`, :file:`/var/cache` etc. -That there are separate subvolumes requires separate actions to take the -snapshots (here it gets disconnected from the system root snapshots). This needs -to be taken care of by system tools, installers together with selection of which +The fact that there are separate subvolumes requires separate actions to take the +snapshots (here, it gets disconnected from the system root snapshots). This needs +to be taken care of by system tools, installers, together with selection of which directories are highly recommended to be separate subvolumes. Mount options @@ -142,16 +141,16 @@ specific, handled by the filesystem. The following list shows which are applicable to individual subvolume mounts, while there are more options that always affect the whole filesystem: -- generic: noatime/relatime/..., nodev, nosuid, ro, rw, dirsync -- fs-specific: compress, autodefrag, nodatacow, nodatasum +- Generic: noatime/relatime/..., nodev, nosuid, ro, rw, dirsync +- Filesystem-specific: compress, autodefrag, nodatacow, nodatasum -An example of whole filesystem options is e.g. *space_cache*, *rescue*, *device*, +Examples of whole filesystem options are e.g. *space_cache*, *rescue*, *device*, *skip_balance*, etc. The exceptional options are *subvol* and *subvolid* that are actually used for mounting a given subvolume and can be specified only once for the mount. -Subvolumes belong to a single filesystem and as implemented now all share the -same specific mount options, changes done by remount have immediate effect. This +Subvolumes belong to a single filesystem and, as implemented now, all share the +same specific mount options. Also, changes done by remount have immediate effect. This may change in the future. Mounting a read-write snapshot as read-only is possible and will not change the @@ -189,19 +188,19 @@ original inode numbers. .. note:: Inode number is not a filesystem-wide unique identifier, some applications - assume that. Please use pair *subvolumeid:inodenumber* for that purpose. + assume that. Please use the *subvolumeid:inodenumber* pair for that purpose. The subvolume id can be read by :ref:`btrfs inspect-internal rootid` or by the ioctl :ref:`BTRFS_IOC_INO_LOOKUP`. Performance ----------- -Subvolume creation needs to flush dirty data that belong to the subvolume, this -step may take some time, otherwise once there's nothing else to do, the snapshot -is instant and in the metadata it only creates a new tree root copy. +Subvolume creation needs to flush dirty data that belong to the subvolume and this +step may take some time. Otherwise, once there's nothing else to do, the snapshot +is instantaneous and only creates a new tree root copy in the metadata. Snapshot deletion has two phases: first its directory is deleted and the -subvolume is added to a list, then the list is processed one by one and the +subvolume is added to a queuing list, then the list is processed one by one and the data related to the subvolume get deleted. This is usually called *cleaning* and can take some time depending on the amount of shared blocks (can be a lot of metadata updates), and the number of currently queued deleted subvolumes. diff --git a/Documentation/ch-volume-management-intro.rst b/Documentation/ch-volume-management-intro.rst index c0ba68a72c..b350a23321 100644 --- a/Documentation/ch-volume-management-intro.rst +++ b/Documentation/ch-volume-management-intro.rst @@ -116,3 +116,13 @@ In order to remove a device, you need to convert the profile in this case: $ btrfs balance start -mconvert=dup -dconvert=single /mnt $ btrfs device remove /dev/sda /mnt + +.. warning:: + Do not run balance to convert from a profile with more redundancy to one with + less redundancy in order to remove a failing device from a filesystem. + + Balance is done by reading out the good metadata/data and write them into into a + new chunk. + Thus it's possible the new chunk is written into the failing device. + + Use `btrfs device replace` instead. diff --git a/Documentation/dev/Developer-s-FAQ.rst b/Documentation/dev/Developer-s-FAQ.rst index 70d37f52d5..3b33207d10 100644 --- a/Documentation/dev/Developer-s-FAQ.rst +++ b/Documentation/dev/Developer-s-FAQ.rst @@ -661,8 +661,8 @@ and having your name in the git history. References ---------- -- `Kernel maintainersip: an oral - tradition `__ +- `Kernel maintainership: an oral + tradition `__ (pdf) a nice presentation from ELCE 2015 what does it mean to be a maintainer and what the developers can expect. - https://www.kernel.org/doc/html/latest/process/submitting-patches.html diff --git a/Documentation/dev/On-disk-format.rst b/Documentation/dev/On-disk-format.rst index c3d5a0ff59..b330403265 100644 --- a/Documentation/dev/On-disk-format.rst +++ b/Documentation/dev/On-disk-format.rst @@ -29,6 +29,12 @@ specifically it contains "chunk items" for all system chunks. The superblock also contains a logical reference to root nodes in the root and chunk trees, which can then be used to locate all the other trees and data stored. +To avoid duplicated suffixes/prefixes, sometimes the macro name will have +the "BTRFS_" prefix and "_OBJECTID" suffix removed. + +E.g. "BTRFS_DEV_ITEMS_OBJECTID" (0x1) can be shown as "DEV_ITEMS" for short, +this matches the output of "btrfs inspect-internal dump-tree". + TODO Subvolumes and snapshots. @@ -268,6 +274,12 @@ Otherwise, the objectid should be considered reserved for internal use. The object id that refers to the ``ROOT_TREE`` itself. +- BTRFS_DEV_ITEMS_OBJECTID = 1 + + The object id that refers to the :ref:`DEV_ITEM`. + + duplicate with BTRFS_ROOT_TREE_OBJECTID for historical reason. + - BTRFS_EXTENT_TREE_OBJECTID = 2 The objectid that refers to the ``EXTENT_TREE`` @@ -1045,11 +1057,12 @@ Off Size Type Description 0x30 ===== ==== ===== ======================= +.. _DEV_ITEM_CONTENT: -DEV_ITEM (d8) -^^^^^^^^^^^^^ +DEV_ITEM (0xd8) +^^^^^^^^^^^^^^^ -(1, device id) TODO +Key format: (DEV_ITEMS DEV_ITEM ) Contains information about one device. diff --git a/Documentation/dev/ReleaseChecklist.rst b/Documentation/dev/ReleaseChecklist.rst index 7789cc83fc..f6254ccdb0 100644 --- a/Documentation/dev/ReleaseChecklist.rst +++ b/Documentation/dev/ReleaseChecklist.rst @@ -27,6 +27,17 @@ Pre-release: * write CHANGES entry (will be visible on RTD right away) +Python btrfsutil (pypi.org): + +* rebuild whole project (regenerate constants.c) +* ``cd libbtrfsutil/python`` +* edit ``setup.py`` version manually (the toplevel VERSION is not accessible + during dist build) +* ``python3 -m build`` -- build dist files +* ``twine check dist/*.tar.gz`` -- look for warnings +* ``twine upload dist/*.tar.gz`` -- make sure there's only the latest version, + *twine* must need access token to pypi.org + Release: * tag release, sign diff --git a/Documentation/index.rst b/Documentation/index.rst index deb237aae6..16e486077b 100644 --- a/Documentation/index.rst +++ b/Documentation/index.rst @@ -7,7 +7,7 @@ BTRFS is a modern copy on write (COW) filesystem for Linux aimed at implementing advanced features while also focusing on fault tolerance, repair and easy administration. You can read more about the features in the :doc:`introduction` or choose from the pages below. Documentation -for for command line tools :doc:`btrfs`, :doc:`mkfs.btrfs` and others +for command line tools :doc:`btrfs`, :doc:`mkfs.btrfs` and others is in the :doc:`manual pages`. .. raw:: html @@ -91,6 +91,11 @@ is in the :doc:`manual pages`. +Need help? +---------- + +Assistance is available from the `#btrfs channel on Libera Chat `_ or the `linux-btrfs mailing list `_. Issues with the userspace btrfs tools can be reported to the `btrfs-progs issue tracker on GitHub `_. + .. raw:: html
diff --git a/Documentation/mkfs.btrfs.rst b/Documentation/mkfs.btrfs.rst index a6251afd2d..58336e82a0 100644 --- a/Documentation/mkfs.btrfs.rst +++ b/Documentation/mkfs.btrfs.rst @@ -155,15 +155,26 @@ OPTIONS contain the files from *rootdir*. Since version 4.14.1 the filesystem size is not minimized. Please see option *--shrink* if you need that functionality. --u|--subvol : +-u|--subvol : Specify that *subdir* is to be created as a subvolume rather than a regular directory. The option *--rootdir* must also be specified, and *subdir* must be an existing subdirectory within it. This option can be specified multiple times. - *flags* is an optional comma-separated list of modifiers. Valid choices are: + *type* is an optional additional modifier. Valid choices are: - * *default*: create as default subvolume (this can only be specified once) - * *ro*: create as readonly subvolume + * *default*: create as default subvolume + * *ro*: create as read-only subvolume + * *rw*: create as read-write subvolume (the default) + * *default-ro*: create as read-only default subvolume + + Only one of *default* and *default-ro* may be specified. + + If you wish to create a subvolume with a name containing a colon and you don't + want this to be parsed as containing a modifier, you can prefix the path with `./`: + + .. code-block:: bash + + $ mkfs.btrfs --rootdir dir --subvol ./ro:subdir /dev/loop0 If there are hard links inside *rootdir* and *subdir* will split the subvolumes, like the following case:: diff --git a/Documentation/plot-contribs.svg b/Documentation/plot-contribs.svg index 34b0e6ee8c..8da6901a30 100644 --- a/Documentation/plot-contribs.svg +++ b/Documentation/plot-contribs.svg @@ -7,7 +7,7 @@ > Gnuplot -Produced by GNUPLOT 6.0 patchlevel 0 +Produced by GNUPLOT 6.0 patchlevel 1 @@ -163,11 +163,11 @@ - + - + 3.0 @@ -176,11 +176,11 @@ - + - + 4.0 @@ -189,11 +189,11 @@ - + - + 5.0 @@ -202,11 +202,11 @@ - + - + 6.0 @@ -220,7 +220,7 @@ - 6.10 + 6.12 @@ -244,142 +244,142 @@ - + diff --git a/Documentation/plot-patches.svg b/Documentation/plot-patches.svg index 8b6b25e1e4..f795ef2e7f 100644 --- a/Documentation/plot-patches.svg +++ b/Documentation/plot-patches.svg @@ -7,7 +7,7 @@ > Gnuplot -Produced by GNUPLOT 6.0 patchlevel 0 +Produced by GNUPLOT 6.0 patchlevel 1 @@ -150,11 +150,11 @@ - + - + 3.0 @@ -163,11 +163,11 @@ - + - + 4.0 @@ -176,11 +176,11 @@ - + - + 5.0 @@ -189,11 +189,11 @@ - + - + 6.0 @@ -207,7 +207,7 @@ - 6.10 + 6.12 @@ -231,142 +231,142 @@ - + Avg 2y @@ -375,17 +375,17 @@ - + diff --git a/Documentation/plot-sloc-lines.svg b/Documentation/plot-sloc-lines.svg index 5276bb7051..08e8189763 100644 --- a/Documentation/plot-sloc-lines.svg +++ b/Documentation/plot-sloc-lines.svg @@ -7,7 +7,7 @@ > Gnuplot -Produced by GNUPLOT 6.0 patchlevel 0 +Produced by GNUPLOT 6.0 patchlevel 1 @@ -176,11 +176,11 @@ - + - + 3.0 @@ -189,11 +189,11 @@ - + - + 4.0 @@ -202,11 +202,11 @@ - + - + 5.0 @@ -215,11 +215,11 @@ - + - + 6.0 @@ -233,7 +233,7 @@ - 6.10 + 6.12 @@ -257,142 +257,142 @@ - + L118.38,211.49 L118.80,211.47 L119.34,211.39 L119.87,211.26 L120.41,211.08 L120.95,210.86 L121.48,210.62 L122.02,210.36 + L122.55,210.08 L123.09,209.81 L123.62,209.54 L124.16,209.28 L124.70,209.05 L124.83,209.00 L125.23,208.84 L125.77,208.61 + L126.30,208.37 L126.84,208.13 L127.37,207.89 L127.91,207.65 L128.44,207.41 L128.98,207.19 L129.52,206.99 L130.05,206.80 + L130.59,206.64 L131.12,206.50 L131.28,206.47 L131.66,206.39 L132.19,206.30 L132.73,206.22 L133.27,206.15 L133.80,206.09 + L134.34,206.03 L134.87,205.97 L135.41,205.91 L135.94,205.85 L136.48,205.78 L137.02,205.70 L137.55,205.61 L137.73,205.57 + L138.09,205.49 L138.62,205.34 L139.16,205.15 L139.69,204.93 L140.23,204.70 L140.76,204.47 L141.30,204.24 L141.84,204.02 + L142.37,203.83 L142.91,203.68 L143.44,203.57 L143.98,203.52 L144.17,203.51 L144.51,203.51 L145.05,203.51 L145.59,203.52 + L146.12,203.52 L146.66,203.52 L147.19,203.52 L147.73,203.53 L148.26,203.53 L148.80,203.53 L149.34,203.54 L149.87,203.54 + L150.41,203.54 L150.62,203.54 L150.94,203.52 L151.48,203.42 L152.01,203.23 L152.55,202.97 L153.08,202.64 L153.62,202.27 + L154.16,201.86 L154.69,201.42 L155.23,200.96 L155.76,200.50 L156.30,200.03 L156.83,199.59 L157.07,199.40 L157.37,199.15 + L157.91,198.65 L158.44,198.09 L158.98,197.49 L159.51,196.85 L160.05,196.21 L160.58,195.57 L161.12,194.95 L161.66,194.37 + L162.19,193.84 L162.73,193.37 L163.26,192.99 L163.51,192.85 L163.80,192.70 L164.33,192.45 L164.87,192.22 L165.40,192.01 + L165.94,191.82 L166.48,191.64 L167.01,191.47 L167.55,191.31 L168.08,191.15 L168.62,190.98 L169.15,190.81 L169.69,190.62 + L169.96,190.52 L170.23,190.42 L170.76,190.23 L171.30,190.05 L171.83,189.87 L172.37,189.70 L172.90,189.52 L173.44,189.34 + L173.98,189.14 L174.51,188.92 L175.05,188.68 L175.58,188.42 L176.12,188.12 L176.41,187.95 L176.65,187.78 L177.19,187.27 + L177.72,186.60 L178.26,185.81 L178.80,184.94 L179.33,184.01 L179.87,183.07 L180.40,182.15 L180.94,181.28 L181.47,180.51 + L182.01,179.86 L182.55,179.37 L182.86,179.18 L183.08,179.06 L183.62,178.83 L184.15,178.62 L184.69,178.45 L185.22,178.30 + L185.76,178.16 L186.30,178.03 L186.83,177.90 L187.37,177.76 L187.90,177.62 L188.44,177.45 L188.97,177.26 L189.30,177.12 + L189.51,177.03 L190.05,176.77 L190.58,176.48 L191.12,176.17 L191.65,175.83 L192.19,175.47 L192.72,175.10 L193.26,174.72 + L193.79,174.34 L194.33,173.95 L194.87,173.58 L195.40,173.20 L195.75,172.97 L195.94,172.84 L196.47,172.46 L197.01,172.06 + L197.54,171.64 L198.08,171.21 L198.62,170.78 L199.15,170.37 L199.69,169.97 L200.22,169.59 L200.76,169.25 L201.29,168.95 + L201.83,168.70 L202.20,168.56 L202.37,168.50 L202.90,168.33 L203.44,168.16 L203.97,168.01 L204.51,167.87 L205.04,167.74 + L205.58,167.62 L206.11,167.51 L206.65,167.41 L207.19,167.31 L207.72,167.23 L208.26,167.15 L208.64,167.09 L208.79,167.07 + L209.33,167.01 L209.86,166.96 L210.40,166.91 L210.94,166.87 L211.47,166.83 L212.01,166.79 L212.54,166.75 L213.08,166.71 + L213.61,166.66 L214.15,166.61 L214.69,166.55 L215.09,166.49 L215.22,166.47 L215.76,166.38 L216.29,166.25 L216.83,166.11 + L217.36,165.95 L217.90,165.77 L218.43,165.59 L218.97,165.40 L219.51,165.21 L220.04,165.02 L220.58,164.83 L221.11,164.66 + L221.54,164.53 L221.65,164.50 L222.18,164.35 L222.72,164.21 L223.26,164.07 L223.79,163.93 L224.33,163.80 L224.86,163.67 + L225.40,163.53 L225.93,163.38 L226.47,163.23 L227.01,163.07 L227.54,162.89 L227.99,162.74 L228.08,162.71 L228.61,162.48 + L229.15,162.20 L229.68,161.89 L230.22,161.56 L230.75,161.21 L231.29,160.87 L231.83,160.53 L232.36,160.22 L232.90,159.94 + L233.43,159.71 L233.97,159.53 L234.43,159.42 L234.50,159.41 L235.04,159.34 L235.58,159.28 L236.11,159.23 L236.65,159.18 + L237.18,159.15 L237.72,159.11 L238.25,159.08 L238.79,159.04 L239.33,159.00 L239.86,158.95 L240.40,158.89 L240.88,158.82 + L240.93,158.81 L241.47,158.68 L242.00,158.50 L242.54,158.26 L243.07,157.98 L243.61,157.68 L244.15,157.37 L244.68,157.06 + L245.22,156.77 L245.75,156.50 L246.29,156.28 L246.82,156.11 L247.33,156.02 L247.36,156.01 L247.90,155.95 L248.43,155.90 + L248.97,155.86 L249.50,155.83 L250.04,155.80 L250.57,155.77 L251.11,155.75 L251.65,155.72 L252.18,155.69 L252.72,155.65 + L253.25,155.60 L253.78,155.55 L253.79,155.54 L254.32,155.47 L254.86,155.37 L255.40,155.25 L255.93,155.11 L256.47,154.95 + L257.00,154.79 L257.54,154.62 L258.07,154.44 L258.61,154.26 L259.14,154.08 L259.68,153.90 L260.22,153.73 L260.75,153.56 + L261.29,153.37 L261.82,153.17 L262.36,152.96 L262.89,152.75 L263.43,152.54 L263.97,152.34 L264.50,152.15 L265.04,151.98 + L265.57,151.83 L266.11,151.70 L266.64,151.60 L266.67,151.60 L267.18,151.53 L267.72,151.47 L268.25,151.42 L268.79,151.38 + L269.32,151.34 L269.86,151.30 L270.39,151.27 L270.93,151.23 L271.46,151.18 L272.00,151.13 L272.54,151.07 L273.07,151.00 + L273.12,150.99 L273.61,150.89 L274.14,150.73 L274.68,150.53 L275.21,150.29 L275.75,150.03 L276.29,149.76 L276.82,149.50 + L277.36,149.24 L277.89,149.00 L278.43,148.80 L278.96,148.64 L279.50,148.53 L279.56,148.52 L280.04,148.47 L280.57,148.42 + L281.11,148.37 L281.64,148.33 L282.18,148.29 L282.71,148.26 L283.25,148.23 L283.78,148.20 L284.32,148.16 L284.86,148.13 + L285.39,148.09 L285.93,148.05 L286.01,148.05 L286.46,148.01 L287.00,147.96 L287.53,147.92 L288.07,147.88 L288.61,147.83 + L289.14,147.78 L289.68,147.73 L290.21,147.68 L290.75,147.62 L291.28,147.56 L291.82,147.50 L292.36,147.43 L292.46,147.41 + L292.89,147.35 L293.43,147.25 L293.96,147.15 L294.50,147.03 L295.03,146.91 L295.57,146.78 L296.10,146.63 L296.64,146.48 + L297.18,146.32 L297.71,146.16 L298.25,145.99 L298.78,145.82 L298.91,145.77 L299.32,145.62 L299.85,145.39 L300.39,145.11 + L300.93,144.82 L301.46,144.50 L302.00,144.18 L302.53,143.87 L303.07,143.57 L303.60,143.30 L304.14,143.06 L304.68,142.87 + L305.21,142.74 L305.35,142.72 L305.75,142.66 L306.28,142.59 L306.82,142.53 L307.35,142.48 L307.89,142.44 L308.42,142.40 + L308.96,142.36 L309.50,142.32 L310.03,142.28 L310.57,142.24 L311.10,142.19 L311.64,142.13 L311.80,142.12 L312.17,142.07 + L312.71,141.99 L313.25,141.91 L313.78,141.82 L314.32,141.73 L314.85,141.64 L315.39,141.54 L315.92,141.44 L316.46,141.34 + L317.00,141.23 L317.53,141.13 L318.07,141.03 L318.25,141.00 L318.60,140.94 L319.14,140.84 L319.67,140.73 L320.21,140.62 + L320.75,140.51 L321.28,140.40 L321.82,140.30 L322.35,140.19 L322.89,140.09 L323.42,140.00 L323.96,139.91 L324.49,139.83 + L324.69,139.81 L325.03,139.76 L325.57,139.69 L326.10,139.62 L326.64,139.55 L327.17,139.48 L327.71,139.41 L328.24,139.35 + L328.78,139.30 L329.32,139.25 L329.85,139.21 L330.39,139.17 L330.92,139.15 L331.14,139.14 L331.46,139.14 L331.99,139.13 + L332.53,139.12 L333.07,139.11 L333.60,139.10 L334.14,139.09 L334.67,139.09 L335.21,139.08 L335.74,139.07 L336.28,139.07 + L336.81,139.06 L337.35,139.05 L337.59,139.05 L337.89,139.05 L338.42,139.04 L338.96,139.04 L339.49,139.03 L340.03,139.02 + L340.56,139.02 L341.10,139.01 L341.64,139.01 L342.17,139.00 L342.71,138.99 L343.24,138.98 L343.78,138.97 L344.04,138.96 + L344.31,138.95 L344.85,138.91 L345.39,138.85 L345.92,138.78 L346.46,138.69 L346.99,138.59 L347.53,138.50 L348.06,138.40 + L348.60,138.32 L349.13,138.25 L349.67,138.20 L350.21,138.17 L350.48,138.16 L350.74,138.17 L351.28,138.23 L351.81,138.33 + L352.35,138.46 L352.88,138.62 L353.42,138.80 L353.96,138.98 L354.49,139.16 L355.03,139.32 L355.56,139.46 L356.10,139.57 + L356.63,139.62 L356.93,139.63 L357.17,139.63 L357.71,139.62 L358.24,139.60 L358.78,139.58 L359.31,139.54 L359.85,139.50 + L360.38,139.45 L360.92,139.39 L361.45,139.33 L361.99,139.26 L362.53,139.19 L363.06,139.11 L363.38,139.06 L363.60,139.02 + L364.13,138.84 L364.67,138.56 L365.20,138.22 L365.74,137.82 L366.28,137.39 L366.81,136.95 L367.35,136.51 L367.88,136.10 + L368.42,135.73 L368.95,135.43 L369.49,135.20 L369.83,135.11 L370.03,135.07 L370.56,134.98 L371.10,134.89 L371.63,134.81 + L372.17,134.75 L372.70,134.68 L373.24,134.63 L373.77,134.57 L374.31,134.52 L374.85,134.48 L375.38,134.43 L375.92,134.38 + L376.27,134.34 L376.45,134.32 L376.99,134.27 L377.52,134.22 L378.06,134.18 L378.60,134.13 L379.13,134.08 L379.67,134.04 + L380.20,134.00 L380.74,133.95 L381.27,133.91 L381.81,133.87 L382.35,133.82 L382.72,133.79 L382.88,133.78 L383.42,133.73 + L383.95,133.68 L384.49,133.62 L385.02,133.57 L385.56,133.51 L386.10,133.46 L386.63,133.41 L387.17,133.36 L387.70,133.33 + L388.24,133.30 L388.77,133.29 L389.17,133.28 L389.31,133.28 L389.84,133.32 L390.38,133.39 L390.92,133.50 L391.45,133.62 + L391.99,133.77 L392.52,133.91 L393.06,134.06 L393.59,134.19 L394.13,134.31 L394.67,134.40 L395.20,134.46 L395.61,134.47 + L395.74,134.47 L396.27,134.46 L396.81,134.45 L397.34,134.43 L397.88,134.40 L398.42,134.36 L398.95,134.32 L399.49,134.28 + L400.02,134.24 L400.56,134.19 L401.09,134.15 L401.63,134.10 L402.06,134.07 L402.16,134.06 L402.70,134.02 L403.24,133.97 + L403.77,133.92 L404.31,133.87 L404.84,133.82 L405.38,133.77 L405.91,133.71 L406.45,133.65 L406.99,133.59 L407.52,133.53 + L408.06,133.46 L408.51,133.41 L408.59,133.40 L409.13,133.33 L409.66,133.26 L410.20,133.19 L410.74,133.11 L411.27,133.03 + L411.81,132.95 L412.34,132.86 L412.88,132.78 L413.41,132.69 L413.95,132.60 L414.48,132.51 L414.96,132.43 L415.02,132.42 + L415.56,132.32 L416.09,132.21 L416.63,132.10 L417.16,131.98 L417.70,131.86 L418.23,131.74 L418.77,131.62 L419.31,131.51 + L419.84,131.40 L420.38,131.31 L420.91,131.23 L421.40,131.16 L421.45,131.16 L421.98,131.10 L422.52,131.05 L423.06,131.00 + L423.59,130.96 L424.13,130.92 L424.66,130.88 L425.20,130.84 L425.73,130.80 L426.27,130.77 L426.80,130.73 L427.34,130.69 + L427.85,130.65 L427.88,130.64 L428.41,130.59 L428.95,130.54 L429.48,130.48 L430.02,130.41 L430.55,130.35 L431.09,130.29 + L431.63,130.23 L432.16,130.18 L432.70,130.14 L433.23,130.10 L433.77,130.08 L434.30,130.07 L434.84,130.07 L435.38,130.08 + L435.91,130.08 L436.45,130.08 L436.98,130.08 L437.52,130.09 L438.05,130.09 L438.59,130.10 L439.12,130.10 L439.66,130.10 + L440.20,130.10 L440.73,130.10 L440.74,130.10 L441.27,130.08 L441.80,130.03 L442.34,129.94 L442.87,129.83 L443.41,129.70 + L443.95,129.57 L444.48,129.43 L445.02,129.29 L445.55,129.16 L446.09,129.05 L446.62,128.97 L447.16,128.91 L447.19,128.91 + L447.70,128.88 L448.23,128.85 L448.77,128.82 L449.30,128.79 L449.84,128.76 L450.37,128.74 L450.91,128.71 L451.45,128.69 + L451.98,128.68 L452.52,128.67 L453.05,128.66 L453.59,128.66 L453.64,128.66 L454.12,128.66 L454.66,128.67 L455.19,128.68 + L455.73,128.69 L456.27,128.71 L456.80,128.73 L457.34,128.74 L457.87,128.76 L458.41,128.78 L458.94,128.79 L459.48,128.80 + L460.02,128.80 L460.09,128.80 L460.55,128.79 L461.09,128.77 L461.62,128.74 L462.16,128.70 L462.69,128.65 L463.23,128.59 + L463.77,128.53 L464.30,128.46 L464.84,128.40 L465.37,128.34 L465.91,128.28 L466.44,128.23 L466.53,128.22 L466.98,128.18 + L467.51,128.12 L468.05,128.06 L468.59,128.00 L469.12,127.94 L469.66,127.88 L470.19,127.83 L470.73,127.78 L471.26,127.73 + L471.80,127.69 L472.34,127.67 L472.87,127.65 L472.98,127.65 L473.41,127.64 L473.94,127.63 L474.48,127.63 L475.01,127.63 + L475.55,127.62 L476.09,127.62 L476.62,127.62 L477.16,127.61 L477.69,127.61 L478.23,127.61 L478.76,127.60 L479.30,127.59 + L479.43,127.59 L479.83,127.55 L480.37,127.40 L480.91,127.15 L481.44,126.84 L481.98,126.46 L482.51,126.06 L483.05,125.64 + L483.58,125.22 L484.12,124.82 L484.66,124.46 L485.19,124.17 L485.73,123.95 L485.88,123.91 L486.26,123.81 L486.80,123.68 + L487.33,123.56 L487.87,123.45 L488.41,123.36 L488.94,123.26 L489.48,123.18 L490.01,123.10 L490.55,123.02 L491.08,122.95 + L491.62,122.88 L492.15,122.81 L492.32,122.78 L492.69,122.74 L493.23,122.67 L493.76,122.61 L494.30,122.55 L494.83,122.49 + L495.37,122.43 L495.90,122.38 L496.44,122.32 L496.98,122.27 L497.51,122.21 L498.05,122.15 L498.58,122.09 L498.77,122.07 + L499.12,122.03 L499.65,121.97 L500.19,121.91 L500.73,121.85 L501.26,121.79 L501.80,121.72 L502.33,121.66 L502.87,121.59 + L503.40,121.53 L503.94,121.45 L504.47,121.38 L505.01,121.30 L505.22,121.27 L505.55,121.21 L506.08,121.10 L506.62,120.97 + L507.15,120.83 L507.69,120.69 L508.22,120.54 L508.76,120.40 L509.30,120.26 L509.83,120.14 L510.37,120.04 L510.90,119.97 + L511.44,119.92 L511.66,119.91 L511.97,119.91 L512.51,119.90 L513.05,119.89 L513.58,119.88 L514.12,119.88 L514.65,119.87 + L515.19,119.87 L515.72,119.87 L516.26,119.86 L516.80,119.86 L517.33,119.85 L517.87,119.84 L518.11,119.83 L518.40,119.82 + L518.94,119.74 L519.47,119.61 L520.01,119.44 L520.54,119.25 L521.08,119.03 L521.62,118.82 L522.15,118.61 L522.69,118.42 + L523.22,118.26 L523.76,118.14 L524.29,118.08 L524.56,118.07 L524.83,118.07 L525.37,118.07 L525.90,118.07 L526.44,118.07 + L526.97,118.08 L527.51,118.08 L528.04,118.08 L528.58,118.09 L529.12,118.09 L529.65,118.09 L530.19,118.09 L530.72,118.10 + L531.01,118.10 L531.26,118.09 L531.79,118.08 L532.33,118.04 L532.86,117.99 L533.40,117.93 L533.94,117.86 L534.47,117.78 + L535.01,117.69 L535.54,117.60 L536.08,117.51 L536.61,117.41 L537.15,117.32 L537.45,117.27 L537.69,117.23 L538.22,117.12 + L538.76,117.01 L539.29,116.88 L539.83,116.75 L540.36,116.61 L540.90,116.47 L541.44,116.32 L541.97,116.18 L542.51,116.03 + L543.04,115.89 L543.58,115.76 L543.90,115.68 L544.11,115.63 L544.65,115.49 L545.18,115.33 L545.72,115.17 L546.26,115.01 + L546.79,114.84 L547.33,114.69 L547.86,114.55 L548.40,114.43 L548.93,114.32 L549.47,114.25 L550.01,114.21 L550.35,114.20 + L550.54,114.20 L551.08,114.21 L551.61,114.22 L552.15,114.24 L552.68,114.26 L553.22,114.29 L553.76,114.33 L554.29,114.37 + L554.83,114.41 L555.36,114.46 L555.90,114.51 L556.43,114.56 L556.79,114.60 L556.97,114.62 L557.50,114.72 L558.04,114.87 + L558.58,115.06 L559.11,115.28 L559.65,115.50 L560.18,115.74 L560.72,115.96 L561.25,116.16 L561.79,116.34 L562.33,116.47 + L562.86,116.55 L563.24,116.56 L563.40,116.56 L563.93,116.56 L564.47,116.55 L565.00,116.54 L565.54,116.53 L566.08,116.51 + L566.61,116.49 L567.15,116.47 L567.68,116.44 L568.22,116.42 L568.75,116.39 L569.29,116.37 L569.69,116.35 L569.82,116.34 + L570.36,116.30 L570.90,116.26 L571.43,116.20 L571.97,116.14 L572.50,116.07 L573.04,116.01 L573.57,115.94 L574.11,115.89 + L574.65,115.84 L575.18,115.80 L575.72,115.78 L576.14,115.77 L576.25,115.77 L576.79,115.82 L577.32,115.93 L577.86,116.08 + L578.40,116.26 L578.93,116.46 L579.47,116.68 L580.00,116.89 L580.54,117.09 L581.07,117.26 L581.61,117.39 L582.15,117.48 + L582.58,117.50 L582.68,117.50 L583.22,117.49 L583.75,117.47 L584.29,117.44 L584.82,117.40 L585.36,117.35 L585.89,117.30 + L586.43,117.24 L586.97,117.18 L587.50,117.12 L588.04,117.05 L588.57,116.99 L589.03,116.93 L589.11,116.92 L589.64,116.85 + L590.18,116.76 L590.72,116.66 L591.25,116.55 L591.79,116.44 L592.32,116.33 L592.86,116.22 L593.39,116.12 L593.93,116.03 + L594.47,115.95 L595.00,115.89 L595.48,115.85 L595.54,115.85 L596.07,115.82 L596.61,115.80 L597.14,115.79 L597.68,115.77 + L598.21,115.76 L598.75,115.75 L599.29,115.74 L599.82,115.72 L600.36,115.71 L600.89,115.69 L601.43,115.67 L601.93,115.64 + L601.96,115.64 L602.50,115.58 L603.04,115.49 L603.57,115.37 L604.11,115.23 L604.64,115.07 L605.18,114.91 L605.71,114.75 + L606.25,114.60 L606.79,114.47 L607.32,114.37 L607.86,114.30 L608.37,114.27 L608.39,114.27 L608.93,114.26 L609.46,114.26 + L610.00,114.25 L610.53,114.25 L611.07,114.24 L611.61,114.24 L612.14,114.24 L612.68,114.24 L613.21,114.23 L613.75,114.23 + L614.28,114.23 L614.55,114.23 L614.82,114.22 '/> RawL @@ -401,142 +401,142 @@ - + L118.38,191.62 L118.80,191.59 L119.34,191.48 L119.87,191.29 L120.41,191.05 L120.95,190.76 L121.48,190.43 L122.02,190.07 + L122.55,189.70 L123.09,189.33 L123.62,188.96 L124.16,188.61 L124.70,188.30 L124.83,188.22 L125.23,188.00 L125.77,187.69 + L126.30,187.36 L126.84,187.02 L127.37,186.69 L127.91,186.35 L128.44,186.03 L128.98,185.72 L129.52,185.43 L130.05,185.17 + L130.59,184.94 L131.12,184.75 L131.28,184.71 L131.66,184.60 L132.19,184.48 L132.73,184.37 L133.27,184.27 L133.80,184.19 + L134.34,184.11 L134.87,184.03 L135.41,183.94 L135.94,183.86 L136.48,183.76 L137.02,183.64 L137.55,183.51 L137.73,183.46 + L138.09,183.34 L138.62,183.11 L139.16,182.81 L139.69,182.47 L140.23,182.11 L140.76,181.74 L141.30,181.37 L141.84,181.03 + L142.37,180.72 L142.91,180.46 L143.44,180.28 L143.98,180.18 L144.17,180.17 L144.51,180.16 L145.05,180.15 L145.59,180.14 + L146.12,180.14 L146.66,180.13 L147.19,180.13 L147.73,180.13 L148.26,180.12 L148.80,180.12 L149.34,180.11 L149.87,180.11 + L150.41,180.09 L150.62,180.09 L150.94,180.06 L151.48,179.89 L152.01,179.60 L152.55,179.20 L153.08,178.72 L153.62,178.16 + L154.16,177.55 L154.69,176.90 L155.23,176.23 L155.76,175.56 L156.30,174.90 L156.83,174.27 L157.07,174.01 L157.37,173.67 + L157.91,172.99 L158.44,172.26 L158.98,171.48 L159.51,170.68 L160.05,169.87 L160.58,169.07 L161.12,168.29 L161.66,167.56 + L162.19,166.89 L162.73,166.31 L163.26,165.82 L163.51,165.63 L163.80,165.44 L164.33,165.10 L164.87,164.80 L165.40,164.52 + L165.94,164.27 L166.48,164.03 L167.01,163.81 L167.55,163.59 L168.08,163.37 L168.62,163.15 L169.15,162.92 L169.69,162.67 + L169.96,162.54 L170.23,162.42 L170.76,162.17 L171.30,161.94 L171.83,161.72 L172.37,161.50 L172.90,161.27 L173.44,161.04 + L173.98,160.78 L174.51,160.51 L175.05,160.21 L175.58,159.87 L176.12,159.50 L176.41,159.28 L176.65,159.06 L177.19,158.40 + L177.72,157.53 L178.26,156.51 L178.80,155.37 L179.33,154.16 L179.87,152.93 L180.40,151.72 L180.94,150.59 L181.47,149.57 + L182.01,148.70 L182.55,148.05 L182.86,147.78 L183.08,147.62 L183.62,147.29 L184.15,147.00 L184.69,146.76 L185.22,146.54 + L185.76,146.34 L186.30,146.15 L186.83,145.96 L187.37,145.77 L187.90,145.57 L188.44,145.33 L188.97,145.07 L189.30,144.89 + L189.51,144.77 L190.05,144.43 L190.58,144.06 L191.12,143.66 L191.65,143.24 L192.19,142.80 L192.72,142.34 L193.26,141.87 + L193.79,141.39 L194.33,140.90 L194.87,140.41 L195.40,139.92 L195.75,139.60 L195.94,139.42 L196.47,138.88 L197.01,138.29 + L197.54,137.66 L198.08,137.01 L198.62,136.36 L199.15,135.72 L199.69,135.10 L200.22,134.52 L200.76,134.00 L201.29,133.55 + L201.83,133.18 L202.20,132.98 L202.37,132.90 L202.90,132.67 L203.44,132.45 L203.97,132.25 L204.51,132.07 L205.04,131.90 + L205.58,131.75 L206.11,131.60 L206.65,131.47 L207.19,131.34 L207.72,131.22 L208.26,131.11 L208.64,131.03 L208.79,131.00 + L209.33,130.91 L209.86,130.82 L210.40,130.75 L210.94,130.68 L211.47,130.62 L212.01,130.55 L212.54,130.49 L213.08,130.42 + L213.61,130.34 L214.15,130.26 L214.69,130.16 L215.09,130.08 L215.22,130.05 L215.76,129.91 L216.29,129.74 L216.83,129.54 + L217.36,129.32 L217.90,129.09 L218.43,128.85 L218.97,128.60 L219.51,128.35 L220.04,128.11 L220.58,127.87 L221.11,127.64 + L221.54,127.48 L221.65,127.44 L222.18,127.24 L222.72,127.06 L223.26,126.89 L223.79,126.71 L224.33,126.54 L224.86,126.37 + L225.40,126.20 L225.93,126.02 L226.47,125.82 L227.01,125.62 L227.54,125.40 L227.99,125.20 L228.08,125.16 L228.61,124.87 + L229.15,124.52 L229.68,124.12 L230.22,123.70 L230.75,123.26 L231.29,122.82 L231.83,122.40 L232.36,122.00 L232.90,121.65 + L233.43,121.36 L233.97,121.14 L234.43,121.02 L234.50,121.01 L235.04,120.92 L235.58,120.86 L236.11,120.80 L236.65,120.76 + L237.18,120.72 L237.72,120.68 L238.25,120.64 L238.79,120.60 L239.33,120.56 L239.86,120.50 L240.40,120.43 L240.88,120.35 + L240.93,120.34 L241.47,120.18 L242.00,119.93 L242.54,119.60 L243.07,119.22 L243.61,118.79 L244.15,118.36 L244.68,117.92 + L245.22,117.50 L245.75,117.12 L246.29,116.80 L246.82,116.56 L247.33,116.41 L247.36,116.41 L247.90,116.32 L248.43,116.24 + L248.97,116.18 L249.50,116.13 L250.04,116.08 L250.57,116.04 L251.11,116.00 L251.65,115.96 L252.18,115.91 L252.72,115.85 + L253.25,115.78 L253.78,115.69 L253.79,115.69 L254.32,115.57 L254.86,115.41 L255.40,115.21 L255.93,114.98 L256.47,114.73 + L257.00,114.46 L257.54,114.17 L258.07,113.88 L258.61,113.59 L259.14,113.31 L259.68,113.04 L260.22,112.78 L260.75,112.52 + L261.29,112.25 L261.82,111.97 L262.36,111.68 L262.89,111.38 L263.43,111.10 L263.97,110.82 L264.50,110.56 L265.04,110.32 + L265.57,110.11 L266.11,109.92 L266.64,109.78 L266.67,109.77 L267.18,109.67 L267.72,109.57 L268.25,109.49 L268.79,109.42 + L269.32,109.36 L269.86,109.30 L270.39,109.24 L270.93,109.18 L271.46,109.11 L272.00,109.03 L272.54,108.93 L273.07,108.82 + L273.12,108.81 L273.61,108.66 L274.14,108.42 L274.68,108.12 L275.21,107.78 L275.75,107.41 L276.29,107.02 L276.82,106.63 + L277.36,106.26 L277.89,105.92 L278.43,105.63 L278.96,105.40 L279.50,105.24 L279.56,105.22 L280.04,105.14 L280.57,105.05 + L281.11,104.98 L281.64,104.92 L282.18,104.86 L282.71,104.81 L283.25,104.76 L283.78,104.71 L284.32,104.66 L284.86,104.61 + L285.39,104.55 L285.93,104.48 L286.01,104.47 L286.46,104.40 L287.00,104.33 L287.53,104.25 L288.07,104.17 L288.61,104.09 + L289.14,104.01 L289.68,103.92 L290.21,103.83 L290.75,103.73 L291.28,103.62 L291.82,103.50 L292.36,103.38 L292.46,103.36 + L292.89,103.24 L293.43,103.09 L293.96,102.91 L294.50,102.72 L295.03,102.51 L295.57,102.28 L296.10,102.05 L296.64,101.80 + L297.18,101.55 L297.71,101.29 L298.25,101.03 L298.78,100.76 L298.91,100.70 L299.32,100.48 L299.85,100.14 L300.39,99.77 + L300.93,99.37 L301.46,98.96 L302.00,98.54 L302.53,98.13 L303.07,97.74 L303.60,97.39 L304.14,97.08 L304.68,96.82 + L305.21,96.63 L305.35,96.59 L305.75,96.50 L306.28,96.40 L306.82,96.30 L307.35,96.22 L307.89,96.15 L308.42,96.09 + L308.96,96.03 L309.50,95.97 L310.03,95.90 L310.57,95.83 L311.10,95.75 L311.64,95.66 L311.80,95.63 L312.17,95.56 + L312.71,95.44 L313.25,95.31 L313.78,95.17 L314.32,95.02 L314.85,94.87 L315.39,94.72 L315.92,94.56 L316.46,94.40 + L317.00,94.25 L317.53,94.10 L318.07,93.96 L318.25,93.91 L318.60,93.82 L319.14,93.68 L319.67,93.53 L320.21,93.39 + L320.75,93.24 L321.28,93.10 L321.82,92.96 L322.35,92.83 L322.89,92.70 L323.42,92.57 L323.96,92.46 L324.49,92.35 + L324.69,92.32 L325.03,92.25 L325.57,92.16 L326.10,92.06 L326.64,91.96 L327.17,91.87 L327.71,91.78 L328.24,91.70 + L328.78,91.62 L329.32,91.55 L329.85,91.49 L330.39,91.45 L330.92,91.41 L331.14,91.40 L331.46,91.39 L331.99,91.37 + L332.53,91.35 L333.07,91.34 L333.60,91.32 L334.14,91.31 L334.67,91.30 L335.21,91.29 L335.74,91.28 L336.28,91.27 + L336.81,91.26 L337.35,91.24 L337.59,91.24 L337.89,91.23 L338.42,91.21 L338.96,91.20 L339.49,91.18 L340.03,91.16 + L340.56,91.14 L341.10,91.12 L341.64,91.10 L342.17,91.08 L342.71,91.05 L343.24,91.03 L343.78,90.99 L344.04,90.98 + L344.31,90.95 L344.85,90.88 L345.39,90.78 L345.92,90.65 L346.46,90.52 L346.99,90.37 L347.53,90.22 L348.06,90.08 + L348.60,89.95 L349.13,89.85 L349.67,89.77 L350.21,89.73 L350.48,89.72 L350.74,89.72 L351.28,89.76 L351.81,89.83 + L352.35,89.92 L352.88,90.05 L353.42,90.19 L353.96,90.36 L354.49,90.54 L355.03,90.74 L355.56,90.94 L356.10,91.16 + L356.63,91.38 L356.93,91.50 L357.17,91.61 L357.71,91.95 L358.24,92.39 L358.78,92.90 L359.31,93.47 L359.85,94.05 + L360.38,94.64 L360.92,95.19 L361.45,95.69 L361.99,96.10 L362.53,96.41 L363.06,96.59 L363.38,96.62 L363.60,96.58 + L364.13,96.23 L364.67,95.55 L365.20,94.60 L365.74,93.46 L366.28,92.20 L366.81,90.87 L367.35,89.55 L367.88,88.31 + L368.42,87.21 L368.95,86.32 L369.49,85.71 L369.83,85.49 L370.03,85.41 L370.56,85.20 L371.10,85.00 L371.63,84.81 + L372.17,84.64 L372.70,84.48 L373.24,84.35 L373.77,84.23 L374.31,84.13 L374.85,84.05 L375.38,84.00 L375.92,83.97 + L376.27,83.96 L376.45,83.96 L376.99,83.98 L377.52,84.01 L378.06,84.04 L378.60,84.09 L379.13,84.14 L379.67,84.19 + L380.20,84.25 L380.74,84.29 L381.27,84.34 L381.81,84.37 L382.35,84.39 L382.72,84.39 L382.88,84.39 L383.42,84.36 + L383.95,84.30 L384.49,84.22 L385.02,84.12 L385.56,84.00 L386.10,83.89 L386.63,83.77 L387.17,83.67 L387.70,83.58 + L388.24,83.51 L388.77,83.46 L389.17,83.45 L389.31,83.45 L389.84,83.50 L390.38,83.59 L390.92,83.71 L391.45,83.86 + L391.99,84.03 L392.52,84.21 L393.06,84.39 L393.59,84.55 L394.13,84.69 L394.67,84.80 L395.20,84.87 L395.61,84.88 + L395.74,84.88 L396.27,84.87 L396.81,84.83 L397.34,84.78 L397.88,84.71 L398.42,84.64 L398.95,84.55 L399.49,84.46 + L400.02,84.36 L400.56,84.26 L401.09,84.16 L401.63,84.07 L402.06,83.99 L402.16,83.98 L402.70,83.89 L403.24,83.80 + L403.77,83.70 L404.31,83.61 L404.84,83.51 L405.38,83.40 L405.91,83.30 L406.45,83.19 L406.99,83.08 L407.52,82.97 + L408.06,82.86 L408.51,82.76 L408.59,82.74 L409.13,82.62 L409.66,82.49 L410.20,82.37 L410.74,82.23 L411.27,82.10 + L411.81,81.96 L412.34,81.82 L412.88,81.68 L413.41,81.54 L413.95,81.40 L414.48,81.26 L414.96,81.13 L415.02,81.12 + L415.56,80.98 L416.09,80.83 L416.63,80.67 L417.16,80.52 L417.70,80.36 L418.23,80.21 L418.77,80.06 L419.31,79.91 + L419.84,79.78 L420.38,79.64 L420.91,79.52 L421.40,79.42 L421.45,79.41 L421.98,79.31 L422.52,79.22 L423.06,79.13 + L423.59,79.04 L424.13,78.96 L424.66,78.88 L425.20,78.81 L425.73,78.73 L426.27,78.66 L426.80,78.58 L427.34,78.50 + L427.85,78.43 L427.88,78.42 L428.41,78.34 L428.95,78.26 L429.48,78.17 L430.02,78.08 L430.55,78.00 L431.09,77.91 + L431.63,77.83 L432.16,77.75 L432.70,77.68 L433.23,77.61 L433.77,77.54 L434.30,77.49 L434.84,77.44 L435.38,77.40 + L435.91,77.37 L436.45,77.34 L436.98,77.31 L437.52,77.28 L438.05,77.25 L438.59,77.22 L439.12,77.18 L439.66,77.14 + L440.20,77.09 L440.73,77.03 L440.74,77.03 L441.27,76.95 L441.80,76.83 L442.34,76.67 L442.87,76.49 L443.41,76.29 + L443.95,76.07 L444.48,75.85 L445.02,75.63 L445.55,75.42 L446.09,75.22 L446.62,75.04 L447.16,74.88 L447.19,74.87 + L447.70,74.74 L448.23,74.60 L448.77,74.46 L449.30,74.33 L449.84,74.19 L450.37,74.07 L450.91,73.95 L451.45,73.84 + L451.98,73.74 L452.52,73.66 L453.05,73.59 L453.59,73.53 L453.64,73.53 L454.12,73.49 L454.66,73.46 L455.19,73.43 + L455.73,73.40 L456.27,73.38 L456.80,73.36 L457.34,73.34 L457.87,73.32 L458.41,73.30 L458.94,73.27 L459.48,73.24 + L460.02,73.20 L460.09,73.19 L460.55,73.15 L461.09,73.09 L461.62,73.01 L462.16,72.93 L462.69,72.83 L463.23,72.73 + L463.77,72.62 L464.30,72.51 L464.84,72.39 L465.37,72.28 L465.91,72.17 L466.44,72.06 L466.53,72.04 L466.98,71.95 + L467.51,71.82 L468.05,71.69 L468.59,71.56 L469.12,71.42 L469.66,71.28 L470.19,71.15 L470.73,71.02 L471.26,70.90 + L471.80,70.79 L472.34,70.70 L472.87,70.62 L472.98,70.61 L473.41,70.56 L473.94,70.51 L474.48,70.47 L475.01,70.44 + L475.55,70.41 L476.09,70.38 L476.62,70.35 L477.16,70.32 L477.69,70.28 L478.23,70.24 L478.76,70.18 L479.30,70.11 + L479.43,70.10 L479.83,69.99 L480.37,69.72 L480.91,69.34 L481.44,68.85 L481.98,68.30 L482.51,67.70 L483.05,67.08 + L483.58,66.46 L484.12,65.87 L484.66,65.34 L485.19,64.90 L485.73,64.55 L485.88,64.48 L486.26,64.31 L486.80,64.09 + L487.33,63.89 L487.87,63.71 L488.41,63.54 L488.94,63.38 L489.48,63.23 L490.01,63.09 L490.55,62.95 L491.08,62.81 + L491.62,62.68 L492.15,62.54 L492.32,62.50 L492.69,62.40 L493.23,62.27 L493.76,62.15 L494.30,62.03 L494.83,61.91 + L495.37,61.80 L495.90,61.69 L496.44,61.57 L496.98,61.45 L497.51,61.33 L498.05,61.20 L498.58,61.07 L498.77,61.02 + L499.12,60.92 L499.65,60.77 L500.19,60.62 L500.73,60.46 L501.26,60.29 L501.80,60.12 L502.33,59.95 L502.87,59.77 + L503.40,59.59 L503.94,59.40 L504.47,59.22 L505.01,59.03 L505.22,58.96 L505.55,58.84 L506.08,58.64 L506.62,58.41 + L507.15,58.18 L507.69,57.94 L508.22,57.70 L508.76,57.47 L509.30,57.25 L509.83,57.04 L510.37,56.84 L510.90,56.68 + L511.44,56.53 L511.66,56.48 L511.97,56.42 L512.51,56.33 L513.05,56.25 L513.58,56.18 L514.12,56.12 L514.65,56.06 + L515.19,56.00 L515.72,55.94 L516.26,55.88 L516.80,55.80 L517.33,55.72 L517.87,55.62 L518.11,55.57 L518.40,55.50 + L518.94,55.33 L519.47,55.11 L520.01,54.86 L520.54,54.58 L521.08,54.29 L521.62,53.99 L522.15,53.71 L522.69,53.44 + L523.22,53.20 L523.76,53.00 L524.29,52.85 L524.56,52.80 L524.83,52.75 L525.37,52.68 L525.90,52.61 L526.44,52.56 + L526.97,52.51 L527.51,52.46 L528.04,52.42 L528.58,52.38 L529.12,52.34 L529.65,52.29 L530.19,52.23 L530.72,52.16 + L531.01,52.12 L531.26,52.08 L531.79,52.00 L532.33,51.90 L532.86,51.79 L533.40,51.67 L533.94,51.54 L534.47,51.41 + L535.01,51.26 L535.54,51.11 L536.08,50.95 L536.61,50.79 L537.15,50.61 L537.45,50.51 L537.69,50.43 L538.22,50.22 + L538.76,49.99 L539.29,49.73 L539.83,49.45 L540.36,49.16 L540.90,48.87 L541.44,48.57 L541.97,48.27 L542.51,47.97 + L543.04,47.69 L543.58,47.42 L543.90,47.27 L544.11,47.17 L544.65,46.90 L545.18,46.61 L545.72,46.32 L546.26,46.02 + L546.79,45.73 L547.33,45.45 L547.86,45.19 L548.40,44.97 L548.93,44.79 L549.47,44.66 L550.01,44.58 L550.35,44.57 + L550.54,44.57 L551.08,44.57 L551.61,44.59 L552.15,44.61 L552.68,44.63 L553.22,44.66 L553.76,44.70 L554.29,44.73 + L554.83,44.78 L555.36,44.83 L555.90,44.88 L556.43,44.93 L556.79,44.97 L556.97,44.99 L557.50,45.11 L558.04,45.30 + L558.58,45.54 L559.11,45.81 L559.65,46.10 L560.18,46.39 L560.72,46.68 L561.25,46.94 L561.79,47.16 L562.33,47.33 + L562.86,47.44 L563.24,47.46 L563.40,47.46 L563.93,47.45 L564.47,47.44 L565.00,47.42 L565.54,47.40 L566.08,47.37 + L566.61,47.33 L567.15,47.29 L567.68,47.25 L568.22,47.21 L568.75,47.16 L569.29,47.12 L569.69,47.09 L569.82,47.07 + L570.36,47.01 L570.90,46.92 L571.43,46.82 L571.97,46.71 L572.50,46.59 L573.04,46.47 L573.57,46.35 L574.11,46.25 + L574.65,46.16 L575.18,46.10 L575.72,46.05 L576.14,46.04 L576.25,46.05 L576.79,46.09 L577.32,46.18 L577.86,46.31 + L578.40,46.47 L578.93,46.65 L579.47,46.84 L580.00,47.03 L580.54,47.20 L581.07,47.36 L581.61,47.47 L582.15,47.55 + L582.58,47.57 L582.68,47.57 L583.22,47.54 L583.75,47.48 L584.29,47.40 L584.82,47.29 L585.36,47.16 L585.89,47.02 + L586.43,46.87 L586.97,46.72 L587.50,46.56 L588.04,46.41 L588.57,46.26 L589.03,46.15 L589.11,46.13 L589.64,46.00 + L590.18,45.86 L590.72,45.71 L591.25,45.56 L591.79,45.40 L592.32,45.25 L592.86,45.10 L593.39,44.96 L593.93,44.83 + L594.47,44.71 L595.00,44.60 L595.48,44.52 L595.54,44.51 L596.07,44.43 L596.61,44.37 L597.14,44.31 L597.68,44.26 + L598.21,44.21 L598.75,44.16 L599.29,44.12 L599.82,44.06 L600.36,44.01 L600.89,43.94 L601.43,43.87 L601.93,43.79 + L601.96,43.78 L602.50,43.65 L603.04,43.46 L603.57,43.24 L604.11,42.98 L604.64,42.71 L605.18,42.43 L605.71,42.16 + L606.25,41.90 L606.79,41.68 L607.32,41.51 L607.86,41.39 L608.37,41.34 L608.39,41.34 L608.93,41.32 L609.46,41.31 + L610.00,41.30 L610.53,41.30 L611.07,41.29 L611.61,41.28 L612.14,41.28 L612.68,41.27 L613.21,41.27 L613.75,41.26 + L614.28,41.25 L614.55,41.25 L614.82,41.25 '/> diff --git a/Documentation/trouble-index.rst b/Documentation/trouble-index.rst index 4d07c85106..029c551fbb 100644 --- a/Documentation/trouble-index.rst +++ b/Documentation/trouble-index.rst @@ -9,8 +9,9 @@ for description and may need further explanation what needs to be done. Error: parent transid verify error ---------------------------------- -Reason: result of a failed internal consistency check of the filesystem's metadata. -Type: permanent +| Reason: result of a failed internal consistency check of the filesystem's metadata. +| Type: correctable by ``btrfs-scrub`` if a good copy exists on another replica; otherwise, permanent +| .. code-block:: none @@ -21,17 +22,26 @@ contains target block offset and generation that last changed this block. The block it points to then upon read verifies that the block address and the generation matches. This check is done on all tree levels. -The number in **faled on 30736384** is the logical block number, **wanted 10** +The number in **failed on 30736384** is the logical block number, **wanted 10** is the expected generation number in the parent node, **found 8** is the one found in the target block. The number difference between the generation can give a hint when the problem could have happened, in terms of transaction commits. -Once the mismatched generations are stored on the device, it's permanent and -cannot be easily recovered, because of information loss. The recovery tool -``btrfs restore`` is able to ignore the errors and attempt to restore the data -but due to the inconsistency in the metadata the data need to be verified by the -user. +Once the mismatched generations are stored on the device, without a good copy +from another replica, it's permanent and cannot be easily recovered because of +information loss. However, if a valid copy exists on another replica, btrfs will +transparently choose the good copy and overwrite the bad one with the correct +metadata to fix it permanently. +Manually running ``btrfs scrub`` in read-write mode will also do the same trick. + +Otherwise one can only salvage the data either through ``-o rescue=all,ro`` +mount option, which will try its best to read what is still intact. +Or through ``btrfs restore`` which can ignore the transid mismatch error to some +extent. + +The user needs to manually to verify the contents of salvaged data. +Since either way data checksum verification is no longer in place. The root cause of the error cannot be easily determined, possible reasons are: diff --git a/check/main.c b/check/main.c index d10cf05146..6290c6d4b9 100644 --- a/check/main.c +++ b/check/main.c @@ -9681,7 +9681,7 @@ static int zero_log_tree(struct btrfs_root *root) return ret; } -static int check_log_csum(struct btrfs_root *root, u64 addr, u64 length) +static int check_range_csummed(struct btrfs_root *root, u64 addr, u64 length) { struct btrfs_path path = { 0 }; struct btrfs_key key = { @@ -9694,6 +9694,10 @@ static int check_log_csum(struct btrfs_root *root, u64 addr, u64 length) u64 data_len; int ret; + /* Explicit holes don't get csummed */ + if (addr == 0) + return 0; + ret = btrfs_search_slot(NULL, root, &key, &path, 0, 0); if (ret < 0) return ret; @@ -9803,16 +9807,30 @@ static int check_log_root(struct btrfs_root *root, struct cache_tree *root_cache if (btrfs_file_extent_type(leaf, fi) != BTRFS_FILE_EXTENT_REG) goto next; - addr = btrfs_file_extent_disk_bytenr(leaf, fi) + - btrfs_file_extent_offset(leaf, fi); - length = btrfs_file_extent_num_bytes(leaf, fi); + if (btrfs_file_extent_compression(leaf, fi)) { + addr = btrfs_file_extent_disk_bytenr(leaf, fi); + length = btrfs_file_extent_disk_num_bytes(leaf, fi); + } else { + addr = btrfs_file_extent_disk_bytenr(leaf, fi) + + btrfs_file_extent_offset(leaf, fi); + length = btrfs_file_extent_num_bytes(leaf, fi); + } - ret = check_log_csum(root, addr, length); + ret = check_range_csummed(root, addr, length); if (ret < 0) { err = 1; break; } + if (ret) { + ret = check_range_csummed(btrfs_csum_root(gfs_info, 0), + addr, length); + if (ret < 0) { + err = 1; + break; + } + } + if (ret) { error( "csum missing in log (root %llu inode %llu offset %llu address 0x%llx length %llu)", diff --git a/cmds/receive.c b/cmds/receive.c index 4cc5b90094..4ac7601540 100644 --- a/cmds/receive.c +++ b/cmds/receive.c @@ -1555,7 +1555,8 @@ static int do_receive(struct btrfs_receive *rctx, const char *tomnt, error("failed to chdir to / after chroot: %m"); goto out; } - fprintf(stderr, "Chroot to %s\n", dest_dir_full_path); + if (bconf.verbose > BTRFS_BCONF_QUIET) + fprintf(stderr, "Chroot to %s\n", dest_dir_full_path); rctx->root_path = strdup("/"); rctx->dest_dir_path = rctx->root_path; } else { diff --git a/common/device-utils.c b/common/device-utils.c index c39e6d6166..56924acd79 100644 --- a/common/device-utils.c +++ b/common/device-utils.c @@ -22,6 +22,7 @@ #include #endif #include +#include #include #include #include diff --git a/common/help.c b/common/help.c index 6cf8e2a9b2..0ee00a3a13 100644 --- a/common/help.c +++ b/common/help.c @@ -309,10 +309,10 @@ static int usage_command_internal(const char * const *usagestr, ret = do_usage_one_command(usagestr, flags, cmd_flags, outf); switch (ret) { case -1: - fprintf(outf, "No usage for '%s'\n", token); + fprintf(outf, "No usage for '%s'\n", token ? : ""); break; case -2: - fprintf(outf, "No short description for '%s'\n", token); + fprintf(outf, "No short description for '%s'\n", token ? : ""); break; } diff --git a/common/utils.c b/common/utils.c index 3ca7cff396..9515abd47a 100644 --- a/common/utils.c +++ b/common/utils.c @@ -416,6 +416,7 @@ int ask_user(const char *question) char *answer; printf("%s [y/N]: ", question); + fflush(stdout); return fgets(buf, sizeof(buf) - 1, stdin) && (answer = strtok_r(buf, " \t\n\r", &saveptr)) && diff --git a/kernel-shared/print-tree.c b/kernel-shared/print-tree.c index ab85432e28..bd2117e637 100644 --- a/kernel-shared/print-tree.c +++ b/kernel-shared/print-tree.c @@ -183,9 +183,43 @@ static void print_inode_ref_item(struct extent_buffer *eb, u32 size, } } +struct readable_flag_entry { + u64 bit; + char *output; +}; + /* The minimal length for the string buffer of block group/chunk flags */ #define BG_FLAG_STRING_LEN 64 +static void sprint_readable_flag(char *restrict dest, u64 flag, + struct readable_flag_entry *array, + int array_size) +{ + int i; + u64 supported_flags = 0; + int cur = 0; + + dest[0] = '\0'; + for (i = 0; i < array_size; i++) + supported_flags |= array[i].bit; + + for (i = 0; i < array_size; i++) { + struct readable_flag_entry *entry = array + i; + + if ((flag & supported_flags) && (flag & entry->bit)) { + if (dest[0]) + cur += sprintf(dest + cur, "|"); + cur += sprintf(dest + cur, "%s", entry->output); + } + } + flag &= ~supported_flags; + if (flag) { + if (dest[0]) + cur += sprintf(dest + cur, "|"); + cur += sprintf(dest + cur, "UNKNOWN: 0x%llx", flag); + } +} + static void bg_flags_to_str(u64 flags, char *ret) { int empty = 1; @@ -932,37 +966,35 @@ static void print_uuid_item(struct extent_buffer *l, unsigned long offset, } } -/* Btrfs inode flag stringification helper */ -#define STRCAT_ONE_INODE_FLAG(flags, name, empty, dst) ({ \ - if (flags & BTRFS_INODE_##name) { \ - if (!empty) \ - strcat(dst, "|"); \ - strcat(dst, #name); \ - empty = 0; \ - } \ -}) +#define DEF_INODE_FLAG_ENTRY(name) \ + { BTRFS_INODE_##name, #name } + +static struct readable_flag_entry inode_flags_array[] = { + DEF_INODE_FLAG_ENTRY(NODATASUM), + DEF_INODE_FLAG_ENTRY(NODATACOW), + DEF_INODE_FLAG_ENTRY(READONLY), + DEF_INODE_FLAG_ENTRY(NOCOMPRESS), + DEF_INODE_FLAG_ENTRY(PREALLOC), + DEF_INODE_FLAG_ENTRY(SYNC), + DEF_INODE_FLAG_ENTRY(IMMUTABLE), + DEF_INODE_FLAG_ENTRY(APPEND), + DEF_INODE_FLAG_ENTRY(NODUMP), + DEF_INODE_FLAG_ENTRY(NOATIME), + DEF_INODE_FLAG_ENTRY(DIRSYNC), + DEF_INODE_FLAG_ENTRY(COMPRESS), + DEF_INODE_FLAG_ENTRY(ROOT_ITEM_INIT), +}; +static const int inode_flags_num = ARRAY_SIZE(inode_flags_array); /* - * Caller should ensure sizeof(*ret) >= 102: all characters plus '|' of - * BTRFS_INODE_* flags + * Caller should ensure sizeof(*ret) >= 129: all characters plus '|' of + * BTRFS_INODE_* flags + "UNKNOWN: 0xffffffffffffffff" */ static void inode_flags_to_str(u64 flags, char *ret) { - int empty = 1; - - STRCAT_ONE_INODE_FLAG(flags, NODATASUM, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, NODATACOW, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, READONLY, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, NOCOMPRESS, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, PREALLOC, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, SYNC, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, IMMUTABLE, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, APPEND, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, NODUMP, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, NOATIME, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, DIRSYNC, empty, ret); - STRCAT_ONE_INODE_FLAG(flags, COMPRESS, empty, ret); - if (empty) + sprint_readable_flag(ret, flags, inode_flags_array, inode_flags_num); + /* No flag hit at all, set the output to "none"*/ + if (!ret[0]) strcat(ret, "none"); } @@ -1876,11 +1908,6 @@ static int check_csum_sblock(void *sb, int csum_size, u16 csum_type) return !memcmp(sb, result, csum_size); } -struct readable_flag_entry { - u64 bit; - char *output; -}; - #define DEF_COMPAT_RO_FLAG_ENTRY(bit_name) \ {BTRFS_FEATURE_COMPAT_RO_##bit_name, #bit_name} @@ -1889,8 +1916,7 @@ static struct readable_flag_entry compat_ro_flags_array[] = { DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID), DEF_COMPAT_RO_FLAG_ENTRY(BLOCK_GROUP_TREE), }; -static const int compat_ro_flags_num = sizeof(compat_ro_flags_array) / - sizeof(struct readable_flag_entry); +static const int compat_ro_flags_num = ARRAY_SIZE(compat_ro_flags_array); #define DEF_INCOMPAT_FLAG_ENTRY(bit_name) \ {BTRFS_FEATURE_INCOMPAT_##bit_name, #bit_name} @@ -1913,8 +1939,7 @@ static struct readable_flag_entry incompat_flags_array[] = { DEF_INCOMPAT_FLAG_ENTRY(RAID_STRIPE_TREE), DEF_INCOMPAT_FLAG_ENTRY(SIMPLE_QUOTA), }; -static const int incompat_flags_num = sizeof(incompat_flags_array) / - sizeof(struct readable_flag_entry); +static const int incompat_flags_num = ARRAY_SIZE(incompat_flags_array); #define DEF_HEADER_FLAG_ENTRY(bit_name) \ {BTRFS_HEADER_FLAG_##bit_name, #bit_name} @@ -1935,13 +1960,17 @@ static struct readable_flag_entry super_flags_array[] = { }; static const int super_flags_num = ARRAY_SIZE(super_flags_array); -static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, - int array_size, u64 supported_flags) +static void print_readable_flag(u64 flag, struct readable_flag_entry *array, + int array_size) { int i; int first = 1; + u64 supported_flags = 0; struct readable_flag_entry *entry; + for (i = 0; i < array_size; i++) + supported_flags |= array[i].bit; + if (!flag) return; @@ -1968,33 +1997,20 @@ static void __print_readable_flag(u64 flag, struct readable_flag_entry *array, static void print_readable_compat_ro_flag(u64 flag) { - u64 print_flags = 0; - - for (int i = 0; i < compat_ro_flags_num; i++) - print_flags |= compat_ro_flags_array[i].bit; - return __print_readable_flag(flag, compat_ro_flags_array, - compat_ro_flags_num, - print_flags); + return print_readable_flag(flag, compat_ro_flags_array, + compat_ro_flags_num); } static void print_readable_incompat_flag(u64 flag) { - u64 print_flags = 0; - - for (int i = 0; i < incompat_flags_num; i++) - print_flags |= incompat_flags_array[i].bit; - return __print_readable_flag(flag, incompat_flags_array, - incompat_flags_num, print_flags); + return print_readable_flag(flag, incompat_flags_array, + incompat_flags_num); } static void print_readable_super_flag(u64 flag) { - u64 print_flags = 0; - - for (int i = 0; i < super_flags_num; i++) - print_flags |= super_flags_array[i].bit; - return __print_readable_flag(flag, super_flags_array, - super_flags_num, print_flags); + return print_readable_flag(flag, super_flags_array, + super_flags_num); } static void print_sys_chunk_array(struct btrfs_super_block *sb) diff --git a/libbtrfsutil/btrfsutil.h b/libbtrfsutil/btrfsutil.h index 010ccee7ac..59e87948e0 100644 --- a/libbtrfsutil/btrfsutil.h +++ b/libbtrfsutil/btrfsutil.h @@ -454,7 +454,7 @@ enum btrfs_util_error btrfs_util_subvolume_get_default_fd(int fd, uint64_t *id_r LIBBTRFSUTIL_ALIAS(btrfs_util_get_default_subvolume_fd); /** - * btrfs_util_set_default_subvolume() - Alias of btrfs_util_set_default_subvolume(), do not use in new code. + * btrfs_util_set_default_subvolume() - Alias of btrfs_util_subvolume_set_default(), do not use in new code. */ enum btrfs_util_error btrfs_util_set_default_subvolume(const char *path, uint64_t id); diff --git a/libbtrfsutil/python/MANIFEST.in b/libbtrfsutil/python/MANIFEST.in new file mode 100644 index 0000000000..b613db8ea9 --- /dev/null +++ b/libbtrfsutil/python/MANIFEST.in @@ -0,0 +1 @@ +include btrfsutilpy.h diff --git a/libbtrfsutil/python/README.md b/libbtrfsutil/python/README.md new file mode 120000 index 0000000000..32d46ee883 --- /dev/null +++ b/libbtrfsutil/python/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/libbtrfsutil/python/setup.py b/libbtrfsutil/python/setup.py index 37c0345097..bcbc4476da 100755 --- a/libbtrfsutil/python/setup.py +++ b/libbtrfsutil/python/setup.py @@ -97,9 +97,6 @@ def run(self): 'qgroup.c', 'subvolume.c', ], - headers=[ - 'btrfsutilpy.h' - ], include_dirs=['..'], library_dirs=['../..'], libraries=['btrfsutil'], @@ -109,8 +106,10 @@ def run(self): name='btrfsutil', # FIXME: version file is not present when building outside of git #version=get_version(), - version='6.10', + version='6.11', description='Library for managing Btrfs filesystems', + long_description=open('README.md').read(), + long_description_content_type='text/markdown', url='https://github.com/kdave/btrfs-progs', license='LGPLv2+', cmdclass={'build_ext': my_build_ext}, diff --git a/mkfs/main.c b/mkfs/main.c index 06cc2484e6..c9dbd234ca 100644 --- a/mkfs/main.c +++ b/mkfs/main.c @@ -440,7 +440,7 @@ static const char * const mkfs_usage[] = { "Creation:", OPTLINE("-b|--byte-count SIZE", "set size of each device to SIZE (filesystem size is sum of all device sizes)"), OPTLINE("-r|--rootdir DIR", "copy files from DIR to the image root directory"), - OPTLINE("-u|--subvol SUBDIR:FLAGS", "create SUBDIR as subvolume rather than normal directory, can be specified multiple times"), + OPTLINE("-u|--subvol TYPE:SUBDIR", "create SUBDIR as subvolume rather than normal directory, can be specified multiple times"), OPTLINE("--shrink", "(with --rootdir) shrink the filled filesystem to minimal size"), OPTLINE("-K|--nodiscard", "do not perform whole device TRIM"), OPTLINE("-f|--force", "force overwrite of existing filesystem"), @@ -1015,48 +1015,6 @@ static void *prepare_one_device(void *ctx) return NULL; } -static int parse_subvol_flags(struct rootdir_subvol *subvol, const char *flags) -{ - char *buf, *orig_buf; - int ret; - - buf = orig_buf = strdup(flags); - - if (!buf) { - error_msg(ERROR_MSG_MEMORY, NULL); - ret = -ENOMEM; - goto out; - } - - while (true) { - char *comma = strstr(buf, ","); - - if (comma) - *comma = 0; - - if (!strcmp(buf, "default")) { - subvol->is_default = true; - } else if (!strcmp(buf, "ro")) { - subvol->readonly = true; - } else if (buf[0] != 0) { - error("unrecognized subvol flag \"%s\"", buf); - ret = 1; - goto out; - } - - if (comma) - buf = comma + 1; - else - break; - } - - ret = 0; - -out: - free(orig_buf); - return ret; -} - int BOX_MAIN(mkfs)(int argc, char **argv) { char *file; @@ -1098,7 +1056,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv) char *label = NULL; int nr_global_roots = sysconf(_SC_NPROCESSORS_ONLN); char *source_dir = NULL; - size_t source_dir_len = 0; struct rootdir_subvol *rds; bool has_default_subvol = false; LIST_HEAD(subvols); @@ -1259,6 +1216,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) case 'u': { struct rootdir_subvol *subvol; char *colon; + bool valid_prefix = false; subvol = calloc(1, sizeof(struct rootdir_subvol)); if (!subvol) { @@ -1270,32 +1228,32 @@ int BOX_MAIN(mkfs)(int argc, char **argv) colon = strstr(optarg, ":"); if (colon) { - /* Make sure we choose the last colon in - * optarg, in case the subvol name - * itself contains a colon. */ - do { - char *colon2; - - colon2 = strstr(colon + 1, ":"); - - if (colon2) - colon = colon2; - else - break; - } while (true); - - subvol->dir = strndup(optarg, colon - optarg); - if (parse_subvol_flags(subvol, colon + 1)) { - ret = 1; - goto error; + if (!string_has_prefix(optarg, "default:")) { + subvol->is_default = true; + valid_prefix = true; + } else if (!string_has_prefix(optarg, "ro:")) { + subvol->readonly = true; + valid_prefix = true; + } else if (!string_has_prefix(optarg, "rw:")) { + subvol->readonly = false; + valid_prefix = true; + } else if (!string_has_prefix(optarg, "default-ro:")) { + subvol->is_default = true; + subvol->readonly = true; + valid_prefix = true; } - } else { - subvol->dir = strdup(optarg); + } + + if (arg_copy_path(subvol->dir, valid_prefix ? colon + 1 : optarg, + sizeof(subvol->dir))) { + error("--subvol path too long"); + ret = 1; + goto error; } if (subvol->is_default) { if (has_default_subvol) { - error("subvol default flag can only be specified once"); + error("default subvol can only be specified once"); ret = 1; goto error; } @@ -1386,57 +1344,37 @@ int BOX_MAIN(mkfs)(int argc, char **argv) free(source_dir); source_dir = canonical; - source_dir_len = strlen(source_dir); } list_for_each_entry(rds, &subvols, list) { - char *path, *canonical; + char path[PATH_MAX]; struct rootdir_subvol *rds2; - size_t dir_len; - - dir_len = strlen(rds->dir); - path = malloc(source_dir_len + 1 + dir_len + 1); - if (!path) { - error_msg(ERROR_MSG_MEMORY, NULL); + if (path_cat_out(path, source_dir, rds->dir)) { + error("path invalid"); ret = 1; goto error; } - memcpy(path, source_dir, source_dir_len); - path[source_dir_len] = '/'; - memcpy(path + source_dir_len + 1, rds->dir, dir_len + 1); - - canonical = realpath(path, NULL); - if (!canonical) { + if (!realpath(path, rds->full_path)) { error("could not get canonical path to %s", rds->dir); - free(path); ret = 1; goto error; } - free(path); - path = canonical; - - if (!path_exists(path)) { + if (!path_exists(rds->full_path)) { error("subvolume %s does not exist", rds->dir); - free(path); ret = 1; goto error; } - if (!path_is_dir(path)) { + if (!path_is_dir(rds->full_path)) { error("subvolume %s is not a directory", rds->dir); - free(path); ret = 1; goto error; } - rds->full_path = path; - - if (strlen(path) < source_dir_len + 1 || - memcmp(path, source_dir, source_dir_len) != 0 || - path[source_dir_len] != '/') { + if (!path_is_in_dir(source_dir, rds->full_path)) { error("subvolume %s is not a child of %s", rds->dir, source_dir); ret = 1; goto error; @@ -1445,7 +1383,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv) for (rds2 = list_first_entry(&subvols, struct rootdir_subvol, list); rds2 != rds; rds2 = list_next_entry(rds2, list)) { - if (strcmp(rds2->full_path, path) == 0) { + if (strcmp(rds2->full_path, rds->full_path) == 0) { error("subvolume %s specified more than once", rds->dir); ret = 1; goto error; @@ -2156,8 +2094,6 @@ int BOX_MAIN(mkfs)(int argc, char **argv) struct rootdir_subvol *head; head = list_entry(subvols.next, struct rootdir_subvol, list); - free(head->dir); - free(head->full_path); list_del(&head->list); free(head); } diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c index 70cf0f84de..ffe9aa1f9a 100644 --- a/mkfs/rootdir.c +++ b/mkfs/rootdir.c @@ -711,9 +711,6 @@ static int ftw_add_inode(const char *full_path, const struct stat *st, ret = ftw_add_subvol(full_path, st, typeflag, ftwbuf, rds); - free(rds->dir); - free(rds->full_path); - list_del(&rds->list); free(rds); diff --git a/mkfs/rootdir.h b/mkfs/rootdir.h index 44817374ed..9db6ff4de3 100644 --- a/mkfs/rootdir.h +++ b/mkfs/rootdir.h @@ -30,8 +30,8 @@ struct btrfs_root; struct rootdir_subvol { struct list_head list; - char *dir; - char *full_path; + char dir[PATH_MAX]; + char full_path[PATH_MAX]; bool is_default; bool readonly; }; diff --git a/tests/fsck-tests/065-valid-log-tree/already-present.img.xz b/tests/fsck-tests/065-valid-log-tree/already-present.img.xz new file mode 100644 index 0000000000..e03ad53088 Binary files /dev/null and b/tests/fsck-tests/065-valid-log-tree/already-present.img.xz differ diff --git a/tests/fsck-tests/065-valid-log-tree/compressed.img.xz b/tests/fsck-tests/065-valid-log-tree/compressed.img.xz new file mode 100644 index 0000000000..b26ebbf0ef Binary files /dev/null and b/tests/fsck-tests/065-valid-log-tree/compressed.img.xz differ diff --git a/tests/fsck-tests/065-valid-log-tree/hole.img.xz b/tests/fsck-tests/065-valid-log-tree/hole.img.xz new file mode 100644 index 0000000000..bdbc53a251 Binary files /dev/null and b/tests/fsck-tests/065-valid-log-tree/hole.img.xz differ diff --git a/tests/fsck-tests/065-valid-log-tree/test.sh b/tests/fsck-tests/065-valid-log-tree/test.sh new file mode 100755 index 0000000000..b9221a4c83 --- /dev/null +++ b/tests/fsck-tests/065-valid-log-tree/test.sh @@ -0,0 +1,13 @@ +#!/bin/bash +# +# Verify that check doesn't cause false alerts on various valid log trees + +source "$TEST_TOP/common" || exit + +check_prereq btrfs + +check_image() { + run_check "$TOP/btrfs" check "$1" +} + +check_all_images diff --git a/tests/mkfs-tests/036-rootdir-subvol/test.sh b/tests/mkfs-tests/036-rootdir-subvol/test.sh index e4ae604ed0..53514cb31f 100755 --- a/tests/mkfs-tests/036-rootdir-subvol/test.sh +++ b/tests/mkfs-tests/036-rootdir-subvol/test.sh @@ -18,12 +18,21 @@ basic() run_check mkdir "$tmp/dir/subvol" run_check touch "$tmp/dir/subvol/bar" - run_check_mkfs_test_dev --rootdir "$tmp" --subvol dir/subvol + if [ "$1" != "" ]; then + run_check_mkfs_test_dev --rootdir "$tmp" --subvol $1:dir/subvol + else + run_check_mkfs_test_dev --rootdir "$tmp" --subvol dir/subvol + fi + run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" - run_check_mount_test_dev + run_check_mount_test_dev -o subvolid=5 run_check_stdout $SUDO_HELPER "$TOP/btrfs" subvolume list "$TEST_MNT" | \ cut -d\ -f9 > "$tmp/output" + run_check_stdout "$TOP/btrfs" property get "$TEST_MNT/dir/subvol" ro | \ + cut -d = -f2 > "$tmp/output2" + run_check_stdout "$TOP/btrfs" subvolume get-default "$TEST_MNT" | \ + cut -d\ -f2 > "$tmp/output3" run_check_umount_test_dev result=$(cat "$tmp/output") @@ -31,6 +40,31 @@ basic() if [ "$result" != "dir/subvol" ]; then _fail "dir/subvol not in subvolume list" fi + + result=$(cat "$tmp/output2") + + if [ "$1" == "ro" -o "$1" == "default-ro" ]; then + if [ "$result" != "true" ]; then + _fail "dir/subvol was read-write, expected read-only" + fi + else + if [ "$result" != "false" ]; then + _fail "dir/subvol was read-only, expected read-write" + fi + fi + + result=$(cat "$tmp/output3") + + if [ "$1" == "default" -o "$1" == "default-ro" ]; then + if [ "$result" != "256" ]; then + _fail "default subvol was $result, expected 256" + fi + else + if [ "$result" != "5" ]; then + _fail "default subvol was $result, expected 5" + fi + fi + rm -rf -- "$tmp/foo" "$tmp/dir" } @@ -61,10 +95,15 @@ split_by_subvolume_hardlinks() run_check mkdir "$tmp/subv" run_check ln "$tmp/hl1" "$tmp/subv/hl3" - run_check_mkfs_test_dev --rootdir "$tmp" --subvol subv + if [ "$1" != "" ]; then + run_check_mkfs_test_dev --rootdir "$tmp" --subvol $1:subv + else + run_check_mkfs_test_dev --rootdir "$tmp" --subvol subv + fi + run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" - run_check_mount_test_dev + run_check_mount_test_dev -o subvolid=5 nr_hardlink=$(run_check_stdout $SUDO_HELPER stat -c "%h" "$TEST_MNT/hl1") if [ "$nr_hardlink" -ne 2 ]; then @@ -76,10 +115,14 @@ split_by_subvolume_hardlinks() _fail "hard link number incorrect for subv/hl3, has ${nr_hardlink} expect 1" fi run_check_umount_test_dev - rm -rf -- "$tmp/hl1" "$tmp/hl2" "$tmp/dir" + rm -rf -- "$tmp/hl1" "$tmp/hl2" "$tmp/subv" } -basic +for mod in "" ro rw default default-ro; +do + basic $mod + split_by_subvolume_hardlinks $mod +done + basic_hardlinks -split_by_subvolume_hardlinks rm -rf -- "$tmp"