This is a note to let you know that I've just added the patch titled btrfs: check for relocation inodes on zoned btrfs in should_nocow to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-check-for-relocation-inodes-on-zoned-btrfs-in-should_nocow.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Fri Nov 19 01:33:42 PM CET 2021 From: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Date: Thu, 18 Nov 2021 17:58:17 +0900 Subject: btrfs: check for relocation inodes on zoned btrfs in should_nocow To: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: linux-btrfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, Naohiro Aota <naohiro.aota@xxxxxxx>, David Sterba <dsterba@xxxxxxxx>, Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Message-ID: <2b57613ad55081ae305f66db17dec297f84c04ca.1637225333.git.johannes.thumshirn@xxxxxxx> From: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> commit 2adada886b26e998b5a624e72f0834ebfdc54cc7 upstream Prepare for allowing preallocation for relocation inodes. Reviewed-by: Naohiro Aota <naohiro.aota@xxxxxxx> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/btrfs/inode.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1945,7 +1945,15 @@ int btrfs_run_delalloc_range(struct btrf const bool zoned = btrfs_is_zoned(inode->root->fs_info); if (should_nocow(inode, start, end)) { - ASSERT(!zoned); + /* + * Normally on a zoned device we're only doing COW writes, but + * in case of relocation on a zoned filesystem we have taken + * precaution, that we're only writing sequentially. It's safe + * to use run_delalloc_nocow() here, like for regular + * preallocated inodes. + */ + ASSERT(!zoned || + (zoned && btrfs_is_data_reloc_root(inode->root))); ret = run_delalloc_nocow(inode, locked_page, start, end, page_started, nr_written); } else if (!inode_can_compress(inode) || Patches currently in stable-queue which might be from johannes.thumshirn@xxxxxxx are queue-5.15/btrfs-zoned-add-a-dedicated-data-relocation-block-group.patch queue-5.15/btrfs-check-for-relocation-inodes-on-zoned-btrfs-in-should_nocow.patch queue-5.15/btrfs-zoned-use-regular-writes-for-relocation.patch queue-5.15/btrfs-introduce-btrfs_is_data_reloc_root.patch queue-5.15/btrfs-zoned-allow-preallocation-for-relocation-inodes.patch queue-5.15/btrfs-zoned-only-allow-one-process-to-add-pages-to-a-relocation-inode.patch