diff options
author | Johannes Thumshirn <johannes.thumshirn@wdc.com> | 2021-09-09 01:19:29 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2021-10-26 19:08:01 +0200 |
commit | 2adada886b26e998b5a624e72f0834ebfdc54cc7 (patch) | |
tree | 9066008f1e3884253e13ff1d907bbb0046de12b9 /fs/btrfs/inode.c | |
parent | e6d261e3b1f777b499ce8f535ed44dd1b69278b7 (diff) | |
download | linux-2adada886b26e998b5a624e72f0834ebfdc54cc7.tar.bz2 |
btrfs: check for relocation inodes on zoned btrfs in should_nocow
Prepare for allowing preallocation for relocation inodes.
Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r-- | fs/btrfs/inode.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7d27d6626888..9b05af75d910 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1944,7 +1944,15 @@ int btrfs_run_delalloc_range(struct btrfs_inode *inode, struct page *locked_page 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) || |