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.lem...@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

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.


------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to