All of lore.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@wdc.com>
To: <jaegeuk@kernel.org>, <yuchao0@huawei.com>
Cc: <linux-fsdevel@vger.kernel.org>,
	<linux-f2fs-devel@lists.sourceforge.net>,
	Hannes Reinecke <hare@suse.de>,
	Shaun Tancheff <shaun@tancheff.com>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: [PATCH 3/9] f2fs: Check zoned block feature for host-managed zoned block devices
Date: Fri, 28 Oct 2016 16:55:31 +0900	[thread overview]
Message-ID: <1477641337-12321-4-git-send-email-damien.lemoal@wdc.com> (raw)
In-Reply-To: <1477641337-12321-1-git-send-email-damien.lemoal@wdc.com>

The F2FS_FEATURE_BLKZONED feature indicates that the drive was formatted
 with zone alignment optimization. This is optional for host-aware
devices, but mandatory for host-managed zoned block devices.
So check that the feature is set in this latter case.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 fs/f2fs/super.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a83df29..c6e9b94 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1642,6 +1642,26 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_fs_info = sbi;
 	sbi->raw_super = raw_super;
 
+	/*
+	 * The BLKZONED feature indicates that the drive was formatted with
+	 * zone alignment optimization. This is optional for host-aware
+	 * devices, but mandatory for host-managed zoned block devices.
+	 */
+#ifndef CONFIG_BLK_DEV_ZONED
+	if (f2fs_sb_mounted_blkzoned(sb)) {
+		f2fs_msg(sb, KERN_ERR,
+			 "Zoned block device support is not enabled\n");
+		goto free_sb_buf;
+	}
+#else
+	if (bdev_zoned_model(sb->s_bdev) == BLK_ZONED_HM &&
+	    !f2fs_sb_mounted_blkzoned(sb)) {
+		f2fs_msg(sb, KERN_ERR,
+			 "Zoned block device feature not enabled\n");
+		goto free_sb_buf;
+	}
+#endif
+
 	default_options(sbi);
 	/* parse mount options */
 	options = kstrdup((const char *)data, GFP_KERNEL);
-- 
2.7.4


WARNING: multiple messages have this Message-ID (diff)
From: Damien Le Moal <damien.lemoal@wdc.com>
To: jaegeuk@kernel.org, yuchao0@huawei.com
Cc: linux-fsdevel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	Hannes Reinecke <hare@suse.de>,
	Shaun Tancheff <shaun@tancheff.com>,
	Damien Le Moal <damien.lemoal@wdc.com>
Subject: [PATCH 3/9] f2fs: Check zoned block feature for host-managed zoned block devices
Date: Fri, 28 Oct 2016 16:55:31 +0900	[thread overview]
Message-ID: <1477641337-12321-4-git-send-email-damien.lemoal@wdc.com> (raw)
In-Reply-To: <1477641337-12321-1-git-send-email-damien.lemoal@wdc.com>

The F2FS_FEATURE_BLKZONED feature indicates that the drive was formatted
 with zone alignment optimization. This is optional for host-aware
devices, but mandatory for host-managed zoned block devices.
So check that the feature is set in this latter case.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 fs/f2fs/super.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index a83df29..c6e9b94 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1642,6 +1642,26 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 	sb->s_fs_info = sbi;
 	sbi->raw_super = raw_super;
 
+	/*
+	 * The BLKZONED feature indicates that the drive was formatted with
+	 * zone alignment optimization. This is optional for host-aware
+	 * devices, but mandatory for host-managed zoned block devices.
+	 */
+#ifndef CONFIG_BLK_DEV_ZONED
+	if (f2fs_sb_mounted_blkzoned(sb)) {
+		f2fs_msg(sb, KERN_ERR,
+			 "Zoned block device support is not enabled\n");
+		goto free_sb_buf;
+	}
+#else
+	if (bdev_zoned_model(sb->s_bdev) == BLK_ZONED_HM &&
+	    !f2fs_sb_mounted_blkzoned(sb)) {
+		f2fs_msg(sb, KERN_ERR,
+			 "Zoned block device feature not enabled\n");
+		goto free_sb_buf;
+	}
+#endif
+
 	default_options(sbi);
 	/* parse mount options */
 	options = kstrdup((const char *)data, GFP_KERNEL);
-- 
2.7.4


  parent reply	other threads:[~2016-10-28  7:56 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-28  7:55 [PATCH 0/9] f2fs: Zoned block device support Damien Le Moal
2016-10-28  7:55 ` Damien Le Moal
2016-10-28  7:55 ` [PATCH 1/9] f2fs: Add missing break in switch-case Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  7:55 ` [PATCH 2/9] f2fs: Use generic zoned block device terminology Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  7:55 ` Damien Le Moal [this message]
2016-10-28  7:55   ` [PATCH 3/9] f2fs: Check zoned block feature for host-managed zoned block devices Damien Le Moal
2016-10-28  7:55 ` [PATCH 4/9] f2fs: Suppress discard warning message for " Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  7:55 ` [PATCH 5/9] f2fs: Always enable discard for zoned blocks devices Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  7:55 ` [PATCH 6/9] f2fs: Do not allow adaptive mode for host-managed zoned block devices Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  7:55 ` [PATCH 7/9] f2fs: Cache zoned block devices zone type Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  8:48   ` kbuild test robot
2016-10-28  8:48     ` kbuild test robot
2016-10-28  7:55 ` [PATCH 8/9] f2fs: Reset sequential zones on zoned block devices Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal
2016-10-28  8:19   ` kbuild test robot
2016-10-28  8:19     ` kbuild test robot
2016-10-28  9:02   ` kbuild test robot
2016-10-28  9:02     ` kbuild test robot
2016-10-28  9:38   ` kbuild test robot
2016-10-28  9:38     ` kbuild test robot
2016-10-28  7:55 ` [PATCH 9/9] f2fs: Trace reset zone events Damien Le Moal
2016-10-28  7:55   ` Damien Le Moal

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=1477641337-12321-4-git-send-email-damien.lemoal@wdc.com \
    --to=damien.lemoal@wdc.com \
    --cc=hare@suse.de \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=shaun@tancheff.com \
    --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 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.