linux-f2fs-devel.lists.sourceforge.net archive mirror
 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 5/9] f2fs: Always enable discard for zoned blocks devices
Date: Fri, 28 Oct 2016 16:55:33 +0900	[thread overview]
Message-ID: <1477641337-12321-6-git-send-email-damien.lemoal@wdc.com> (raw)
In-Reply-To: <1477641337-12321-1-git-send-email-damien.lemoal@wdc.com>

Zone write pointer reset acts as discard for zoned block
devices. So if the zoned block device feature is enabled,
always declare that discard is enabled, even if the device
does not actually support the command.
For the same reason, prevent the use the "nodicard" mount
option.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
---
 fs/f2fs/f2fs.h  | 14 +++++++-------
 fs/f2fs/super.c |  5 +++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h
index 2fc771a..beb2093 100644
--- a/fs/f2fs/f2fs.h
+++ b/fs/f2fs/f2fs.h
@@ -1105,13 +1105,6 @@ static inline void clear_ckpt_flags(struct f2fs_sb_info *sbi, unsigned int f)
 	spin_unlock(&sbi->cp_lock);
 }
 
-static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi)
-{
-	struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev);
-
-	return blk_queue_discard(q);
-}
-
 static inline void f2fs_lock_op(struct f2fs_sb_info *sbi)
 {
 	down_read(&sbi->cp_rwsem);
@@ -2417,6 +2410,13 @@ static inline int f2fs_sb_mounted_blkzoned(struct super_block *sb)
 	return F2FS_HAS_FEATURE(sb, F2FS_FEATURE_BLKZONED);
 }
 
+static inline bool f2fs_discard_en(struct f2fs_sb_info *sbi)
+{
+	struct request_queue *q = bdev_get_queue(sbi->sb->s_bdev);
+
+	return blk_queue_discard(q) || f2fs_sb_mounted_blkzoned(sbi->sb);
+}
+
 static inline void set_opt_mode(struct f2fs_sb_info *sbi, unsigned int mt)
 {
 	clear_opt(sbi, ADAPTIVE);
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 2313234..2c8a12e 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -419,6 +419,11 @@ static int parse_options(struct super_block *sb, char *options)
 			}
 			break;
 		case Opt_nodiscard:
+			if (f2fs_sb_mounted_blkzoned(sb)) {
+				f2fs_msg(sb, KERN_WARNING,
+					"discard is required for zoned block devices");
+				return -EINVAL;
+			}
 			clear_opt(sbi, DISCARD);
 			break;
 		case Opt_noheap:
-- 
2.7.4


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

Thread overview: 14+ 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 ` [PATCH 1/9] f2fs: Add missing break in switch-case 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 ` [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 [this message]
2016-10-28  7:55 ` [PATCH 6/9] f2fs: Do not allow adaptive mode for host-managed " Damien Le Moal
2016-10-28  7:55 ` [PATCH 7/9] f2fs: Cache zoned block devices zone type Damien Le Moal
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  8:19   ` kbuild test robot
2016-10-28  9:02   ` 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

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-6-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 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).