mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chao Yu <chao@kernel.org>
To: Hyunchul Lee <hyc.lee@gmail.com>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: linux-fsdevel@vger.kernel.org, kernel-team@lge.com,
	Hyunchul Lee <cheol.lee@lge.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH 2/3] f2fs: support passing down write hints to block layer with F2FS policy
Date: Wed, 24 Jan 2018 23:39:17 +0800	[thread overview]
Message-ID: <b2c68e88-ed60-af54-45bb-5e81cd927e00@kernel.org> (raw)
In-Reply-To: <1516618149-1495-3-git-send-email-hyc.lee@gmail.com>

On 2018/1/22 18:49, Hyunchul Lee wrote:
> From: Hyunchul Lee <cheol.lee@lge.com>
> 
> Add 'whint_mode=fs-based' mount option. In this mode, F2FS passes
> down write hints with its policy.
> 
> * whint_mode=fs-based. F2FS passes down hints with its policy.
> 
> User                  F2FS                     Block
> ----                  ----                     -----
>                       META                     WRITE_LIFE_MEDIUM;
>                       HOT_NODE                 WRITE_LIFE_NOT_SET
>                       WARM_NODE                "
>                       COLD_NODE                WRITE_LIFE_NONE
> ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
> extension list        "                        "
> 
> -- buffered io
> WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
> WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
> WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_LONG
> WRITE_LIFE_NONE       "                        "
> WRITE_LIFE_MEDIUM     "                        "
> WRITE_LIFE_LONG       "                        "
> 
> -- direct io
> WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
> WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
> WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_NOT_SET
> WRITE_LIFE_NONE       "                        WRITE_LIFE_NONE
> WRITE_LIFE_MEDIUM     "                        WRITE_LIFE_MEDIUM
> WRITE_LIFE_LONG       "                        WRITE_LIFE_LONG
> 
> Many thanks to Chao Yu and Jaegeuk Kim for comments to
> implement this patch.
> 
> Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>> ---
>  fs/f2fs/f2fs.h    |  1 +
>  fs/f2fs/segment.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
>  fs/f2fs/super.c   |  5 +++++
>  3 files changed, 53 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> index d7c2797..898f37d 100644
> --- a/fs/f2fs/f2fs.h
> +++ b/fs/f2fs/f2fs.h
> @@ -1038,6 +1038,7 @@ enum {
>  enum {
>  	WHINT_MODE_OFF,		/* not pass down write hints */
>  	WHINT_MODE_USER,	/* try to pass down hints given by users */
> +	WHINT_MODE_FS,		/* pass down hints with F2FS policy */
>  };
>  
>  struct f2fs_sb_info {
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index 8bc1fc1..b7cae61 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -2491,6 +2491,32 @@ int rw_hint_to_seg_type(enum rw_hint hint)
>   *
>   * 2) whint_mode=off. F2FS only passes down WRITE_LIFE_NOT_SET.
>   *
> + * 3) whint_mode=fs-based. F2FS passes down hints with its policy.
> + *
> + * User                  F2FS                     Block
> + * ----                  ----                     -----
> + *                       META                     WRITE_LIFE_MEDIUM;
> + *                       HOT_NODE                 WRITE_LIFE_NOT_SET
> + *                       WARM_NODE                "
> + *                       COLD_NODE                WRITE_LIFE_NONE
> + * ioctl(COLD)           COLD_DATA                WRITE_LIFE_EXTREME
> + * extension list        "                        "
> + *
> + * -- buffered io
> + * WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
> + * WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
> + * WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_LONG
> + * WRITE_LIFE_NONE       "                        "
> + * WRITE_LIFE_MEDIUM     "                        "
> + * WRITE_LIFE_LONG       "                        "
> + *
> + * -- direct io
> + * WRITE_LIFE_EXTREME    COLD_DATA                WRITE_LIFE_EXTREME
> + * WRITE_LIFE_SHORT      HOT_DATA                 WRITE_LIFE_SHORT
> + * WRITE_LIFE_NOT_SET    WARM_DATA                WRITE_LIFE_NOT_SET
> + * WRITE_LIFE_NONE       "                        WRITE_LIFE_NONE
> + * WRITE_LIFE_MEDIUM     "                        WRITE_LIFE_MEDIUM
> + * WRITE_LIFE_LONG       "                        WRITE_LIFE_LONG
>   */
>  
>  enum rw_hint io_type_to_rw_hint(struct f2fs_sb_info *sbi,
> @@ -2509,9 +2535,28 @@ enum rw_hint io_type_to_rw_hint(struct f2fs_sb_info *sbi,
>  		} else {
>  			return WRITE_LIFE_NOT_SET;
>  		}
> -	} else {
> -		return WRITE_LIFE_NOT_SET;
> +	} else if (sbi->whint_mode == WHINT_MODE_FS) {
> +		if (type == DATA) {
> +			switch (temp) {
> +			case COLD:
> +				return WRITE_LIFE_EXTREME;
> +			case HOT:
> +				return WRITE_LIFE_SHORT;
> +			default:

How about changing to use explicit code:
	case HOT:
		return WRITE_LIFE_SHORT;
	case WARM:
		return WRITE_LIFE_LONG;
	case COLD:
		return WRITE_LIFE_EXTREME;

> +				return WRITE_LIFE_LONG;
> +			}
> +		} else if (type == NODE) {
> +			switch (temp) {
> +			case COLD:
> +				return WRITE_LIFE_NONE;
> +			default:

Ditto,
	case HOT:
	case WARM:
		return WRITE_LIFE_NOT_SET;
	case COLD:
		return WRITE_LIFE_NONE;

Thanks,

> +				return WRITE_LIFE_NOT_SET;
> +			}
> +		} else if (type == META) {
> +			return WRITE_LIFE_MEDIUM;
> +		}
>  	}
> +	return WRITE_LIFE_NOT_SET;
>  }
>  
>  static int __get_segment_type_2(struct f2fs_io_info *fio)
> diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> index 9e22926..2115285 100644
> --- a/fs/f2fs/super.c
> +++ b/fs/f2fs/super.c
> @@ -691,6 +691,9 @@ static int parse_options(struct super_block *sb, char *options)
>  			} else if (strlen(name) == 3 &&
>  					!strncmp(name, "off", 3)) {
>  				sbi->whint_mode = WHINT_MODE_OFF;
> +			} else if (strlen(name) == 8 &&
> +					!strncmp(name, "fs-based", 8)) {
> +				sbi->whint_mode = WHINT_MODE_FS;
>  			} else {
>  				kfree(name);
>  				return -EINVAL;
> @@ -1245,6 +1248,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root)
>  	f2fs_show_quota_options(seq, sbi->sb);
>  	if (sbi->whint_mode == WHINT_MODE_USER)
>  		seq_printf(seq, ",whint_mode=%s", "user-based");
> +	else if (sbi->whint_mode == WHINT_MODE_FS)
> +		seq_printf(seq, ",whint_mode=%s", "fs-based");
>  
>  	return 0;
>  }
> 

  reply	other threads:[~2018-01-24 15:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 10:49 [PATCH 0/3] f2fs: support passing down write hints to block layer Hyunchul Lee
2018-01-22 10:49 ` [PATCH 1/3] f2fs: support passing down write hints given by users " Hyunchul Lee
2018-01-24 15:32   ` [f2fs-dev] " Chao Yu
2018-01-25  2:47     ` Hyunchul Lee
2018-01-25  8:01       ` Chao Yu
2018-01-25 23:46         ` Hyunchul Lee
2018-01-26  2:10           ` Chao Yu
2018-01-29  1:49             ` Hyunchul Lee
2018-01-29  7:41               ` Chao Yu
2018-01-22 10:49 ` [PATCH 2/3] f2fs: support passing down write hints to block layer with F2FS policy Hyunchul Lee
2018-01-24 15:39   ` Chao Yu [this message]
2018-01-22 10:49 ` [PATCH 3/3] f2fs: Add the 'whint_mode' mount option to f2fs documentation Hyunchul Lee

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=b2c68e88-ed60-af54-45bb-5e81cd927e00@kernel.org \
    --to=chao@kernel.org \
    --cc=cheol.lee@lge.com \
    --cc=hyc.lee@gmail.com \
    --cc=jaegeuk@kernel.org \
    --cc=kernel-team@lge.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yuchao0@huawei.com \
    /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

all inboxes | Powered by JetHome®