]> git.hungrycats.org Git - linux/commitdiff
btrfs: stripe_alloc: allow-rmw policy, and write-in-place for isolated nocow extents
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sat, 19 Sep 2026 17:17:40 +0000 (13:17 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Sun, 8 Nov 2026 23:37:56 +0000 (18:37 -0500)
Re-enable write-in-place for nodatacow files and preallocated extents
under stripe-exclusive allocation, with the understood caveat that the
write hole cannot be prevented for data that opts out of COW: an
in-place write RMWs its stripe's parity, so a degraded crash can tear
the stripe.  What CAN be guaranteed is the blast radius: in-place is
permitted only for extents whose full stripes are isolated to the
writing inode, so such a crash can tear only the writing file's own
data -- the nodatacow contract, no worse.

The gate is per extent, decided where nocow eligibility is already
checked: fast path, the stripe belongs to one of the inode's own
NOCOW-class runs (which only ever held its extents); slow path, the
committed extent tree proves sole ownership (single plain data ref,
count 1, matching root and objectid; anything shared, foreign or
metadata fails).  The fully-free claim rule keeps uncommitted foreign
extents out of partially used stripes, so the committed tree is
authoritative.  Extents that fail -- anything allocated before stripe
isolation existed, extents shared through reflink or snapshots,
relocated extents -- simply stay force-COWed, and because their rewrite
is steered into the inode's private NOCOW run, the next overwrite of
the same data passes: legacy nocow files migrate themselves to
isolation in one COW generation, with no tool and no flag day.

Log-commit settling skips NOCOW-class runs: nodatacow data gets no
fsync survival guarantee (its own later in-place writes can always
tear it), so closing the run would trap its tail for nothing.  The
write-hole debug checker skips groups that hosted NOCOW-class runs,
like relocation-used groups, since isolated in-place writes land in
stripes whose runs have drained.  Settling, the fsync steering and the
checker come later in this series, so these parts of the change are in
its "(fsync part)", "(fsync part 2)" and "(debug part)" patches.

The interface is a word-list policy naming the cases in which
stripe_alloc may permit the legacy unsafe RMW, each independently:

  nodatacow  in-place writes for nodatacow files' extents
  prealloc   in-place writes into preallocated extents
  fsync      waive the close-at-log-commit guarantee: no settling, no
             per-inode LOG steering, no carry-forward; logged stripes
             may be extended and RMWed as without stripe_alloc

It is "allow_rmw", not "allow_overwrite": the fsync case overwrites
nothing, but all three permit read-modify-write of stripes that a
degraded crash can then tear.  The nodatacow and prealloc cases require
the per-extent stripe isolation above (the blast radius stays confined
to the writing file); fsync restores the exposure stock btrfs has,
where a degraded crash may cost just-fsynced data, detectably, in
exchange for none of the log-commit costs.

The policy is persistent as the btrfs.stripe_alloc_allow_rmw property
on the top-level root directory, following stripe_alloc's precedent
(applied when the root inode loads during mount, before any user IO).
Words are separated by comma, space or colon.  Everything defaults off:
plain stripe_alloc keeps forcing COW and keeps the full fsync guarantee.

Sync writes into a NOCOW-class run do not park: in-place overwrites arrive
one fsync at a time with nothing to merge and, unlike the datacow fsync
path, nothing kicks them before the page writeback wait (the sync park
deadline was most of a 3.7ms per-fsync regression against stock
nodatacow).  Async writeback still parks there.

The ownership walk checks the extent item's size before reading its
inline backref: a data extent whose only backref is a keyed
EXTENT_DATA_REF item (the leaf had no room to grow the item) has none, and
counts as not owned.

Assisted-by: Claude:claude-fable-5
Assisted-by: Claude:claude-opus-5-5
fs/btrfs/block-group.c
fs/btrfs/block-group.h
fs/btrfs/extent-tree.c
fs/btrfs/file.c
fs/btrfs/fs.h
fs/btrfs/inode.c
fs/btrfs/props.c
fs/btrfs/raid56.c

index cc130c76f4f512346bf90c7339fec4431f1496f6..e4be43e01e6ab811897b350837cd0e59c008e4ad 100644 (file)
@@ -1159,6 +1159,236 @@ bool btrfs_stripe_run_strands(struct btrfs_block_group *bg, u64 stripe)
        return ret;
 }
 
+/*
+ * Parse the value of the btrfs.stripe_alloc_allow_rmw property, a word list
+ * ("nodatacow", "prealloc", "fsync"), into its mask.  Words are separated by
+ * comma, space or colon.  An empty value yields an empty mask.  Returns
+ * -EINVAL on any unknown word.
+ */
+int btrfs_parse_stripe_rmw(const char *value, size_t len, u32 *mask)
+{
+       u32 m = 0;
+       size_t i = 0;
+
+       while (i < len) {
+               size_t j = i;
+
+               while (j < len && value[j] != ',' && value[j] != ' ' &&
+                      value[j] != ':')
+                       j++;
+               if (j - i == strlen("nodatacow") &&
+                   !strncmp(value + i, "nodatacow", j - i))
+                       m |= BTRFS_STRIPE_RMW_NODATACOW;
+               else if (j - i == strlen("prealloc") &&
+                        !strncmp(value + i, "prealloc", j - i))
+                       m |= BTRFS_STRIPE_RMW_PREALLOC;
+               else if (j - i == strlen("fsync") &&
+                        !strncmp(value + i, "fsync", j - i))
+                       m |= BTRFS_STRIPE_RMW_FSYNC;
+               else if (j != i)
+                       return -EINVAL;
+               i = j + 1;
+       }
+       *mask = m;
+       return 0;
+}
+
+/*
+ * Does every committed extent in [start, start + len) belong solely to
+ * @ino in @root_id -- exactly one reference, a plain data ref, count 1?
+ * Any metadata block, shared reference, or foreign owner fails.  Caller
+ * limits the range to full stripes; uncommitted allocations need not be
+ * visible because nothing can allocate into a partially used stripe (the
+ * fully-free claim rule), so a foreign extent can only appear here after
+ * the whole stripe frees and commits -- which the extent tree shows.
+ */
+static bool stripe_extents_owned_by(struct btrfs_fs_info *fs_info,
+                                   u64 root_id, u64 ino, u64 start, u64 len)
+{
+       struct btrfs_root *extent_root = btrfs_extent_root(fs_info, start);
+       struct btrfs_path *path;
+       struct btrfs_key key;
+       bool ret = true;
+       int err;
+
+       if (!extent_root)
+               return false;
+       path = btrfs_alloc_path();
+       if (!path)
+               return false;
+
+       key.objectid = start;
+       key.type = BTRFS_EXTENT_ITEM_KEY;
+       key.offset = 0;
+       err = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
+       if (err < 0) {
+               ret = false;
+               goto out;
+       }
+       /* An extent starting before @start may still overlap it. */
+       err = btrfs_previous_extent_item(extent_root, path, 0);
+       if (err < 0) {
+               ret = false;
+               goto out;
+       }
+       if (err > 0) {
+               btrfs_release_path(path);
+               key.objectid = start;
+               key.type = BTRFS_EXTENT_ITEM_KEY;
+               key.offset = 0;
+               err = btrfs_search_slot(NULL, extent_root, &key, path, 0, 0);
+               if (err < 0) {
+                       ret = false;
+                       goto out;
+               }
+       }
+
+       while (true) {
+               struct extent_buffer *leaf = path->nodes[0];
+               int slot = path->slots[0];
+               struct btrfs_extent_item *ei;
+               struct btrfs_extent_inline_ref *iref;
+               struct btrfs_extent_data_ref *dref;
+               int type;
+
+               if (slot >= btrfs_header_nritems(leaf)) {
+                       err = btrfs_next_leaf(extent_root, path);
+                       if (err < 0) {
+                               ret = false;
+                               goto out;
+                       }
+                       if (err > 0)
+                               break;
+                       continue;
+               }
+               btrfs_item_key_to_cpu(leaf, &key, slot);
+               if (key.objectid >= start + len)
+                       break;
+               if (key.type == BTRFS_METADATA_ITEM_KEY) {
+                       /*
+                        * key.offset is the level, not a length; a tree
+                        * block spans nodesize bytes.  One from before the
+                        * range (e.g. where the pre-range positioning landed
+                        * on a metadata block group's last item) is harmless.
+                        */
+                       if (key.objectid + fs_info->nodesize > start) {
+                               ret = false;
+                               goto out;
+                       }
+                       path->slots[0]++;
+                       continue;
+               }
+               if (key.type != BTRFS_EXTENT_ITEM_KEY ||
+                   key.objectid + key.offset <= start) {
+                       path->slots[0]++;
+                       continue;
+               }
+
+               ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item);
+               if (btrfs_extent_refs(leaf, ei) != 1 ||
+                   !(btrfs_extent_flags(leaf, ei) & BTRFS_EXTENT_FLAG_DATA)) {
+                       ret = false;
+                       goto out;
+               }
+               /*
+                * With a keyed (non-inline) backref the item ends after the
+                * header, and reading an inline ref would read the next item.
+                * Treat it as not owned, the conservative answer.
+                */
+               if (btrfs_item_size(leaf, slot) < sizeof(*ei) +
+                   btrfs_extent_inline_ref_size(BTRFS_EXTENT_DATA_REF_KEY)) {
+                       ret = false;
+                       goto out;
+               }
+               iref = (struct btrfs_extent_inline_ref *)(ei + 1);
+               type = btrfs_get_extent_inline_ref_type(leaf, iref,
+                                                       BTRFS_REF_TYPE_DATA);
+               if (type != BTRFS_EXTENT_DATA_REF_KEY) {
+                       ret = false;
+                       goto out;
+               }
+               dref = (struct btrfs_extent_data_ref *)(&iref->offset);
+               if (btrfs_extent_data_ref_root(leaf, dref) != root_id ||
+                   btrfs_extent_data_ref_objectid(leaf, dref) != ino ||
+                   btrfs_extent_data_ref_count(leaf, dref) != 1) {
+                       ret = false;
+                       goto out;
+               }
+               path->slots[0]++;
+       }
+out:
+       btrfs_free_path(path);
+       return ret;
+}
+
+/*
+ * May [start, start + num_bytes) be written in place under stripe-exclusive
+ * allocation?  Only when stripe_alloc_allow_rmw includes @which and every
+ * full stripe the range touches is isolated to @inode: an in-place write
+ * RMWs parity, so a crash can tear every extent sharing the stripe, and
+ * isolation confines that to the file that opted out of COW.  Fast path:
+ * the stripe is in one of the inode's own NOCOW runs.  Slow path: the
+ * committed extent tree proves sole ownership.  Extents that fail stay
+ * COWed, and their rewrite lands in the inode's NOCOW run, so the next
+ * overwrite passes.
+ */
+bool btrfs_stripe_nocow_writable(struct btrfs_inode *inode, u64 start,
+                                u64 num_bytes, u32 which)
+{
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
+       struct btrfs_block_group *bg;
+       const u64 root_id = btrfs_root_id(inode->root);
+       const u64 ino = btrfs_ino(inode);
+       u64 fsl;
+       u64 cur;
+       u64 end;
+       bool ret = true;
+
+       if (!(btrfs_stripe_allow_rmw(fs_info) & which))
+               return false;
+       bg = btrfs_lookup_block_group(fs_info, start);
+       if (!bg)
+               return false;
+       if (!btrfs_is_stripe_alloc_bg(bg)) {
+               /* Not a raid56 data group: nothing forces COW here anyway. */
+               btrfs_put_block_group(bg);
+               return true;
+       }
+
+       fsl = bg->full_stripe_len;
+       cur = bg->start + round_down(start - bg->start, fsl);
+       end = start + num_bytes;
+       while (cur < end) {
+               struct btrfs_open_stripe_run *run;
+               unsigned long flags;
+               int verdict = 0;        /* 0 = unknown, 1 = ok, -1 = foreign */
+
+               spin_lock_irqsave(&bg->stripe_run_lock, flags);
+               list_for_each_entry(run, &bg->open_stripe_runs, list) {
+                       if (cur < run->start || cur >= run->end)
+                               continue;
+                       if (run->class == BTRFS_STRIPE_RUN_NOCOW &&
+                           run->owner == ino)
+                               verdict = 1;
+                       else
+                               verdict = -1;
+                       break;
+               }
+               spin_unlock_irqrestore(&bg->stripe_run_lock, flags);
+
+               if (verdict == 0 &&
+                   !stripe_extents_owned_by(fs_info, root_id, ino, cur, fsl))
+                       verdict = -1;
+               if (verdict < 0) {
+                       ret = false;
+                       break;
+               }
+               cur += fsl;
+       }
+       btrfs_put_block_group(bg);
+       return ret;
+}
+
 /*
  * Lower an allocation ceiling to the end of the last live sector at or above
  * @floor.  Sectors between it and the frontier were allocated and abandoned:
@@ -1488,6 +1718,11 @@ void btrfs_disable_stripe_alloc(struct btrfs_fs_info *fs_info)
  * the commit drain already waits for and everything above it is dead space
  * padding may fill.
  */
+bool btrfs_stripe_in_open_run(struct btrfs_fs_info *fs_info, u64 logical)
+{
+       return btrfs_stripe_open_run_class(fs_info, logical, NULL);
+}
+
 /*
  * The part of [*start, *start + *len) that @run owns and tracks in its
  * written map: inside [run->start, run->end) -- the map itself reaches
@@ -1605,7 +1840,8 @@ bool btrfs_stripe_run_incomplete(struct btrfs_fs_info *fs_info,
        return ret;
 }
 
-bool btrfs_stripe_in_open_run(struct btrfs_fs_info *fs_info, u64 logical)
+bool btrfs_stripe_open_run_class(struct btrfs_fs_info *fs_info, u64 logical,
+                                enum btrfs_stripe_run_class *class)
 {
        struct btrfs_block_group *bg;
        struct btrfs_open_stripe_run *run;
@@ -1618,6 +1854,8 @@ bool btrfs_stripe_in_open_run(struct btrfs_fs_info *fs_info, u64 logical)
        spin_lock_irqsave(&bg->stripe_run_lock, flags);
        list_for_each_entry(run, &bg->open_stripe_runs, list) {
                if (logical >= run->start && logical < run->end) {
+                       if (class)
+                               *class = run->class;
                        ret = true;
                        break;
                }
index ad94806e5c7bbc608d504250570e7738ab2706e6..a079afa3da52af8e4402389dda838f5aa4111b8a 100644 (file)
@@ -139,6 +139,13 @@ enum btrfs_block_group_flags {
         * counter must be rescanned at commit (stripe_alloc only).
         */
        BLOCK_GROUP_FLAG_STRIPE_UNUSABLE_DIRTY,
+       /*
+        * The group has hosted NOCOW-class stripe runs.  When
+        * stripe_alloc_allow_rmw permits it, isolated nodatacow/prealloc
+        * extents are overwritten in place after their runs drain, so the
+        * write-hole debug check skips such groups (sticky, debug only).
+        */
+       BLOCK_GROUP_FLAG_STRIPE_NOCOW_USED,
        /*
         * A RAID5/6 group with a single data stripe, which is mapped as
         * RAID1/RAID1C3 (its chunk map's type differs from on_disk_type).  Its
@@ -502,6 +509,8 @@ void btrfs_stripe_run_mark_written(struct btrfs_fs_info *fs_info, u64 start,
                                   u64 len);
 bool btrfs_stripe_run_incomplete(struct btrfs_fs_info *fs_info,
                                 u64 stripe_start, u64 stripe_len);
+bool btrfs_stripe_open_run_class(struct btrfs_fs_info *fs_info, u64 logical,
+                                enum btrfs_stripe_run_class *class);
 u64 btrfs_stripe_run_stranded_stripes(struct btrfs_block_group *bg, u32 *freep,
                                      u64 nstripes);
 bool btrfs_stripe_run_strands(struct btrfs_block_group *bg, u64 stripe);
@@ -531,6 +540,9 @@ bool btrfs_stripe_run_pad_mask(struct btrfs_fs_info *fs_info, u64 stripe_start,
                               u64 stripe_len, unsigned long *dead,
                               unsigned long *unwritten,
                               struct btrfs_stripe_pad_info *info);
+bool btrfs_stripe_nocow_writable(struct btrfs_inode *inode, u64 start,
+                                u64 num_bytes, u32 which);
+int btrfs_parse_stripe_rmw(const char *value, size_t len, u32 *mask);
 int btrfs_stripe_alloc_check_support(struct btrfs_fs_info *fs_info);
 int btrfs_enable_stripe_alloc(struct btrfs_fs_info *fs_info);
 void btrfs_disable_stripe_alloc(struct btrfs_fs_info *fs_info);
index 336789f4e5821b5c61aa9a8795b61ef46292871c..cccc0fcdf014d75911ab7c063450d5ebb8deae42 100644 (file)
@@ -4336,6 +4336,9 @@ static int do_allocation_stripe(struct btrfs_block_group *block_group,
                if (ret == -ENOMEM)
                        return ret;
                if (!ret) {
+                       if (ffe_ctl->steer_class == BTRFS_STRIPE_RUN_NOCOW)
+                               set_bit(BLOCK_GROUP_FLAG_STRIPE_NOCOW_USED,
+                                       &block_group->runtime_flags);
                        stripe_split_taken(ffe_ctl, num_bytes);
                        WRITE_ONCE(steer_inode->log_run_hint, offset);
                        ffe_ctl->found_offset = offset;
index e95d9d42401f67df746036de8ae6c85348d09d75..d85ed2976ced382070ee17298cd86568b9829f77 100644 (file)
@@ -1593,6 +1593,8 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
         * one fsync is taken as a signal that more will follow.
         */
        if (btrfs_test_opt(fs_info, STRIPE_ALLOC) &&
+           !(btrfs_stripe_allow_rmw(fs_info) &
+             BTRFS_STRIPE_RMW_FSYNC) &&
            !test_bit(BTRFS_INODE_LOG_ALLOC, &inode->runtime_flags))
                set_bit(BTRFS_INODE_LOG_ALLOC, &inode->runtime_flags);
 
index 8a21d9004e265a413e95925ee3b3e52833a904e8..3b0461199a3d475c57b2dfaa05a0dd79fa082f99 100644 (file)
@@ -284,6 +284,18 @@ enum {
        BTRFS_MOUNT_STRIPE_ALLOC                = (1ULL << 34),
 };
 
+/*
+ * Cases in which stripe_alloc may permit the legacy unsafe RMW-in-place
+ * (the write hole returns for the stripes such a write touches, confined
+ * as each case's machinery allows).  Set from the
+ * btrfs.stripe_alloc_allow_rmw property.
+ */
+enum {
+       BTRFS_STRIPE_RMW_NODATACOW      = (1U << 0),
+       BTRFS_STRIPE_RMW_PREALLOC               = (1U << 1),
+       BTRFS_STRIPE_RMW_FSYNC          = (1U << 2),
+};
+
 /* These mount options require a full read-only fs, no new transaction is allowed. */
 #define BTRFS_MOUNT_FULL_RO_MASK               \
        (BTRFS_MOUNT_NOLOGREPLAY |              \
@@ -895,6 +907,8 @@ struct btrfs_fs_info {
                atomic64_t reloc_run_retained;
                atomic64_t reloc_run_released;
        } stripe_run_stats;
+       /* BTRFS_STRIPE_RMW_* masks; see btrfs_stripe_allow_rmw(). */
+       u32 stripe_rmw_prop;
        /*
         * Park deadlines, ms (sysfs); 0 disables parking for that class.  See
         * rbio_try_park().
@@ -1335,6 +1349,13 @@ static inline int btrfs_need_cleaner_sleep(const struct btrfs_fs_info *fs_info)
                btrfs_fs_closing(fs_info);
 }
 
+static inline u32 btrfs_stripe_allow_rmw(const struct btrfs_fs_info *fs_info)
+{
+       if (!btrfs_test_opt(fs_info, STRIPE_ALLOC))
+               return 0;
+       return READ_ONCE(fs_info->stripe_rmw_prop);
+}
+
 static inline void btrfs_wake_unfinished_drop(struct btrfs_fs_info *fs_info)
 {
        clear_and_wake_up_bit(BTRFS_FS_UNFINISHED_DROPS, &fs_info->flags);
index e09f272264ecac3874bb2a445f92da24eaf67fec..bfae983bd42c5751734e9c3265af33d53d8e5fe3 100644 (file)
@@ -1895,9 +1895,19 @@ static int can_nocow_file_extent(struct btrfs_path *path,
         * data relocation inode is exempt: its preallocated extents live in
         * relocation-class stripe runs that never share stripes with other
         * data, and relocation depends on its writes landing in place.
+        * When the btrfs.stripe_alloc_allow_rmw property allows it for
+        * nodatacow or prealloc extents, an extent whose stripes are isolated
+        * to this inode may be written in place after all: the write hole it
+        * reintroduces can tear only the writing file's own data, which is
+        * the nodatacow/prealloc contract.
         */
        if (!btrfs_is_data_reloc_root(root) &&
-           btrfs_stripe_alloc_forces_cow(root->fs_info, io_start))
+           btrfs_stripe_alloc_forces_cow(root->fs_info, io_start) &&
+           !btrfs_stripe_nocow_writable(inode, io_start,
+                                        args->file_extent.num_bytes,
+                                        extent_type == BTRFS_FILE_EXTENT_PREALLOC ?
+                                               BTRFS_STRIPE_RMW_PREALLOC :
+                                               BTRFS_STRIPE_RMW_NODATACOW))
                goto out;
 
        /*
index 623a786899c5c4b3fe2f5c480d4fff80b6df3b86..b942dd4e5045a92faedb77cc6032853c89a073a1 100644 (file)
@@ -477,6 +477,34 @@ static int prop_stripe_alloc_apply(struct btrfs_inode *inode,
        return btrfs_enable_stripe_alloc(fs_info);
 }
 
+static int prop_stripe_rmw_validate(const struct btrfs_inode *inode,
+                                         const char *value, size_t len)
+{
+       u32 mask;
+
+       if (!prop_stripe_alloc_scope_ok(inode))
+               return -EINVAL;
+       if (!value || len == 0)
+               return 0;
+       return btrfs_parse_stripe_rmw(value, len, &mask);
+}
+
+static int prop_stripe_rmw_apply(struct btrfs_inode *inode,
+                                      const char *value, size_t len)
+{
+       struct btrfs_fs_info *fs_info = inode->root->fs_info;
+       u32 mask = 0;
+
+       /* Ignore stray copies; only the top-level root carries policy. */
+       if (!prop_stripe_alloc_scope_ok(inode))
+               return 0;
+       if (value && len &&
+           btrfs_parse_stripe_rmw(value, len, &mask))
+               return -EINVAL;
+       WRITE_ONCE(fs_info->stripe_rmw_prop, mask);
+       return 0;
+}
+
 static bool prop_stripe_alloc_ignore(const struct btrfs_inode *inode)
 {
        return false;
@@ -498,6 +526,13 @@ static struct prop_handler prop_handlers[] = {
                .ignore = prop_stripe_alloc_ignore,
                .inheritable = 0
        },
+       {
+               .xattr_name = XATTR_BTRFS_PREFIX "stripe_alloc_allow_rmw",
+               .validate = prop_stripe_rmw_validate,
+               .apply = prop_stripe_rmw_apply,
+               .ignore = prop_stripe_alloc_ignore,
+               .inheritable = 0
+       },
 };
 
 int btrfs_inode_inherit_props(struct btrfs_trans_handle *trans,
index 81ba7c826438227fddb1e45b84a1cd7d9600660d..66b719937621688d7cca7a0d58968118985d5329 100644 (file)
@@ -1070,8 +1070,11 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        const unsigned int sync_timeout_ms =
                READ_ONCE(fs_info->stripe_park_sync_timeout_ms);
        unsigned int timeout_ms = READ_ONCE(fs_info->stripe_park_timeout_ms);
+       enum btrfs_stripe_run_class class;
 
-       if (!btrfs_stripe_in_open_run(fs_info, rbio->bioc->full_stripe_logical))
+       if (!btrfs_stripe_open_run_class(fs_info,
+                                        rbio->bioc->full_stripe_logical,
+                                        &class))
                return false;
 
        spin_lock(&rbio->bio_list_lock);
@@ -1083,6 +1086,15 @@ static bool rbio_try_park(struct btrfs_raid_bio *rbio)
        if (timeout_ms == 0)
                return false;
 
+       /*
+        * A sync write into a nodatacow inode's private run has a waiter and
+        * nothing to merge with (in-place overwrites arrive one fsync at a
+        * time): park only async writeback there.
+        */
+       if (class == BTRFS_STRIPE_RUN_NOCOW &&
+           timeout_ms == BTRFS_RBIO_PARK_SYNC_TIMEOUT_MS)
+               return false;
+
        /*
         * A sync rbio whose submission batch was already merged by its
         * unplug callback has nothing more coming from its submitter; the