diff options
author | Christoph Hellwig <hch@lst.de> | 2023-07-24 07:22:41 -0700 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2023-08-21 14:54:47 +0200 |
commit | 76c5126e76696e61ced5d6e34441f857733741bf (patch) | |
tree | 8629fc72bcb93e9d79278142be8537936b52a677 /fs | |
parent | 38dc88890de6cae3db5a33ece287e56fc9cc4ce6 (diff) | |
download | linux-stable-76c5126e76696e61ced5d6e34441f857733741bf.tar.gz linux-stable-76c5126e76696e61ced5d6e34441f857733741bf.tar.bz2 linux-stable-76c5126e76696e61ced5d6e34441f857733741bf.zip |
btrfs: move the !zoned assert into run_delalloc_cow
Having the assert in the actual helper documents the pre-conditions
much better than having it in the caller, so move it.
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/inode.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 8d0dd266dd1b..ca0f4781b0e5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1976,6 +1976,13 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode, u64 ino = btrfs_ino(inode); struct can_nocow_file_extent_args nocow_args = { 0 }; + /* + * Normally on a zoned device we're only doing COW writes, but in case + * of relocation on a zoned filesystem serializes I/O so that we're only + * writing sequentially and can end up here as well. + */ + ASSERT(!btrfs_is_zoned(fs_info) || btrfs_is_data_reloc_root(root)); + path = btrfs_alloc_path(); if (!path) { ret = -ENOMEM; @@ -2257,14 +2264,6 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page start >= page_offset(locked_page) + PAGE_SIZE)); if (should_nocow(inode, start, end)) { - /* - * 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 || btrfs_is_data_reloc_root(inode->root)); ret = run_delalloc_nocow(inode, locked_page, start, end); goto out; } |