From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Damien Le Moal <Damien.LeMoal@hgst.com>
Cc: schmorp@schmorp.de,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
"linux-f2fs-devel@lists.sourceforge.net"
<linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [PATCH 1/2] f2fs: detect host-managed SMR by feature flag
Date: Wed, 15 Jun 2016 09:32:46 -0700 [thread overview]
Message-ID: <20160615163246.GA93951@jaegeuk> (raw)
In-Reply-To: <BY2PR04MB19767501012B2D01073F1AA09F550@BY2PR04MB1976.namprd04.prod.outlook.com>
On Wed, Jun 15, 2016 at 04:21:13AM +0000, Damien Le Moal wrote:
> Jaegeuk,
>
> On 6/15/16 03:45, Jaegeuk Kim wrote:
> > If mkfs.f2fs gives a feature flag for host-managed SMR, we can set mode=lfs
> > by default.
> >
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/f2fs.h | 21 +++++++++++++++++++++
> > fs/f2fs/super.c | 14 ++++++++------
> > 2 files changed, 29 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
> > index 32be19e..1a19c02 100644
> > --- a/fs/f2fs/f2fs.h
> > +++ b/fs/f2fs/f2fs.h
> > @@ -133,6 +133,7 @@ struct f2fs_mount_info {
> > };
> >
> > #define F2FS_FEATURE_ENCRYPT 0x0001
> > +#define F2FS_FEATURE_HMSMR 0x0002
> >
> > #define F2FS_HAS_FEATURE(sb, mask) \
> > ((F2FS_SB(sb)->raw_super->feature & cpu_to_le32(mask)) != 0)
> > @@ -2354,6 +2355,26 @@ static inline int f2fs_sb_has_crypto(struct super_block *sb)
> > return F2FS_HAS_FEATURE(sb, F2FS_FEATURE_ENCRYPT);
> > }
> >
> > +static inline int f2fs_sb_mounted_hmsmr(struct super_block *sb)
> > +{
> > + return F2FS_HAS_FEATURE(sb, F2FS_FEATURE_HMSMR);
> > +}
> > +
> > +static inline void set_opt_mode(struct f2fs_sb_info *sbi, unsigned int mt)
> > +{
> > + clear_opt(sbi, ADAPTIVE);
> > + clear_opt(sbi, LFS);
> > +
> > + switch (mt) {
> > + case F2FS_MOUNT_ADAPTIVE:
> > + set_opt(sbi, ADAPTIVE);
> > + break;
> > + case F2FS_MOUNT_LFS:
> > + set_opt(sbi, LFS);
> > + break;
> > + }
> > +}
> > +
> > static inline bool f2fs_may_encrypt(struct inode *inode)
> > {
> > #ifdef CONFIG_F2FS_FS_ENCRYPTION
> > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
> > index edc736d..71b6066 100644
> > --- a/fs/f2fs/super.c
> > +++ b/fs/f2fs/super.c
> > @@ -515,12 +515,10 @@ static int parse_options(struct super_block *sb, char *options)
> > return -ENOMEM;
> > if (strlen(name) == 8 &&
> > !strncmp(name, "adaptive", 8)) {
> > - set_opt(sbi, ADAPTIVE);
> > - clear_opt(sbi, LFS);
> > + set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE);
> > } else if (strlen(name) == 3 &&
> > !strncmp(name, "lfs", 3)) {
> > - clear_opt(sbi, ADAPTIVE);
> > - set_opt(sbi, LFS);
> > + set_opt_mode(sbi, F2FS_MOUNT_LFS);
> > } else {
> > kfree(name);
> > return -EINVAL;
> > @@ -980,7 +978,10 @@ static void default_options(struct f2fs_sb_info *sbi)
> > set_opt(sbi, EXTENT_CACHE);
> > sbi->sb->s_flags |= MS_LAZYTIME;
> > set_opt(sbi, FLUSH_MERGE);
> > - set_opt(sbi, ADAPTIVE);
> > + if (f2fs_sb_mounted_hmsmr(sbi->sb))
> > + set_opt_mode(sbi, F2FS_MOUNT_LFS);
> > + else
> > + set_opt_mode(sbi, F2FS_MOUNT_ADAPTIVE);
>
> Strictly speaking, host-aware drives would not require the LFS mode
> as any zone of the disk can be randomly written and so the occasional
> in-place updates of the adaptive mode would be OK. However, randomly
> writing host-aware drives can lead to a lot of background activity on
> the drive side for internal management of the accumulated random writes,
> with a potential performance drop over time (this is highly dependent on
> the drive FW implementation though).
>
> So I think it would be good to also enable the LFS mode by default for
> host-aware devices, unless the user has explicitly specified mount with
> adaptive mode (if the user "knows" that the drive FW handles very
> efficiently random writes).
Agreed. Would HASMR also provide the same geometry, zone information, in mkfs?
Cause I haven't tested it so far.
IIRC, we discussed about HASMR with Marc Lehmann last year, and he gave the
below link which sums up.
http://comments.gmane.org/gmane.linux.file-systems.f2fs/2854
http://blog.schmorp.de/2015-10-08-smr-archive-drives-fast-now.html
> So how about also introducing a F2FS_FEATURE_HASMR feature flag to
> handle these different cases ?
Yes, so once I can retrieve the zone information from the device, surely I'll
add that.
> Also, I think that the DISCARD option must be enabled by default for
> HMSMR disks. Otherwise, zones write pointer will never get reset.
> The same applies to HASMR devices mounted with the LFS mode.
> (In any case, the discard handling does not look like it will always
> align to the device zone size, which will fail on a zoned disk (discard
> granularity is the zone size). I may be missing something though. Still
> checking.)
Yup, will do. BTW, I remember I fixed zone-aligned discard issue before.
Could you please check the latest dev-test branch in f2fs.git?
I'm used to rebase that branch occasionally when I changed the previous patches.
Thanks,
>
> Best regards.
>
> --
> Damien Le Moal, Ph.D.
> Sr. Manager, System Software Group, HGST Research,
> HGST, a Western Digital company
> Damien.LeMoal@hgst.com
> (+81) 0466-98-3593 (ext. 513593)
> 1 kirihara-cho, Fujisawa,
> Kanagawa, 252-0888 Japan
> www.hgst.com
> Western Digital Corporation (and its subsidiaries) E-mail Confidentiality Notice & Disclaimer:
>
> This e-mail and any files transmitted with it may contain confidential or legally privileged information of WDC and/or its affiliates, and are intended solely for the use of the individual or entity to which they are addressed. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited. If you have received this e-mail in error, please notify the sender immediately and delete the e-mail in its entirety from your system.
next prev parent reply other threads:[~2016-06-15 16:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-14 18:43 [PATCH 1/2] f2fs: detect host-managed SMR by feature flag Jaegeuk Kim
2016-06-14 18:43 ` [PATCH 2/2] f2fs: call update_inode_page for orphan inodes Jaegeuk Kim
2016-06-15 4:21 ` [PATCH 1/2] f2fs: detect host-managed SMR by feature flag Damien Le Moal
2016-06-15 16:32 ` Jaegeuk Kim [this message]
2016-08-24 20:31 ` Shaun Tancheff
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=20160615163246.GA93951@jaegeuk \
--to=jaegeuk@kernel.org \
--cc=Damien.LeMoal@hgst.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=schmorp@schmorp.de \
/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 NNTP newsgroup(s).