Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbbFHFVI (ORCPT ); Mon, 8 Jun 2015 01:21:08 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:60035 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750917AbbFHFU7 (ORCPT ); Mon, 8 Jun 2015 01:20:59 -0400 X-AuditID: cbfee61b-f79416d0000014c0-48-55752639c91d From: Chao Yu To: Jaegeuk Kim , Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] f2fs: setting discard option in parse_options() Date: Mon, 08 Jun 2015 13:20:10 +0800 Message-id: <004501d0a1aa$e4dfd150$ae9f73f0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdChqeM//EAo6lgaRb+1+ze9yAWalA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrMLMWRmVeSWpSXmKPExsVy+t9jAV1LtdJQg5YfGhbX9jUyWTxZP4vZ 4tIid4vLu+awObB4bFrVyeaxe8FnJo++LasYPT5vkgtgieKySUnNySxLLdK3S+DKOPTnH3PB L76K66sOMTcwfufuYuTkkBAwkfjT28ACYYtJXLi3nq2LkYtDSGARo8S3zk4WCOcVo8Ttv8/Z QarYBFQklnf8ZwKxRQS8JCbtPwHWzSzgIdHY8Z0VxBYWcJE4/fYUI4jNIqAqcfzsTWYQm1fA UmLG8k5WCFtQ4sfke1C9WhLrdx5ngrDlJTavecsMcZGCxI6zrxkhdulJ3Fr2hB2iRlxi45Fb LBMYBWYhGTULyahZSEbNQtKygJFlFaNoakFyQXFSeq6RXnFibnFpXrpecn7uJkZwUD+T3sG4 qsHiEKMAB6MSD++BRSWhQqyJZcWVuYcYJTiYlUR4A0VKQ4V4UxIrq1KL8uOLSnNSiw8xSnOw KInznsz3CRUSSE8sSc1OTS1ILYLJMnFwSjUwymxllJyzYNfDT3m7lgn6nFrYwTIn6vr1NWdK 8jLa106w3/s2u9bvp3jVFU+WtUEuAb/+uLV7v1bdt0vk4uTW5nP/X1bzruT3bF/IwfZPvfUD 37yIa97ffm45l3JcOqLZM2Yya9Yj67uPfvf1/JlU7zT5a+6vXn8l+euPmkP79v2p1DmWPu2G hxJLcUaioRZzUXEiAHzgtVFmAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2098 Lines: 66 For the first mount of f2fs image with realtime discard option, we will disable discard option if device is not supported, but for remount operation, our discard option can still be set, this should be avoided. This patch moves configuring of discard option to parse_options() to fix this issue. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index fbbf785..a06b0b4 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -258,6 +258,7 @@ static void init_once(void *foo) static int parse_options(struct super_block *sb, char *options) { struct f2fs_sb_info *sbi = F2FS_SB(sb); + struct request_queue *q; substring_t args[MAX_OPT_ARGS]; char *p, *name; int arg = 0; @@ -302,7 +303,14 @@ static int parse_options(struct super_block *sb, char *options) return -EINVAL; break; case Opt_discard: - set_opt(sbi, DISCARD); + q = bdev_get_queue(sb->s_bdev); + if (blk_queue_discard(q)) { + set_opt(sbi, DISCARD); + } else { + f2fs_msg(sb, KERN_WARNING, + "mounting with \"discard\" option, but " + "the device does not support discard"); + } break; case Opt_noheap: set_opt(sbi, NOHEAP); @@ -1237,16 +1245,6 @@ try_onemore: proc_create_data("segment_info", S_IRUGO, sbi->s_proc, &f2fs_seq_segment_info_fops, sb); - if (test_opt(sbi, DISCARD)) { - struct request_queue *q = bdev_get_queue(sb->s_bdev); - if (!blk_queue_discard(q)) { - f2fs_msg(sb, KERN_WARNING, - "mounting with \"discard\" option, but " - "the device does not support discard"); - clear_opt(sbi, DISCARD); - } - } - sbi->s_kobj.kset = f2fs_kset; init_completion(&sbi->s_kobj_unregister); err = kobject_init_and_add(&sbi->s_kobj, &f2fs_ktype, NULL, -- 2.4.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/