Skip to content

Commit 76c5126

Browse files
Christoph Hellwigkdave
authored andcommitted
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 <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 38dc888 commit 76c5126

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fs/btrfs/inode.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1976,6 +1976,13 @@ static noinline int run_delalloc_nocow(struct btrfs_inode *inode,
19761976
u64 ino = btrfs_ino(inode);
19771977
struct can_nocow_file_extent_args nocow_args = { 0 };
19781978

1979+
/*
1980+
* Normally on a zoned device we're only doing COW writes, but in case
1981+
* of relocation on a zoned filesystem serializes I/O so that we're only
1982+
* writing sequentially and can end up here as well.
1983+
*/
1984+
ASSERT(!btrfs_is_zoned(fs_info) || btrfs_is_data_reloc_root(root));
1985+
19791986
path = btrfs_alloc_path();
19801987
if (!path) {
19811988
ret = -ENOMEM;
@@ -2257,14 +2264,6 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page
22572264
start >= page_offset(locked_page) + PAGE_SIZE));
22582265

22592266
if (should_nocow(inode, start, end)) {
2260-
/*
2261-
* Normally on a zoned device we're only doing COW writes, but
2262-
* in case of relocation on a zoned filesystem we have taken
2263-
* precaution, that we're only writing sequentially. It's safe
2264-
* to use run_delalloc_nocow() here, like for regular
2265-
* preallocated inodes.
2266-
*/
2267-
ASSERT(!zoned || btrfs_is_data_reloc_root(inode->root));
22682267
ret = run_delalloc_nocow(inode, locked_page, start, end);
22692268
goto out;
22702269
}

0 commit comments

Comments
 (0)