diff mbox series

[4/6] btrfs: check for relocation inodes on zoned btrfs in should_nocow

Message ID 4ab859fbb26ec582130b8064621cac9de1100baf.1630679569.git.johannes.thumshirn@wdc.com (mailing list archive)
State New, archived
Headers show
Series btrfs: zoned: unify relocation on a zoned and regular FS | expand

Commit Message

Johannes Thumshirn Sept. 3, 2021, 2:44 p.m. UTC
Prepare for allowing preallocation for relocation inodes.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
 fs/btrfs/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Naohiro Aota Sept. 7, 2021, 11:40 a.m. UTC | #1
On Fri, Sep 03, 2021 at 11:44:45PM +0900, Johannes Thumshirn wrote:
> Prepare for allowing preallocation for relocation inodes.
> 
> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> ---
>  fs/btrfs/inode.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 8e1a46e9c63e..5f4c8e12ebcc 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -1944,7 +1944,8 @@ 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);
> +		ASSERT(!zoned ||
> +		       (zoned && btrfs_is_data_reloc_root(inode->root)));

I want to have a comment why we can allow nocow for this special case.

With that added

Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>

>  		ret = run_delalloc_nocow(inode, locked_page, start, end,
>  					 page_started, nr_written);
>  	} else if (!inode_can_compress(inode) ||
> -- 
> 2.32.0
>
diff mbox series

Patch

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 8e1a46e9c63e..5f4c8e12ebcc 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1944,7 +1944,8 @@  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);
+		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) ||