Re: [PATCH v9 07/41] btrfs: disallow space_cache in ZONED mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 30, 2020 at 10:51:14PM +0900, Naohiro Aota wrote:
> INODE_MAP_CACHE inode.
> 
> In summary, ZONED will disable:
> 
> | Disabled features | Reason                                              |
> |-------------------+-----------------------------------------------------|
> | RAID/Dup          | Cannot handle two zone append writes to different   |
> |                   | zones                                               |
> |-------------------+-----------------------------------------------------|
> | space_cache (v1)  | In-place updating                                   |
> | NODATACOW         | In-place updating                                   |
> |-------------------+-----------------------------------------------------|
> | fallocate         | Reserved extent will be a write hole                |
> | INODE_MAP_CACHE   | Need pre-allocation. (and will be deprecated?)      |

space_cache is deprecated and actually in current dev cycle (5.11)

> |-------------------+-----------------------------------------------------|
> | MIXED_BG          | Allocated metadata region will be write holes for   |
> |                   | data writes                                         |
> 
> Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx>
> ---
>  fs/btrfs/super.c | 12 ++++++++++--
>  fs/btrfs/zoned.c | 18 ++++++++++++++++++
>  fs/btrfs/zoned.h |  5 +++++
>  3 files changed, 33 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> index 3312fe08168f..9064ca62b0a0 100644
> --- a/fs/btrfs/super.c
> +++ b/fs/btrfs/super.c
> @@ -525,8 +525,14 @@ int btrfs_parse_options(struct btrfs_fs_info *info, char *options,
>  	cache_gen = btrfs_super_cache_generation(info->super_copy);
>  	if (btrfs_fs_compat_ro(info, FREE_SPACE_TREE))
>  		btrfs_set_opt(info->mount_opt, FREE_SPACE_TREE);
> -	else if (cache_gen)
> -		btrfs_set_opt(info->mount_opt, SPACE_CACHE);
> +	else if (cache_gen) {
> +		if (btrfs_is_zoned(info)) {
> +			btrfs_info(info,
> +			"clearring existing space cache in ZONED mode");

			"zoned: clearing existing space cache"

Is it clearing or just invalidating it? We have the same problem with
enabling v2 so this could share some code once Boris' patches are
merged.

> +			btrfs_set_super_cache_generation(info->super_copy, 0);
> +		} else

		} else {

> +			btrfs_set_opt(info->mount_opt, SPACE_CACHE);

		}
> +	}
>  
>  	/*
>  	 * Even the options are empty, we still need to do extra check

> --- a/fs/btrfs/zoned.c
> +++ b/fs/btrfs/zoned.c
> @@ -265,3 +265,21 @@ int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
>  out:
>  	return ret;
>  }
> +
> +int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info)
> +{
> +	if (!btrfs_is_zoned(info))
> +		return 0;
> +
> +	/*
> +	 * SPACE CACHE writing is not CoWed. Disable that to avoid write

	 * Space cache writing is nod COWed. ...

> +	 * errors in sequential zones.
> +	 */
> +	if (btrfs_test_opt(info, SPACE_CACHE)) {
> +		btrfs_err(info,
> +			  "space cache v1 not supportted in ZONED mode");

		"zoned: space cache v1 is not supported"

> +		return -EOPNOTSUPP;

This should be EINVAL, like invalid cobination. EOPNOTSUPP is for cases
where it's not supported but could be if implemented.

> +	}
> +
> +	return 0;
> +}
> diff --git a/fs/btrfs/zoned.h b/fs/btrfs/zoned.h
> index a63f6177f9ee..0b7756a7104d 100644
> --- a/fs/btrfs/zoned.h
> +++ b/fs/btrfs/zoned.h
> @@ -24,6 +24,7 @@ int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos,
>  int btrfs_get_dev_zone_info(struct btrfs_device *device);
>  void btrfs_destroy_dev_zone_info(struct btrfs_device *device);
>  int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info);
> +int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info);
>  #else /* CONFIG_BLK_DEV_ZONED */
>  static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos,
>  				     struct blk_zone *zone)
> @@ -43,6 +44,10 @@ static inline int btrfs_check_zoned_mode(struct btrfs_fs_info *fs_info)
>  	btrfs_err(fs_info, "Zoned block devices support is not enabled");
>  	return -EOPNOTSUPP;
>  }

newline

> +static inline int btrfs_check_mountopts_zoned(struct btrfs_fs_info *info)
> +{
> +	return 0;
> +}

newline

>  #endif
>  
>  static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos)



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux