diff -pruN 6.17-1/CHANGES 6.17.1-1/CHANGES
--- 6.17-1/CHANGES	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/CHANGES	2025-11-07 09:04:55.000000000 +0000
@@ -17,6 +17,20 @@ btrfs-progs-6.17 (2025-09-29)
       * cleanups, refactoring
       * documentation updates
 
+btrfs-progs-6.17.1 (2025-11-07)
+"""""""""""""""""""""""""""""""
+   * dump-tree: print compat-ro bit for fs-verity
+   * check: add ability to repair orphan device extents so kernel does not
+     refuse to mount such filesystem due to strict checks
+   * convert:
+      * print label if it's being copied from the source filesystem
+      * drop alignment check of chunk length, kernel workaround is in place
+   * scrub and device replace: document behaviour in 6.19+ that
+     freezing/suspend will cancel the operation
+   * other:
+      * documentation fixes and updates
+      * updated tests
+
 btrfs-progs-6.16 (2025-08-13)
 -----------------------------
    * mkfs:
diff -pruN 6.17-1/Documentation/Feature-by-version.rst 6.17.1-1/Documentation/Feature-by-version.rst
--- 6.17-1/Documentation/Feature-by-version.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/Feature-by-version.rst	2025-11-07 09:04:55.000000000 +0000
@@ -177,7 +177,7 @@ features see :doc:`Status<Status>` page.
 6.12 (stable)
 -------------
 
--6.12 - cancellable discard/TRIM
+6.12 - cancellable discard/TRIM
         Add more points where the discard can be interrupted by signals before
         it finishes the whole operation.
 
@@ -237,6 +237,9 @@ features see :doc:`Status<Status>` page.
         The defrag ioctl also accepts the negative zstd levels that can be set as
         mount option.
 
+6.16 - *standalone mount option nologreplay removed*
+        Deprecated in 5.9 and replaced with *rescue=nologreplay*.
+
 6.17 (latest)
 -------------
 
@@ -261,6 +264,18 @@ features see :doc:`Status<Status>` page.
         File holes, ranges not representing data, were emulated by a zero
         filled data. This is less efficient than puching holes.
 
+6.18 - *move rev-verify feature under CONFIG_BTRFS_DEBUG*
+        Config option CONFIG_BTRFS_FS_REF_VERIFY has been removed and the
+        debugging functionality of *ref-verify* moved under CONFIG_BTRFS_DEBUG.
+
+6.18 - *new mount option ref_tracker for reference tracking*
+        A debugging feature to track references (now implemented for delayed
+        refs) and report leaks eventually.
+
+6.18 - *experimental* enable block size > page size support
+        Initial support for *bs > ps* with limitations (no direct IO, raid56,
+        encoded read/write).
+
 5.x
 ---
 
diff -pruN 6.17-1/Documentation/Status.rst 6.17.1-1/Documentation/Status.rst
--- 6.17-1/Documentation/Status.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/Status.rst	2025-11-07 09:04:55.000000000 +0000
@@ -14,7 +14,7 @@ suitable for all use cases or workloads,
 Combination of features can vary in performance, the table does not
 cover all possibilities.
 
-**The table is based on the latest released linux kernel: 6.13**
+**The table is based on the latest released linux kernel: 6.17**
 
 Since kernel version 6.12 there's a config option *CONFIG_BTRFS_EXPERIMENTAL*
 that enables features that are in development and do not have stabilized
@@ -35,6 +35,13 @@ in following ways:
 -  **Unstable**: do not use for other then testing purposes, known
    severe problems, missing implementation of some core parts
 
+Please open a github issue if:
+
+-  there's a known missing entry
+-  a particular feature combination that has a different status and is
+   worth mentioning separately
+-  you know of a bug that lowers the feature status
+
 .. role:: statusok
 .. role:: statusmok
 .. role:: statusunstable
@@ -300,13 +307,6 @@ Integration with other Linux features or
      - OK
      - compression, server-side copies, snapshots
 
-Please open an issue if:
-
--  there's a known missing entry
--  a particular feature combination that has a different status and is
-   worth mentioning separately
--  you know of a bug that lowers the feature status
-
 .. _status-subpage-block-size:
 
 Subpage block size
diff -pruN 6.17-1/Documentation/btrfs-replace.rst 6.17.1-1/Documentation/btrfs-replace.rst
--- 6.17-1/Documentation/btrfs-replace.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/btrfs-replace.rst	2025-11-07 09:04:55.000000000 +0000
@@ -37,6 +37,18 @@ start [options] <srcdev>|<devid> <target
                 larger target device; this can be achieved with
                 ``btrfs filesystem resize <devid>:max /path``
 
+	.. note::
+		Device replace can be interrupted by various events after v6.19 kernel,
+		including but not limited to power management suspend/hibernate,
+		filesystem freezing, cgroup freezing (utilized by systemd for slice freezing)
+		and pending signals.
+
+		The running device replace will be cancelled after such interruption, and
+		the end user needs to restart the device replace from the beginning.
+
+		Thus it's recommended to inhibit suspend/hiberate before executing the
+		device replace operation.
+
         ``Options``
 
         -r
diff -pruN 6.17-1/Documentation/ch-checksumming.rst 6.17.1-1/Documentation/ch-checksumming.rst
--- 6.17-1/Documentation/ch-checksumming.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/ch-checksumming.rst	2025-11-07 09:04:55.000000000 +0000
@@ -75,11 +75,15 @@ BLAKE2b          14500        34  builti
 ========  ============   =======  ================================
 
 Many kernels are configured with SHA256 as built-in and not as a module.
-The accelerated versions are however provided by the modules and must be loaded
+Up to kernel v6.15 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.
+
+Since kernel v6.16 the accelereated implementation is always used if available.
+
 Check the file :file:`/proc/crypto`, when the implementation is built-in, you'd find:
 
 .. code-block:: none
diff -pruN 6.17-1/Documentation/ch-compression.rst 6.17.1-1/Documentation/ch-compression.rst
--- 6.17-1/Documentation/ch-compression.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/ch-compression.rst	2025-11-07 09:04:55.000000000 +0000
@@ -58,8 +58,9 @@ cause noticeable performance drops.
    $ btrfs filesystem defrag -czstd file
 
 The command above will start defragmentation of the whole *file* and apply
-the compression, regardless of the mount option. (Note: specifying level is not
-yet implemented). The compression algorithm is not persistent and applies only
+the compression, regardless of the mount option. The compression level can be
+also specified with the ``--level`` or ``-L`` argument as of version ``6.14``.
+The compression algorithm is not persistent and applies only
 to the defragmentation command, for any other writes other compression settings
 apply.
 
diff -pruN 6.17-1/Documentation/ch-scrub-intro.rst 6.17.1-1/Documentation/ch-scrub-intro.rst
--- 6.17-1/Documentation/ch-scrub-intro.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/ch-scrub-intro.rst	2025-11-07 09:04:55.000000000 +0000
@@ -56,6 +56,14 @@ read-write mounted filesystem.
    To avoid any writes from scrub, one has to run read-only scrub on read-only
    filesystem.
 
+.. note::
+   Scrub can be interrupted by various events after v6.19 kernel, including
+   but not limited to power management suspend/hibernate, filesystem freezing,
+   cgroup freezing (utilized by systemd for slice freezing) and pending signals.
+
+   The running scrub will be cancelled after such interruption, and can be resumed
+   by :command:`btrfs scrub resume` command.
+
 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
 utilization is about 80% on an idle filesystem.
diff -pruN 6.17-1/Documentation/conf.py 6.17.1-1/Documentation/conf.py
--- 6.17-1/Documentation/conf.py	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/conf.py	2025-11-07 09:04:55.000000000 +0000
@@ -159,7 +159,6 @@ class DupLabelDirective(Directive):
 # - format is strict
 # - html link target is not validated
 def role_manref(name, rawtext, text, lineno, inliner, options={}, content=[]):
-    env = inliner.document.settings.env
     name, number = text.split('(', 1)
     number = number.split(')')[0]
 
diff -pruN 6.17-1/Documentation/dev/Development-notes.rst 6.17.1-1/Documentation/dev/Development-notes.rst
--- 6.17-1/Documentation/dev/Development-notes.rst	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/Documentation/dev/Development-notes.rst	2025-11-07 09:04:55.000000000 +0000
@@ -230,24 +230,25 @@ already there.*
 Patches
 ^^^^^^^
 
--  for patch subject use "btrfs:" followed by a lowercase
+-  for patch subject use ``btrfs:`` followed by a lowercase
 -  read the patch again and fix all typos and grammar
 -  size units should use short form K/M/G/T or IEC form KiB/MiB/GiB
 -  don't write references to parameters to subject (like removing @pointer)
 -  do not end subject with a dot '.'
 -  parts of btrfs that could have a subject prefix to point to a specific subsystem
 
-    -  scrub, tests, integrity-checker, tree-checker, discard, locking, sysfs,
-       raid56, qgroup, compression, send, ioctl
+   -  scrub, tests, integrity-checker, tree-checker, discard, locking, sysfs,
+      raid56, qgroup, compression, send, ioctl
 
 -  additional information
 
-    -  if there's a stack trace relevant for the patch, add it there (lockdep,
-       crash, warning)
-    -  steps to reproduce a bug (that will also get turned to a proper fstests
-       case)
-    -  sample output before/after if it could have impact on userspace
-    -  `pahole <https://linux.die.net/man/1/pahole>`_ output if structure is being reorganized and optimized
+   -  if there's a stack trace relevant for the patch, add it there (lockdep,
+      crash, warning)
+   -  steps to reproduce a bug (that will also get turned to a proper fstests
+      case)
+   -  sample output before/after if it could have impact on userspace
+   -  `pahole <https://linux.die.net/man/1/pahole>`__ output if structure is
+      being reorganized and optimized
 
 Function declarations
 ^^^^^^^^^^^^^^^^^^^^^
@@ -257,14 +258,14 @@ Function declarations
 
    -  but don't move static functions just to get rid of the prototype
 
--  exported functions have btrfs\_ prefix
+-  exported functions have ``btrfs_`` prefix
 -  do not use functions with double underscore, there's only a few valid uses of
    that, namely when *\__function* is doing the core of the work with looser
    checks, no locks or more parameters than *function*
 -  function type and name are on the same line, if this is too long, the
    parameters continue on the next line (indented)
--  'static inline' functions should be small (measured by their resulting binary
-   size)
+-  ``static inline`` functions should be small (measured by their resulting binary
+   size) and not used in .c unless it's justified that inlining makes a difference
 -  conditional definitions should follow the style below, where the full
    function body is in .c
 
@@ -279,16 +280,18 @@ Function declarations
 Headers
 ^^^^^^^
 
--  leave one newline before #endif in headers
+-  leave one newline before ``#endif`` in headers
 -  include headers that add usage of a data structure or API, also remove such
    header with last use of the API
+-  keep the includes in headers self-contained and compilable, add forward
+   declarations for types if possible
 
 Comments
 ^^^^^^^^
 
 -  function comment goes to the .c file, not the header
 
-   -  kdoc style is recommended but the exact syntax is not mandated and
+   -  ``kdoc style`` is recommended but the exact syntax is not mandated and
       we're using only subset of the formatting
    -  the first line (mandatory): contains a brief description of what
       the function does and should provide a summary information
@@ -321,9 +324,9 @@ Comments
     * Return value semantics if it's not obvious
     */
 
--  comment new enum/define values, brief description or pointers to the code
+-  comment new ``enum/define`` values, brief description or pointers to the code
    that uses them
--  comment new data structures, their purpose and context of use
+-  comment new ``data structures``, their purpose and context of use
 -  do not put struct member comments on the same line, put it on the line
    before and do not trim/abbreviate the text
 -  comment text that fits on one line can use the */\* text \*/* format, slight
@@ -345,29 +348,37 @@ Locking
 -  do not use ``spin_is_locked`` but ``lockdep_assert_held``
 -  do not use ``assert_spin_locked`` without reading it's semantics (it does
    not check if the caller hold the lock)
--  use ``lockdep_assert_held`` and its friends for lock assertions
+-  use ``lockdep_assert_held`` and its friends for lock assertions (``lockdep_assert_not_held``,
+   ``lockdep_assert_held_write``)
 -  add lock assertions to functions called deep in the call chain
+-  *(to be decided)* do not use ``scoped_guard()`` instead of explicit locking section
+-  *(to be decided)* using ``guard()`` is possible in justified cases where it improves
+   readability, i.e. short function (20 lines) with entire body under one lock
 
 Code
 ^^^^
 
--  default function return value is *int ret*, temporary return values should
-   be named like *ret2* etc
--  structure initializers should use *{ 0 }*
--  do not use *short int* type if possible, if it fits to char/u8 use it instead,
+-  default function return value is ``int ret``, temporary return values should
+   be named like ``ret2`` etc
+-  structure initializers should use ``{ 0 }``
+-  do not use ``short int`` type if possible, if it fits to char/u8 use it instead,
    or plain int/u32
 -  memory barriers need to be always documented
--  add *const* to parameters that are not modified
--  use bool for indicators and bool status variables (not int)
+-  add ``const`` to parameters that are not modified
+-  use ``bool`` for indicators and bool status variables (not int)
 -  use matching int types (size, signedness), with exceptions
--  use ENUM_BIT for enumerated bit values (that don't have assigned fixed numbers)
--  add function annotations __cold, __init, __attribute_const__ if applicable
+-  use ``ENUM_BIT`` for enumerated bit values (that don't have assigned fixed numbers)
+-  add function annotations ``__cold``, ``__init``, ``__attribute_const__`` if applicable
 -  use automatic variable cleanup for:
-   -  *struct btrfs_path* with BTRFS_PATH_AUTO_FREE
+
+   -  *struct btrfs_path* with ``BTRFS_PATH_AUTO_FREE``
+   -  any variable allocated by *kmalloc/kfree* using ``AUTO_KFREE`` or ``AUTO_KVFREE``
+   -  for structures sparsely used do ``__free(...)`` when it does not make sense
+      to define the cleanup macro
 -  use of ``unlikely()`` annotation is OK and recommended for the following cases:
 
    -  control flow of the function is changed due to error handling and it
-      leads to *never-happens* errors like EUCLEAN, EIO
+      leads to *never-happens* errors like ``EUCLEAN``, ``EIO``
 
 Output
 ^^^^^^
@@ -381,13 +392,13 @@ Output
 Expressions, operators
 ^^^^^^^^^^^^^^^^^^^^^^
 
--  spaces around binary operators, no spaces for unary operators
+-  spaces around ``binary operators``, no spaces for unary operators
 -  extra braces around expressions that might be harder to understand wrt
    precedence are fine (logical and/or, shifts with other operations)
 
    -  *a \* b + c*, *(a << b) + c*, *(a % b) + c*
 
--  64bit division is not allowed, either avoid it completely, or use bit
+-  ``64bit division`` is not allowed, either avoid it completely, or use bit
    shifts or use div_u64 helpers; do not use *do_div* for division as it's a
    macro and has side effects
 -  do not use chained assignments: no *a = b = c;*
@@ -398,7 +409,7 @@ Variable declarations, parameters
 -  declaration block in a function should do only simple initializations
    (pointers, constants); nothing that would require error handling or has
    non-trivial side effects
--  use *const* extensively
+-  use ``const`` extensively
 -  add temporary variable to store a value if it's used multiple times in the
    function, or if reading the value needs to chase a long pointer chain
 -  do not mix declarations and statements (although kernel uses C standard that
@@ -438,10 +449,6 @@ Please refer to the option documentation
    -  **CONFIG_BTRFS_ASSERT**
    -  **CONFIG_BTRFS_EXPERIMENTAL**
    -  **CONFIG_BTRFS_FS_RUN_SANITY_TESTS** -- basic tests on module load
-   -  **CONFIG_BTRFS_FS_CHECK_INTEGRITY** -- block integrity checker
-      enabled by mount options
-   -  **CONFIG_BTRFS_FS_REF_VERIFY** -- additional checks for block
-      references
 
 -  locking
 
@@ -545,7 +552,7 @@ Storage environment
 
 -  at least 4 identically sized partitions/disks/virtual disks, specified using
    ``$SCRATCH_DEV_POOL``
--  some tests may require 8 equally sized``SCRATCH_DEV_POOL`` partitions
+-  some tests may require 8 equally sized ``SCRATCH_DEV_POOL`` partitions
 -  some tests need at least 10G of free space, as determined by ``df``, i.e.
    the size of the device may need to be larger, 12G should work
 -  some tests require ``$LOGWRITES_DEV``, yet another separate block device,
diff -pruN 6.17-1/VERSION 6.17.1-1/VERSION
--- 6.17-1/VERSION	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/VERSION	2025-11-07 09:04:55.000000000 +0000
@@ -1 +1 @@
-v6.17
+v6.17.1
diff -pruN 6.17-1/btrfs-find-root.c 6.17.1-1/btrfs-find-root.c
--- 6.17-1/btrfs-find-root.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/btrfs-find-root.c	2025-11-07 09:04:55.000000000 +0000
@@ -321,7 +321,7 @@ static void print_find_root_result(struc
 }
 
 static const char * const btrfs_find_root_usage[] = {
-	"btrfs-find-usage [options] <device>",
+	"btrfs-find-root [options] <device>",
 	"Attempt to find tree roots on the device",
 	"",
 	OPTLINE("-a", "search through all metadata even if the root has been found"),
diff -pruN 6.17-1/check/main.c 6.17.1-1/check/main.c
--- 6.17-1/check/main.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/check/main.c	2025-11-07 09:04:55.000000000 +0000
@@ -6131,7 +6131,7 @@ static int check_csum_root(struct btrfs_
 			errors++;
 		}
 		num_entries = btrfs_item_size(leaf, path.slots[0]) / csum_size;
-		data_len = num_entries * gfs_info->sectorsize;
+		data_len = (u64)num_entries * gfs_info->sectorsize;
 
 		if (num_entries > max_entries) {
 			error(
@@ -8601,7 +8601,11 @@ int check_chunks(struct cache_tree *chun
 				dext_rec->objectid,
 				dext_rec->offset,
 				dext_rec->length);
-		if (!ret)
+		err = -ENOENT;
+		if (opt_check_repair)
+			err = btrfs_remove_dev_extent(gfs_info, dext_rec->objectid,
+						      dext_rec->offset);
+		if (err && !ret)
 			ret = 1;
 	}
 	return ret;
@@ -9816,7 +9820,7 @@ static int check_range_csummed(struct bt
 			break;
 
 		num_entries = btrfs_item_size(leaf, path.slots[0]) / gfs_info->csum_size;
-		data_len = num_entries * gfs_info->sectorsize;
+		data_len = (u64)num_entries * gfs_info->sectorsize;
 
 		if (addr >= key.offset && addr <= key.offset + data_len) {
 			u64 end = min(addr + length, key.offset + data_len);
diff -pruN 6.17-1/check/mode-lowmem.c 6.17.1-1/check/mode-lowmem.c
--- 6.17-1/check/mode-lowmem.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/check/mode-lowmem.c	2025-11-07 09:04:55.000000000 +0000
@@ -4749,7 +4749,12 @@ out:
 		error(
 		"device extent[%llu, %llu, %llu] did not find the related chunk",
 			devext_key.objectid, devext_key.offset, length);
-		return REFERENCER_MISSING;
+		ret = -ENOENT;
+		if (opt_check_repair)
+			ret = btrfs_remove_dev_extent(gfs_info, devext_key.objectid,
+						      devext_key.offset);
+		if (ret < 0)
+			return REFERENCER_MISSING;
 	}
 	return 0;
 }
diff -pruN 6.17-1/check/qgroup-verify.c 6.17.1-1/check/qgroup-verify.c
--- 6.17-1/check/qgroup-verify.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/check/qgroup-verify.c	2025-11-07 09:04:55.000000000 +0000
@@ -45,7 +45,6 @@ void qgroup_set_item_count_ptr(u64 *item
 	qgroup_item_count = item_count_ptr;
 }
 
-/*#define QGROUP_VERIFY_DEBUG*/
 static unsigned long tot_extents_scanned = 0;
 
 static struct qgroup_count *find_count(u64 qgroupid);
@@ -157,7 +156,6 @@ struct ref {
 	struct rb_node		bytenr_node;
 };
 
-#ifdef QGROUP_VERIFY_DEBUG
 static void print_ref(struct ref *ref)
 {
 	printf("bytenr: %llu\t\tnum_bytes: %llu\t\t parent: %llu\t\t"
@@ -165,7 +163,7 @@ static void print_ref(struct ref *ref)
 	       ref->parent, ref->root);
 }
 
-static void print_all_refs(void)
+static void __maybe_unused print_all_refs(void)
 {
 	unsigned long count = 0;
 	struct ref *ref;
@@ -184,7 +182,6 @@ static void print_all_refs(void)
 	printf("%lu extents scanned with %lu refs in total.\n",
 	       tot_extents_scanned, count);
 }
-#endif
 
 /*
  * Store by bytenr in rbtree
@@ -490,14 +487,12 @@ static int account_one_extent(struct uli
 				count->info.exclusive_compressed += num_bytes;
 			}
 		}
-#ifdef QGROUP_VERIFY_DEBUG
-		printf("account (%llu, %llu), qgroup %llu/%llu, rfer %llu,"
+		pr_verbose(LOG_DEBUG, "account (%llu, %llu), qgroup %u/%llu, rfer %llu,"
 		       " excl %llu, refs %llu, roots %llu\n", bytenr, num_bytes,
 		       btrfs_qgroup_level(count->qgroupid),
 		       btrfs_qgroup_subvolid(count->qgroupid),
 		       count->info.referenced, count->info.exclusive, nr_refs,
 		       nr_roots);
-#endif
 	}
 
 	inc_qgroup_seq(roots->nnodes);
@@ -636,7 +631,6 @@ static void free_tree_blocks(void)
 	tree_blocks = NULL;
 }
 
-#ifdef QGROUP_VERIFY_DEBUG
 static void print_tree_block(u64 bytenr, struct tree_block *block)
 {
 	struct ref *ref;
@@ -656,7 +650,7 @@ static void print_tree_block(u64 bytenr,
 	printf("\n");
 }
 
-static void print_all_tree_blocks(void)
+static void __maybe_unused print_all_tree_blocks(void)
 {
 	struct ulist_iterator uiter;
 	struct ulist_node *unode;
@@ -670,7 +664,6 @@ static void print_all_tree_blocks(void)
 	while ((unode = ulist_next(tree_blocks, &uiter)))
 		print_tree_block(unode_bytenr(unode), unode_tree_block(unode));
 }
-#endif
 
 static int add_refs_for_leaf_items(struct extent_buffer *eb, u64 ref_parent)
 {
diff -pruN 6.17-1/check/repair.c 6.17.1-1/check/repair.c
--- 6.17-1/check/repair.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/check/repair.c	2025-11-07 09:04:55.000000000 +0000
@@ -31,7 +31,9 @@
 #include "kernel-shared/extent_io.h"
 #include "kernel-shared/disk-io.h"
 #include "kernel-shared/tree-checker.h"
+#include "kernel-shared/volumes.h"
 #include "common/extent-cache.h"
+#include "common/messages.h"
 #include "check/repair.h"
 
 int opt_check_repair = 0;
@@ -354,6 +356,82 @@ out:
 	return ret;
 }
 
+int btrfs_remove_dev_extent(struct btrfs_fs_info *fs_info, u64 devid, u64 physical)
+{
+	struct btrfs_trans_handle *trans;
+	struct btrfs_root *dev_root = fs_info->dev_root;
+	struct btrfs_key key = {
+		.objectid = devid,
+		.type = BTRFS_DEV_EXTENT_KEY,
+		.offset = physical,
+	};
+	struct btrfs_path path = { 0 };
+	struct btrfs_dev_extent *dext;
+	struct btrfs_device *dev;
+	u64 length;
+	int ret;
+
+	dev = btrfs_find_device_by_devid(fs_info->fs_devices, devid, 0);
+	if (!dev) {
+		ret = -ENOENT;
+		error("failed to find devid %llu", devid);
+		return ret;
+	}
+	trans = btrfs_start_transaction(dev_root, 1);
+	if (IS_ERR(trans)) {
+		ret = PTR_ERR(trans);
+		errno = -ret;
+		error_msg(ERROR_MSG_START_TRANS, "%m");
+		return ret;
+	}
+	ret = btrfs_search_slot(trans, dev_root, &key, &path, -1, 1);
+	if (ret > 0)
+		ret = -ENOENT;
+	if (ret < 0) {
+		errno = -ret;
+		error("failed to locate dev extent, devid %llu physical %llu: %m",
+		      devid, physical);
+		goto abort;
+	}
+	dext = btrfs_item_ptr(path.nodes[0], path.slots[0], struct btrfs_dev_extent);
+	length = btrfs_dev_extent_length(path.nodes[0], dext);
+	ret = btrfs_del_item(trans, dev_root, &path);
+	if (ret < 0) {
+		errno = -ret;
+		error("failed to delete dev extent, devid %llu physical %llu: %m",
+		      devid, physical);
+		goto abort;
+	}
+	btrfs_release_path(&path);
+	if (dev->bytes_used < length) {
+		warning("devid %llu has bytes_used %llu, smaller than %llu",
+			devid, dev->bytes_used, length);
+		dev->bytes_used = 0;
+	} else {
+		dev->bytes_used -= length;
+	}
+	ret = btrfs_update_device(trans, dev);
+	if (ret < 0) {
+		errno = -ret;
+		error("failed to update device, devid %llu: %m", devid);
+		goto abort;
+	}
+	ret = btrfs_commit_transaction(trans, dev_root);
+	if (ret < 0) {
+		errno = -ret;
+		error_msg(ERROR_MSG_COMMIT_TRANS, "%m");
+	} else {
+		printf("removed orphan dev extent, devid %llu physical %llu length %llu\n",
+			devid, physical, length);
+	}
+	return ret;
+
+abort:
+	btrfs_release_path(&path);
+	btrfs_abort_transaction(trans, ret);
+	return ret;
+}
+
 enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *eb,
 							  struct btrfs_key *first_key)
 {
diff -pruN 6.17-1/check/repair.h 6.17.1-1/check/repair.h
--- 6.17-1/check/repair.h	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/check/repair.h	2025-11-07 09:04:55.000000000 +0000
@@ -48,6 +48,7 @@ int btrfs_mark_used_tree_blocks(struct b
 				struct extent_io_tree *tree);
 int btrfs_mark_used_blocks(struct btrfs_fs_info *fs_info,
 			   struct extent_io_tree *tree);
+int btrfs_remove_dev_extent(struct btrfs_fs_info *fs_info, u64 devid, u64 physical);
 enum btrfs_tree_block_status btrfs_check_block_for_repair(struct extent_buffer *eb,
 							  struct btrfs_key *first_key);
 void btrfs_set_item_key_unsafe(struct btrfs_root *root, struct btrfs_path *path,
diff -pruN 6.17-1/common/fsfeatures.c 6.17.1-1/common/fsfeatures.c
--- 6.17-1/common/fsfeatures.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/common/fsfeatures.c	2025-11-07 09:04:55.000000000 +0000
@@ -218,7 +218,7 @@ static const struct btrfs_feature mkfs_f
 		.compat_ro_flag	= BTRFS_FEATURE_COMPAT_RO_BLOCK_GROUP_TREE,
 		.sysfs_name	= "block_group_tree",
 		VERSION_TO_STRING2(compat, 6,1),
-		VERSION_NULL(safe),
+		VERSION_TO_STRING2(safe, 6,6),
 		VERSION_NULL(default),
 		.desc		= "block group tree, more efficient block group tracking to reduce mount time"
 	},
diff -pruN 6.17-1/common/parse-utils.c 6.17.1-1/common/parse-utils.c
--- 6.17-1/common/parse-utils.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/common/parse-utils.c	2025-11-07 09:04:55.000000000 +0000
@@ -72,7 +72,7 @@ int parse_u64(const char *str, u64 *resu
  * Returned values are u64, value validation and interpretation should be done
  * by the caller.
  */
-int parse_range(const char *range, u64 *start, u64 *end)
+int parse_range_u64(const char *range, u64 *start, u64 *end)
 {
 	char *dots;
 	char *endptr;
@@ -135,7 +135,7 @@ int parse_range_u32(const char *range, u
 	u64 tmp_start;
 	u64 tmp_end;
 
-	if (parse_range(range, &tmp_start, &tmp_end))
+	if (parse_range_u64(range, &tmp_start, &tmp_end))
 		return 1;
 
 	if (range_to_u32(tmp_start, tmp_end, start, end))
@@ -150,7 +150,7 @@ int parse_range_u32(const char *range, u
  */
 int parse_range_strict(const char *range, u64 *start, u64 *end)
 {
-	if (parse_range(range, start, end) == 0) {
+	if (parse_range_u64(range, start, end) == 0) {
 		if (*start >= *end) {
 			error("range %llu..%llu not allowed", *start, *end);
 			return 1;
diff -pruN 6.17-1/common/parse-utils.h 6.17.1-1/common/parse-utils.h
--- 6.17-1/common/parse-utils.h	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/common/parse-utils.h	2025-11-07 09:04:55.000000000 +0000
@@ -24,7 +24,7 @@ enum btrfs_csum_type parse_csum_type(con
 int parse_u64(const char *str, u64 *result);
 int parse_u64_with_suffix(const char *s, u64 *value_ret);
 int parse_range_u32(const char *range, u32 *start, u32 *end);
-int parse_range(const char *range, u64 *start, u64 *end);
+int parse_range_u64(const char *range, u64 *start, u64 *end);
 int parse_range_strict(const char *range, u64 *start, u64 *end);
 int parse_bg_profile(const char *profile, u64 *flags);
 int parse_compress_type(const char *type);
diff -pruN 6.17-1/convert/main.c 6.17.1-1/convert/main.c
--- 6.17-1/convert/main.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/convert/main.c	2025-11-07 09:04:55.000000000 +0000
@@ -948,8 +948,7 @@ static int make_convert_data_block_group
 			u64 cur_backup = cur;
 
 			len = min(max_chunk_size,
-				  round_up(cache->start + cache->size,
-					   BTRFS_STRIPE_LEN) - cur);
+				  cache->start + cache->size - cur);
 			ret = btrfs_alloc_data_chunk(trans, fs_info, &cur_backup, len);
 			if (ret < 0)
 				break;
@@ -1250,7 +1249,7 @@ static int do_convert(const char *devnam
 	uuid_unparse(cctx.fs_uuid, fsid_str);
 	printf("  UUID:           %s\n", fsid_str);
 	printf("Target filesystem:\n");
-	printf("  Label:          %s\n", fslabel);
+	printf("  Label:          %s\n", (convert_flags & CONVERT_FLAG_COPY_LABEL) ? cctx.label : fslabel);
 	printf("  Blocksize:      %u\n", blocksize);
 	printf("  Nodesize:       %u\n", nodesize);
 	printf("  UUID:           %s\n", mkfs_cfg.fs_uuid);
diff -pruN 6.17-1/debian/btrfs-progs-udeb.install 6.17.1-1/debian/btrfs-progs-udeb.install
--- 6.17-1/debian/btrfs-progs-udeb.install	2025-10-09 17:38:07.000000000 +0000
+++ 6.17.1-1/debian/btrfs-progs-udeb.install	2025-11-07 19:26:24.000000000 +0000
@@ -1,2 +1,2 @@
-btrfs		/bin
-mkfs.btrfs	/bin
+btrfs		/usr/bin
+mkfs.btrfs	/usr/sbin
diff -pruN 6.17-1/debian/changelog 6.17.1-1/debian/changelog
--- 6.17-1/debian/changelog	2025-10-09 17:38:07.000000000 +0000
+++ 6.17.1-1/debian/changelog	2025-11-07 19:26:24.000000000 +0000
@@ -1,3 +1,14 @@
+btrfs-progs (6.17.1-1) unstable; urgency=medium
+
+  * New upstream release.
+  * Make btrfs-progs-udeb usrmerge compliant.
+  * Additionally move mkfs.btrfs to /usr/sbin, where it should have been
+    installed for consistency with the main bin:btrfs-progs, and also with
+    every other mkfs.variant on Debian, and with the FHS--even though this
+    is just a udeb.
+
+ -- Nicholas D Steeves <sten@debian.org>  Fri, 07 Nov 2025 14:26:24 -0500
+
 btrfs-progs (6.17-1) unstable; urgency=medium
 
   * New upstream release.
diff -pruN 6.17-1/kernel-shared/ctree.h 6.17.1-1/kernel-shared/ctree.h
--- 6.17-1/kernel-shared/ctree.h	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/kernel-shared/ctree.h	2025-11-07 09:04:55.000000000 +0000
@@ -69,8 +69,6 @@ static inline u32 __BTRFS_LEAF_DATA_SIZE
 #define BTRFS_MIN_BLOCKSIZE	(SZ_4K)
 #endif
 
-#define BTRFS_LEAF_DATA_SIZE(fs_info) (fs_info->leaf_data_size)
-
 #define BTRFS_SUPER_INFO_OFFSET			(65536)
 #define BTRFS_SUPER_INFO_SIZE			(4096)
 
@@ -401,7 +399,6 @@ struct btrfs_fs_info {
 	u32 nodesize;
 	u32 sectorsize;
 	u32 stripesize;
-	u32 leaf_data_size;
 
 	/*
 	 * For open_ctree_fs_info() to hold the initial fd until close.
@@ -426,6 +423,11 @@ struct btrfs_fs_info {
 	struct super_block *sb;
 };
 
+static inline u32 BTRFS_LEAF_DATA_SIZE(const struct btrfs_fs_info *fs_info)
+{
+	return __BTRFS_LEAF_DATA_SIZE(fs_info->nodesize);
+}
+
 static inline bool btrfs_is_zoned(const struct btrfs_fs_info *fs_info)
 {
 	return fs_info->zoned != 0;
diff -pruN 6.17-1/kernel-shared/disk-io.c 6.17.1-1/kernel-shared/disk-io.c
--- 6.17-1/kernel-shared/disk-io.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/kernel-shared/disk-io.c	2025-11-07 09:04:55.000000000 +0000
@@ -1604,7 +1604,6 @@ static struct btrfs_fs_info *__open_ctre
 	fs_info->stripesize = btrfs_super_stripesize(disk_super);
 	fs_info->csum_type = btrfs_super_csum_type(disk_super);
 	fs_info->csum_size = btrfs_super_csum_size(disk_super);
-	fs_info->leaf_data_size = __BTRFS_LEAF_DATA_SIZE(fs_info->nodesize);
 
 	ret = btrfs_check_fs_compatibility(fs_info->super_copy, flags);
 	if (ret)
diff -pruN 6.17-1/kernel-shared/print-tree.c 6.17.1-1/kernel-shared/print-tree.c
--- 6.17-1/kernel-shared/print-tree.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/kernel-shared/print-tree.c	2025-11-07 09:04:55.000000000 +0000
@@ -1915,6 +1915,7 @@ static int check_csum_sblock(void *sb, i
 static struct readable_flag_entry compat_ro_flags_array[] = {
 	DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE),
 	DEF_COMPAT_RO_FLAG_ENTRY(FREE_SPACE_TREE_VALID),
+	DEF_COMPAT_RO_FLAG_ENTRY(VERITY),
 	DEF_COMPAT_RO_FLAG_ENTRY(BLOCK_GROUP_TREE),
 };
 static const int compat_ro_flags_num = ARRAY_SIZE(compat_ro_flags_array);
diff -pruN 6.17-1/libbtrfsutil/python/setup.py 6.17.1-1/libbtrfsutil/python/setup.py
--- 6.17-1/libbtrfsutil/python/setup.py	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/libbtrfsutil/python/setup.py	2025-11-07 09:04:55.000000000 +0000
@@ -30,7 +30,7 @@ def get_version():
     try:
         import version
         version = version.btrfs_util_py_version
-    except:
+    except Exception:
         # Don't fail if this is only the 'clean' target or no command
         if 'clean' in sys.argv or len(sys.argv) == 1:
             version = '0.0'
diff -pruN 6.17-1/mkfs/main.c 6.17.1-1/mkfs/main.c
--- 6.17-1/mkfs/main.c	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/mkfs/main.c	2025-11-07 09:04:55.000000000 +0000
@@ -29,6 +29,7 @@
 #include <pthread.h>
 #include <uuid/uuid.h>
 #include <blkid/blkid.h>
+#include <linux/version.h>
 #include "kernel-lib/list.h"
 #include "kernel-lib/list_sort.h"
 #include "kernel-lib/rbtree.h"
@@ -2410,10 +2411,14 @@ raid_groups:
 		list_all_devices(root, opt_zoned);
 
 		if (mkfs_cfg.csum_type == BTRFS_CSUM_TYPE_SHA256) {
-			printf(
-"NOTE: you may need to manually load kernel module implementing accelerated SHA256 in case\n"
+			u32 kernel_version = get_running_kernel_version();
+
+			if (kernel_version < KERNEL_VERSION(6,16,0)) {
+				printf(
+"NOTE: in kernels < v6.16 you may need to manually load kernel module implementing accelerated SHA256 in case\n"
 "      the generic implementation is built-in, before mount. Check lsmod or /proc/crypto\n\n"
-);
+				);
+			}
 		}
 	}
 
diff -pruN 6.17-1/tests/common 6.17.1-1/tests/common
--- 6.17-1/tests/common	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/tests/common	2025-11-07 09:04:55.000000000 +0000
@@ -984,6 +984,14 @@ cleanup_nullbdevs()
 		name=$(basename "$dev")
 		run_check $SUDO_HELPER "$nullb" rm "$name"
 	done
+	unset nullb_devs
+}
+
+wait_for_nullbdevs()
+{
+	for dev in ${nullb_devs[@]}; do
+		run_mayfail $SUDO_HELPER "$TOP/btrfs" device ready "$dev"
+	done
 }
 
 init_env()
Binary files 6.17-1/tests/fsck-tests/068-orphan-dev-extent/default.img.xz and 6.17.1-1/tests/fsck-tests/068-orphan-dev-extent/default.img.xz differ
diff -pruN 6.17-1/tests/mkfs-tests/039-zoned-profiles/test.sh 6.17.1-1/tests/mkfs-tests/039-zoned-profiles/test.sh
--- 6.17-1/tests/mkfs-tests/039-zoned-profiles/test.sh	1970-01-01 00:00:00.000000000 +0000
+++ 6.17.1-1/tests/mkfs-tests/039-zoned-profiles/test.sh	2025-11-07 09:04:55.000000000 +0000
@@ -0,0 +1,100 @@
+#!/bin/bash
+# Test various block group profile combinations, use nullb devices as block
+# devices. This test is based on mkfs-tests/001-basic-profiles with focus on
+# zoned devices.
+
+source "$TEST_TOP/common" || exit
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+check_global_prereq blkzone
+
+setup_root_helper
+# Create one 128M device with 4M zones, 32 of them
+setup_nullbdevs 4 128 4
+prepare_nullbdevs
+dev1=${nullb_devs[1]}
+
+test_get_info()
+{
+	local tmp_out
+
+	tmp_out=$(_mktemp mkfs-get-info)
+	run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dev1"
+	run_check $SUDO_HELPER "$TOP/btrfs" check "$dev1"
+
+	# Work around for kernel bug that will treat SINGLE and single
+	# device RAID0 as the same.
+	# Thus kernel may create new SINGLE chunks, causing extra warning
+	# when testing single device RAID0.
+	wait_for_nullbdevs
+	run_check $SUDO_HELPER mount -o ro "$dev1" "$TEST_MNT"
+	run_check_stdout "$TOP/btrfs" filesystem df "$TEST_MNT" > "$tmp_out"
+	if grep -q "Multiple block group profiles detected" "$tmp_out"; then
+		rm -- "$tmp_out"
+		_fail "temporary chunks are not properly cleaned up"
+	fi
+	rm -- "$tmp_out"
+	run_check $SUDO_HELPER "$TOP/btrfs" filesystem usage "$TEST_MNT"
+	run_check $SUDO_HELPER "$TOP/btrfs" device usage "$TEST_MNT"
+	run_check $SUDO_HELPER umount "$TEST_MNT"
+}
+
+test_do_mkfs()
+{
+	run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
+	if run_check_stdout $SUDO_HELPER "$TOP/btrfs" check "$dev1" | grep -iq warning; then
+		_fail "warnings found in check output"
+	fi
+}
+
+test_mkfs_single()
+{
+	test_do_mkfs "$@" "$dev1"
+	test_get_info
+}
+
+test_mkfs_multi()
+{
+	test_do_mkfs "$@" "${nullb_devs[@]}"
+	test_get_info
+}
+
+test_mkfs_single
+test_mkfs_single  -d  single  -m  single
+test_mkfs_single  -d  single  -m  dup
+
+test_mkfs_multi
+test_mkfs_multi   -d  single  -m  single
+
+if _test_config "EXPERIMENTAL" && [ -f "/sys/fs/btrfs/features/raid_stripe_tree" ]; then
+	test_mkfs_single  -d  dup     -m  single
+	test_mkfs_single  -d  dup     -m  dup
+
+	test_mkfs_multi   -d  raid0   -m  raid0
+	test_mkfs_multi   -d  raid1   -m  raid1
+	test_mkfs_multi   -d  raid10  -m  raid10
+	# RAID5/6 are not yet supported.
+	# test_mkfs_multi   -d  raid5   -m  raid5
+	# test_mkfs_multi   -d  raid6   -m  raid6
+	test_mkfs_multi   -d  dup     -m  dup
+
+	if [ -f "/sys/fs/btrfs/features/raid1c34" ]; then
+		test_mkfs_multi   -d  raid1c3 -m  raid1c3
+		test_mkfs_multi   -d  raid1c4 -m  raid1c4
+	else
+		_log "skip mount test, missing support for raid1c34"
+		test_do_mkfs -d raid1c3 -m raid1c3 "${nullb_devs[@]}"
+		test_do_mkfs -d raid1c4 -m raid1c4 "${nullb_devs[@]}"
+	fi
+
+	# Non-standard profile/device combinations
+
+	# Single device raid0, two device raid10 (simple mount works on older kernels too)
+	test_do_mkfs -d raid0 -m raid0 "$dev1"
+	test_get_info
+	test_do_mkfs -d raid10 -m raid10 "${nullb_devs[1]}" "${nullb_devs[2]}"
+	test_get_info
+fi
+
+cleanup_nullbdevs
diff -pruN 6.17-1/tests/nullb 6.17.1-1/tests/nullb
--- 6.17-1/tests/nullb	2025-09-29 14:59:32.000000000 +0000
+++ 6.17.1-1/tests/nullb	2025-11-07 09:04:55.000000000 +0000
@@ -34,12 +34,12 @@ SYSFS='/sys/kernel/config/nullb'
 # setup
 
 function _error() {
-	echo "ERROR: $@"
+	echo "ERROR: $@" 1>&2
 	exit 1
 }
 
 function _warn() {
-	echo "WARNING: $@"
+	echo "WARNING: $@" 1>&2
 }
 
 function _msg() {
@@ -146,6 +146,9 @@ fi
 if [ "$CMD" = 'create' ]; then
 	_check_setup
 	index=$(_find_free_index)
+	if [ -z "$index" ]; then
+		exit 1
+	fi
 	name="nullb$index"
 	# size in MB
 	size=$(_parse_device_size "$@")
