From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: assign the write hint per stream by default
Date: Fri, 19 Apr 2024 17:53:31 +0000 [thread overview]
Message-ID: <ZiKvm57zbjq_ZpZj@google.com> (raw)
In-Reply-To: <afe91331-92a5-4ccf-b5b3-095a2d65f0d0@kernel.org>
On 04/18, Chao Yu wrote:
> On 2024/4/18 5:12, Jaegeuk Kim wrote:
> > This reverts commit 930e2607638d ("f2fs: remove obsolete whint_mode"), as we
> > decide to pass write hints to the disk.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > Documentation/filesystems/f2fs.rst | 29 +++++++++++++++
> > fs/f2fs/data.c | 2 +
> > fs/f2fs/f2fs.h | 2 +
> > fs/f2fs/segment.c | 59 ++++++++++++++++++++++++++++++
> > 4 files changed, 92 insertions(+)
> >
> > diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
> > index efc3493fd6f8..68a0885fb5e6 100644
> > --- a/Documentation/filesystems/f2fs.rst
> > +++ b/Documentation/filesystems/f2fs.rst
> > @@ -774,6 +774,35 @@ In order to identify whether the data in the victim segment are valid or not,
> > F2FS manages a bitmap. Each bit represents the validity of a block, and the
> > bitmap is composed of a bit stream covering whole blocks in main area.
> > +Write-hint Policy
> > +-----------------
> > +
> > +F2FS sets the whint all the time with the below policy.
>
> No user-based mode?
Not anymore, as there's no user.
>
> Thanks,
>
> > +
> > +===================== ======================== ===================
> > +User F2FS Block
> > +===================== ======================== ===================
> > +N/A META WRITE_LIFE_NONE|REQ_META
> > +N/A HOT_NODE WRITE_LIFE_NONE
> > +N/A WARM_NODE WRITE_LIFE_MEDIUM
> > +N/A COLD_NODE WRITE_LIFE_LONG
> > +ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
> > +extension list " "
> > +
> > +-- buffered io
> > +N/A COLD_DATA WRITE_LIFE_EXTREME
> > +N/A HOT_DATA WRITE_LIFE_SHORT
> > +N/A WARM_DATA WRITE_LIFE_NOT_SET
> > +
> > +-- 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
> > +===================== ======================== ===================
> > +
> > Fallocate(2) Policy
> > -------------------
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 5d641fac02ba..ed7d08785fcf 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -465,6 +465,8 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
> > } else {
> > bio->bi_end_io = f2fs_write_end_io;
> > bio->bi_private = sbi;
> > + bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi,
> > + fio->type, fio->temp);
> > }
> > iostat_alloc_and_bind_ctx(sbi, bio, NULL);
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index dd530dc70005..b3b878acc86b 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -3745,6 +3745,8 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);
> > int __init f2fs_create_segment_manager_caches(void);
> > void f2fs_destroy_segment_manager_caches(void);
> > int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
> > +enum rw_hint f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi,
> > + enum page_type type, enum temp_type temp);
> > unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
> > unsigned int segno);
> > unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index f0da516ba8dc..daa94669f7ee 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -3364,6 +3364,65 @@ int f2fs_rw_hint_to_seg_type(enum rw_hint hint)
> > }
> > }
> > +/*
> > + * This returns write hints for each segment type. This hints will be
> > + * passed down to block layer as below by default.
> > + *
> > + * User F2FS Block
> > + * ---- ---- -----
> > + * META WRITE_LIFE_NONE|REQ_META
> > + * HOT_NODE WRITE_LIFE_NONE
> > + * WARM_NODE WRITE_LIFE_MEDIUM
> > + * COLD_NODE WRITE_LIFE_LONG
> > + * ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
> > + * extension list " "
> > + *
> > + * -- buffered io
> > + * COLD_DATA WRITE_LIFE_EXTREME
> > + * HOT_DATA WRITE_LIFE_SHORT
> > + * WARM_DATA WRITE_LIFE_NOT_SET
> > + *
> > + * -- 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 f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi,
> > + enum page_type type, enum temp_type temp)
> > +{
> > + switch (type) {
> > + case DATA:
> > + switch (temp) {
> > + case WARM:
> > + return WRITE_LIFE_NOT_SET;
> > + case HOT:
> > + return WRITE_LIFE_SHORT;
> > + case COLD:
> > + return WRITE_LIFE_EXTREME;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > + case NODE:
> > + switch (temp) {
> > + case WARM:
> > + return WRITE_LIFE_MEDIUM;
> > + case HOT:
> > + return WRITE_LIFE_NONE;
> > + case COLD:
> > + return WRITE_LIFE_LONG;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > + case META:
> > + return WRITE_LIFE_NONE;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > +}
> > +
> > static int __get_segment_type_2(struct f2fs_io_info *fio)
> > {
> > if (fio->type == DATA)
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: assign the write hint per stream by default
Date: Fri, 19 Apr 2024 17:53:31 +0000 [thread overview]
Message-ID: <ZiKvm57zbjq_ZpZj@google.com> (raw)
In-Reply-To: <afe91331-92a5-4ccf-b5b3-095a2d65f0d0@kernel.org>
On 04/18, Chao Yu wrote:
> On 2024/4/18 5:12, Jaegeuk Kim wrote:
> > This reverts commit 930e2607638d ("f2fs: remove obsolete whint_mode"), as we
> > decide to pass write hints to the disk.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > Documentation/filesystems/f2fs.rst | 29 +++++++++++++++
> > fs/f2fs/data.c | 2 +
> > fs/f2fs/f2fs.h | 2 +
> > fs/f2fs/segment.c | 59 ++++++++++++++++++++++++++++++
> > 4 files changed, 92 insertions(+)
> >
> > diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst
> > index efc3493fd6f8..68a0885fb5e6 100644
> > --- a/Documentation/filesystems/f2fs.rst
> > +++ b/Documentation/filesystems/f2fs.rst
> > @@ -774,6 +774,35 @@ In order to identify whether the data in the victim segment are valid or not,
> > F2FS manages a bitmap. Each bit represents the validity of a block, and the
> > bitmap is composed of a bit stream covering whole blocks in main area.
> > +Write-hint Policy
> > +-----------------
> > +
> > +F2FS sets the whint all the time with the below policy.
>
> No user-based mode?
Not anymore, as there's no user.
>
> Thanks,
>
> > +
> > +===================== ======================== ===================
> > +User F2FS Block
> > +===================== ======================== ===================
> > +N/A META WRITE_LIFE_NONE|REQ_META
> > +N/A HOT_NODE WRITE_LIFE_NONE
> > +N/A WARM_NODE WRITE_LIFE_MEDIUM
> > +N/A COLD_NODE WRITE_LIFE_LONG
> > +ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
> > +extension list " "
> > +
> > +-- buffered io
> > +N/A COLD_DATA WRITE_LIFE_EXTREME
> > +N/A HOT_DATA WRITE_LIFE_SHORT
> > +N/A WARM_DATA WRITE_LIFE_NOT_SET
> > +
> > +-- 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
> > +===================== ======================== ===================
> > +
> > Fallocate(2) Policy
> > -------------------
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index 5d641fac02ba..ed7d08785fcf 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -465,6 +465,8 @@ static struct bio *__bio_alloc(struct f2fs_io_info *fio, int npages)
> > } else {
> > bio->bi_end_io = f2fs_write_end_io;
> > bio->bi_private = sbi;
> > + bio->bi_write_hint = f2fs_io_type_to_rw_hint(sbi,
> > + fio->type, fio->temp);
> > }
> > iostat_alloc_and_bind_ctx(sbi, bio, NULL);
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index dd530dc70005..b3b878acc86b 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -3745,6 +3745,8 @@ void f2fs_destroy_segment_manager(struct f2fs_sb_info *sbi);
> > int __init f2fs_create_segment_manager_caches(void);
> > void f2fs_destroy_segment_manager_caches(void);
> > int f2fs_rw_hint_to_seg_type(enum rw_hint hint);
> > +enum rw_hint f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi,
> > + enum page_type type, enum temp_type temp);
> > unsigned int f2fs_usable_segs_in_sec(struct f2fs_sb_info *sbi,
> > unsigned int segno);
> > unsigned int f2fs_usable_blks_in_seg(struct f2fs_sb_info *sbi,
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index f0da516ba8dc..daa94669f7ee 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -3364,6 +3364,65 @@ int f2fs_rw_hint_to_seg_type(enum rw_hint hint)
> > }
> > }
> > +/*
> > + * This returns write hints for each segment type. This hints will be
> > + * passed down to block layer as below by default.
> > + *
> > + * User F2FS Block
> > + * ---- ---- -----
> > + * META WRITE_LIFE_NONE|REQ_META
> > + * HOT_NODE WRITE_LIFE_NONE
> > + * WARM_NODE WRITE_LIFE_MEDIUM
> > + * COLD_NODE WRITE_LIFE_LONG
> > + * ioctl(COLD) COLD_DATA WRITE_LIFE_EXTREME
> > + * extension list " "
> > + *
> > + * -- buffered io
> > + * COLD_DATA WRITE_LIFE_EXTREME
> > + * HOT_DATA WRITE_LIFE_SHORT
> > + * WARM_DATA WRITE_LIFE_NOT_SET
> > + *
> > + * -- 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 f2fs_io_type_to_rw_hint(struct f2fs_sb_info *sbi,
> > + enum page_type type, enum temp_type temp)
> > +{
> > + switch (type) {
> > + case DATA:
> > + switch (temp) {
> > + case WARM:
> > + return WRITE_LIFE_NOT_SET;
> > + case HOT:
> > + return WRITE_LIFE_SHORT;
> > + case COLD:
> > + return WRITE_LIFE_EXTREME;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > + case NODE:
> > + switch (temp) {
> > + case WARM:
> > + return WRITE_LIFE_MEDIUM;
> > + case HOT:
> > + return WRITE_LIFE_NONE;
> > + case COLD:
> > + return WRITE_LIFE_LONG;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > + case META:
> > + return WRITE_LIFE_NONE;
> > + default:
> > + return WRITE_LIFE_NONE;
> > + }
> > +}
> > +
> > static int __get_segment_type_2(struct f2fs_io_info *fio)
> > {
> > if (fio->type == DATA)
next prev parent reply other threads:[~2024-04-19 19:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-17 21:12 [f2fs-dev] [PATCH] f2fs: assign the write hint per stream by default Jaegeuk Kim
2024-04-17 21:12 ` Jaegeuk Kim
2024-04-18 3:33 ` [f2fs-dev] " Chao Yu
2024-04-18 3:33 ` Chao Yu
2024-04-19 17:53 ` Jaegeuk Kim [this message]
2024-04-19 17:53 ` Jaegeuk Kim
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=ZiKvm57zbjq_ZpZj@google.com \
--to=jaegeuk@kernel.org \
--cc=chao@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.