Linux-f2fs-devel Archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Liao Yuanhong <liaoyuanhong@vivo.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs:add zone device priority option to the mount options
Date: Tue, 16 Apr 2024 16:53:31 +0000	[thread overview]
Message-ID: <Zh6tC-fTZZlP5Dk2@google.com> (raw)
In-Reply-To: <20240415091650.27825-1-liaoyuanhong@vivo.com>

I don't see any point why we need this.

On 04/15, Liao Yuanhong wrote:
> Add a zone device priority option in the mount options. When enabled, the 
> file system will prioritize using zone devices free space instead of 
> conventional devices when writing to the end of the storage space.
> 
> Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
> ---
>  fs/f2fs/f2fs.h    |  1 +
>  fs/f2fs/segment.c | 13 ++++++++++++-
>  fs/f2fs/super.c   | 20 ++++++++++++++++++++
>  3 files changed, 33 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index fced2b7652f4..e2438f7d2e13 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -116,6 +116,7 @@ extern const char *f2fs_fault_name[FAULT_MAX];
>  #define	F2FS_MOUNT_GC_MERGE		0x02000000
>  #define F2FS_MOUNT_COMPRESS_CACHE	0x04000000
>  #define F2FS_MOUNT_AGE_EXTENT_CACHE	0x08000000
> +#define F2FS_MOUNT_PRIORITY_ZONED	0x10000000
>  
>  #define F2FS_OPTION(sbi)	((sbi)->mount_opt)
>  #define clear_opt(sbi, option)	(F2FS_OPTION(sbi).opt &= ~F2FS_MOUNT_##option)
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 4fd76e867e0a..adbe68a11fa5 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2697,7 +2697,18 @@ static int get_new_segment(struct f2fs_sb_info *sbi,
>  find_other_zone:
>  	secno = find_next_zero_bit(free_i->free_secmap, MAIN_SECS(sbi), hint);
>  	if (secno >= MAIN_SECS(sbi)) {
> -		secno = find_first_zero_bit(free_i->free_secmap,
> +		/* set hint to get section from zone device first */
> +		if (test_opt(sbi, PRIORITY_ZONED)) {
> +			hint = GET_SEC_FROM_SEG(sbi, first_zoned_segno(sbi));
> +			secno = find_next_zero_bit(free_i->free_secmap,
> +						MAIN_SECS(sbi), hint);
> +
> +			/* get section from clu if exceeding the size limit */
> +			if (secno >= MAIN_SECS(sbi))
> +				secno = find_first_zero_bit(free_i->free_secmap,
> +							MAIN_SECS(sbi));
> +		} else
> +			secno = find_first_zero_bit(free_i->free_secmap,
>  							MAIN_SECS(sbi));
>  		if (secno >= MAIN_SECS(sbi)) {
>  			ret = -ENOSPC;
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index a4bc26dfdb1a..2742978a100a 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -126,6 +126,8 @@ enum {
>  	Opt_inline_data,
>  	Opt_inline_dentry,
>  	Opt_noinline_dentry,
> +	Opt_priority_zoned,
> +	Opt_nopriority_zoned,
>  	Opt_flush_merge,
>  	Opt_noflush_merge,
>  	Opt_barrier,
> @@ -204,6 +206,8 @@ static match_table_t f2fs_tokens = {
>  	{Opt_inline_data, "inline_data"},
>  	{Opt_inline_dentry, "inline_dentry"},
>  	{Opt_noinline_dentry, "noinline_dentry"},
> +	{Opt_priority_zoned, "priority_zoned"},
> +	{Opt_nopriority_zoned, "nopriority_zoned"},
>  	{Opt_flush_merge, "flush_merge"},
>  	{Opt_noflush_merge, "noflush_merge"},
>  	{Opt_barrier, "barrier"},
> @@ -805,6 +809,16 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount)
>  		case Opt_noinline_dentry:
>  			clear_opt(sbi, INLINE_DENTRY);
>  			break;
> +#ifdef CONFIG_BLK_DEV_ZONED
> +		case Opt_priority_zoned:
> +			if (f2fs_sb_has_blkzoned(sbi))
> +				set_opt(sbi, PRIORITY_ZONED);
> +			break;
> +		case Opt_nopriority_zoned:
> +			if (f2fs_sb_has_blkzoned(sbi))
> +				clear_opt(sbi, PRIORITY_ZONED);
> +			break;
> +#endif
>  		case Opt_flush_merge:
>  			set_opt(sbi, FLUSH_MERGE);
>  			break;
> @@ -1990,6 +2004,12 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
>  		seq_puts(seq, ",inline_dentry");
>  	else
>  		seq_puts(seq, ",noinline_dentry");
> +#ifdef CONFIG_BLK_DEV_ZONED
> +	if (test_opt(sbi, PRIORITY_ZONED))
> +		seq_puts(seq, ",priority_zoned");
> +	else
> +		seq_puts(seq, ",nopriority_zoned");
> +#endif
>  	if (test_opt(sbi, FLUSH_MERGE))
>  		seq_puts(seq, ",flush_merge");
>  	else
> -- 
> 2.25.1


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

      reply	other threads:[~2024-04-16 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  9:16 [f2fs-dev] [PATCH] f2fs:add zone device priority option to the mount options Liao Yuanhong via Linux-f2fs-devel
2024-04-16 16:53 ` Jaegeuk Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Zh6tC-fTZZlP5Dk2@google.com \
    --to=jaegeuk@kernel.org \
    --cc=liaoyuanhong@vivo.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).