Message ID | 20221129134018.34120-1-frank.li@vivo.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp343478wrr; Tue, 29 Nov 2022 05:44:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf6YoG/Qew3pSvsD04F183fuf0Zxz9NEcruwzIE+D8s7iR8nbC0YGz2WBB8z/P7VEmjBcapu X-Received: by 2002:a17:906:c40d:b0:7af:1534:73c9 with SMTP id u13-20020a170906c40d00b007af153473c9mr31890019ejz.558.1669729448879; Tue, 29 Nov 2022 05:44:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669729448; cv=pass; d=google.com; s=arc-20160816; b=Jw7LJr7uhBmghKdOUpc9QqFzFQk8Finl6nuLHzBxmaeMasCcSnjA1x68f08ZcfMRmW R54cNWYfmSkYBXbAGrwaX37MiNtEroVDFoRhfZgTfo/soGJhBFIfpEuq7MOe0Cq+PGqn mxVUmO7S06OoFK6LeLwaLLRaqIKUHLpX/Eq9DMhylF+bu9I72EOA5QztmguwyvFMZv67 wqi0csiOPRgkGOoJGHDzBYHTf5hqxytiKYmeP10FvwD9B2evW9ENRxtEX0u/2knCVZWh jrgO+P4KrRIXqRqMWSWI1eM/2hC2KXE1LMv1DDpU3c5h0XFNFDiLTeYK7kO26+5Gmw+v HOkQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=lN8sywuQV9rrPuV6+BPQUTe9Pz1aShp5pShrkBzzCGg=; b=gH6LaWD6CKgmszfzZGvzeXHbdFNTuGA0yQgJFJcmAHF1kMsUzf4Lr0asMd/mOyYBfS ZMRjeKKdzCDpqlAVuGg/FmvHauKKPIpbJNtoGhSc2ZZwIsZ3/cQpF0l+gov9ZIap3dw9 avcr5Ex9AoeCMY6VGkvWPmj/OvFMrHz12vXXozehmekZlKzGG5V0tau1GvmkBFV3Dhdx a9N83RCSXN14Sx06o+mjYZRtjcZ73UT+A3U8hP/9skCQis1u0Ncol/2BBOEnu/oGlFXN 0TKPJ8CzN4K5TCKvXc7Gr3C9Gol8N0J7wxSBt/GNifbSnO7Fjao0Wl6wtbLgdMCcFMns JwDw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=nL6tjQo4; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w17-20020a056402269100b004663240e1f7si13865558edd.620.2022.11.29.05.43.43; Tue, 29 Nov 2022 05:44:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=nL6tjQo4; arc=pass (i=1 spf=pass spfdomain=vivo.com dkim=pass dkdomain=vivo.com dmarc=pass fromdomain=vivo.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=vivo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232992AbiK2Nkc (ORCPT <rfc822;rbbytesnap@gmail.com> + 99 others); Tue, 29 Nov 2022 08:40:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbiK2Nka (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 29 Nov 2022 08:40:30 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2105.outbound.protection.outlook.com [40.107.117.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B6C5ADCF for <linux-kernel@vger.kernel.org>; Tue, 29 Nov 2022 05:40:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SlDTP/bkqmVCO9iI6RdHrfehmsykfpkjVJ1Kv4Q8ILpMNy6juzOLbKHgGkxqsF1VCW7GguaI9i4LvYrgdMp/EhffWfFVmOM+kixoaMe2JWzpkjZF+r6Ex8Cz0Om0NzCT4yCQy/7ApHOGdLbbPlGZmkdIhi104urKsb9nu/FqLJUnKaT8qfgVfGDsAEyUeSvI4J3KZBFYS0x236Xd0s456/3Fp+B0qlLwbDl9Q5VUMv0DgKNulqJVK3Fg61hZWeam03G/g7r/i2tq1eydGO4hhDki6nlPJh44xIVCpNNVRLdlaimUsAUOTi5pxwpWgi6GcO6Enu4O8W/yu4T5r1khEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lN8sywuQV9rrPuV6+BPQUTe9Pz1aShp5pShrkBzzCGg=; b=Y5/H3BtDjuwPyrjkB1KoT91T+TJQZNzce45VTrQfa50Zp45pOR6Y0C6BBWB3jrrcWnW0B7+s8HRLl2oCFqO/cbNZfvNO7y+w+S8R76Mk5Z8jO8cBOGzrNO9Tx37pRZV2GboMU5bvRGNkyHStTwNe3VOy8Ojnjho0hY1P1EfOMhm071qSZ3CmV115wxJT6MWw3KpqcnFvtdHRt+yTjdvaHIDXPY8ZfVranMquKjjI1v1s8Wxfsa8uOx6/cLHwzuebdBorSsCh/zQqgny52lRY397XI7+e4Z38lQMNFsTp/VbjcnQCNJyZNwjKLWqN3B3PcWEkV37zhvhihxLrabmyOA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lN8sywuQV9rrPuV6+BPQUTe9Pz1aShp5pShrkBzzCGg=; b=nL6tjQo4UijjV536MV+WJZVw2aKRgQ/YYJlkbQbNV6/VJ2QHnECelYpS5ru88+eDrvg7IC9JdPF3oT2frbOuMrTLO14mjiQ30clVoGar+vs22dr1mZG+kkeAL9pIHxlBft44hYDuyfy0HsKG1bdi06qy394JFLcIfkvyzWiZyAbYFfAxs4pKRGUdRSUylVwLHlzyVD5vFcDscCH1totM3+RUEaejMCQdzzYRp1YxHy7px3RBasKX5oTEDyqV4CYiyqeC5r2Ej/jT2pkh5n3DFX/Sa5D5mSldShOP/yeIEYr8EjmfrPG1LQeutz0DUNZ4x5KBpXShzctqEY+U2qQQSQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) by TY0PR06MB4984.apcprd06.prod.outlook.com (2603:1096:400:1ac::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5857.23; Tue, 29 Nov 2022 13:40:27 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::ef03:cbfb:f8ef:d88b%9]) with mapi id 15.20.5857.023; Tue, 29 Nov 2022 13:40:27 +0000 From: Yangtao Li <frank.li@vivo.com> To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li <frank.li@vivo.com> Subject: [PATCH] f2fs: issue discard when discard_cmd_cnt is not 0 in f2fs_put_super() Date: Tue, 29 Nov 2022 21:40:18 +0800 Message-Id: <20221129134018.34120-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR01CA0171.apcprd01.prod.exchangelabs.com (2603:1096:4:28::27) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|TY0PR06MB4984:EE_ X-MS-Office365-Filtering-Correlation-Id: b7d7987d-c662-4e02-ac43-08dad20f4627 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KSuJfLH0rwD8LbEPHrZQGumKEAB6gfqMW3SJ9ysLcZ1Dueo6cjbJ9NaycOPQv9Jl0TIIshdFG3Llz6WoiFNkgZ85yg32PXw22cLESvAiXhP7UteZPfVB8HzENejJ8rRhsYQU28+K5VmcjpfhrKIMuMOiMvVv6reDIh1arHTwzIslQG/L7IsBXLa+266OOO8y+CqzhHLZ3MeErp1MLo7Uf5DFEbjFFz64fzhj+Mgkx0fLCIrKwmB9yeAFtIr2AdYnLhNXSZq/5llaPElJuCIUatWgBFYOeI7iJBpgVHzrB6wNpMEKCoq+7NiYPhezuLGhUS3ZWoFq/1wHjWAXLJk0zfyZ8tHPz3mBIhO9KlW+JwOPD7UtFOMhMUylcZq7vQx7nwP25ECXLKYJ+JrRlMAFVDI36fXwAWnX+FTbdhOfGa8jaQLLu1vm9Qta85ph1IJwdVx459Epefn/aw7NtSRbl9BYoR9ORdpV2dDzIh6xaEa07FMrmupGN9l2QFYmZ17dSJjlpsHLHU5pW9+kiiUJMGBxCzCEAZr2dcM9UB9x4+wFtUcYlh131aZFShkvkpk0keSwK7RnOO86NhE+NIVJ+omeHlsoQZg4LtUkLcuRcD581X0axk219sdplDoVh1I8xwV8UBv5loeNvziwp2S+Gs7j0+o+BR3YYcRfAIWohLdYx/xw/De/89somYSx7flV X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEZPR06MB5269.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(366004)(346002)(39860400002)(136003)(451199015)(2616005)(2906002)(83380400001)(107886003)(26005)(38100700002)(38350700002)(6486002)(66476007)(8676002)(66946007)(41300700001)(66556008)(36756003)(52116002)(6666004)(478600001)(6506007)(6512007)(186003)(5660300002)(8936002)(1076003)(4326008)(86362001)(316002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HTC+w/Vy2qRyWtzbg9A5QDc7vRzLTDK/cnQtuC6RKEgUSzDlw/LJ8dHMO+VWJPk6Bz+g7YGHbGMTLYfGlyY5gDN4QBwif59iYth4WHP2Xn73Ni0gLe2dy9n8a0/gLWJNF+qoqriHj6X727P0PEdtT/ydjAdlwNOuuj4yyFa/JGWjlr153KgFWR5rSs6IwWzMikB5P2JzKUZelgQDFRxxLJMup6HC6+SrXO0qy+xzfuJqYib8k+xMmMYvqfo76HWowBZTt0X+Y7tAxWZHqza/2j5LWNNZNVqw3ra70Mg+QtwwEgUTw+3n7aF01D9ep3FJdzHbA0t5sKtkFzD1hONf0931TBwtMBwQ7kxCoLDCyISfBBgBgCP9Smakuv4/qY+Y6fFiN52798VCwes2B0RotfLAkeObQiWh5wLbYIK2F6+QjCZs0AeNmQquhUTrqI9bH49laWVaROyNvdi9op5t4bSdmjcaShsvKrdpcD22SGZlSQv6kP2rg8sLgRfMsGsARlsvU5HF0RLnwHRUuoy1dgGgB8MJLquNzYSxw9c3UEMhOOqjYv/+gKYC7nJhK1Kv3Md4/CCmtEjgDQDcJBHnk/+HGurGz0IvozLtQCetN+fjiM2VRtMDb2futaRcNQwqn9Q00fEdDV8ZNlqz0d9lflQUyWxlcnE3tfPMb7IoOlejxD94uQBBM2Ht8WrTlipNpuXGUEqdTrKialxPWBRwOmXwfHBhRjiRxIgLQfe7JUkZd1QHDv5U7Ni21yxmTp/JUJrPqeSSIxqvZNbp9hr+RzPfAbNipv5NzXyRTley8KM4WyJQhWabfwiakjxUTEmpV2+S6H1DCxKNwcdkSI8ilXM1/PYA53YyIAbcdR1CcKO7/u25PpYk50BW7mmp3DGJQclfZKNuB8cKRJUYQ76V0JaP+nqnZ+mPVrWHazHR1c1opQdLSgw8QHCGuYQzk7YE3S8f5/FYfpHdSKCj1Tgz5J9N6oqaEXHiOwOYkd04HXrxcQCc+X5lBF9aQrzvEleCWUfKcqXXe9uQ6vl+d6yJEfMf3I1xajAfGw5fXWeVxqRs3v3GzoUSWpnaKbaRI73jAfPtkegmjxS3V9ph3B7auzEJejBka6wTu5dFSG6eNRqRPX5ZAnX1giEzLf3jMTWqz89eLOJIpgEcuYp5fjbeg8lDvNZNmUSWHHIXTwgkjimVYOFGvNz3QKntDIhD0j0Ci5p8kFg0fHVgvITUFMSbReC71sRyCYV9MwhFrWOx7mh6zgEMWI7F7aVnYi1oJLRJiAuI2RAWMMo7oK+x2PCoddn/Evi0mGYJI0WBtVmX5+e37m+GQcoIhNyPsVkJYGX1btEmNXNg/YVMEEXmJEjNc1UHixkdvzsnNBuk6Ag/0OX7SWMMRoSGmXNHfCpIUnV+T5Njv2KB7eGokIcTAPklNpf2oqbwiFjRmpjimjzUSw9kDD52HxlyfZnJ0fL0zyLMBgCwEoftxmWtYvjp3nDqSPwJ7Avi2PD6jvhB5MVz3XE5H771M/vTF0Hj7/sbNpi76qibHnLVW3IbONsZ2fcnhSchZpkrqN1wD7JIp/LyRL4KmkRb9zq4vglXif+JHZaj X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: b7d7987d-c662-4e02-ac43-08dad20f4627 X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Nov 2022 13:40:27.0943 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eplMELSvHTGx3SlLRFv2DNEuBUDpSZn5WxwDcHG9x9JfOHSUar2ncIEK8eBMVDrdTVy6ZVNc8XDxORh8zDkV3w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY0PR06MB4984 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750838226191374490?= X-GMAIL-MSGID: =?utf-8?q?1750838226191374490?= |
Series |
f2fs: issue discard when discard_cmd_cnt is not 0 in f2fs_put_super()
|
|
Commit Message
李扬韬
Nov. 29, 2022, 1:40 p.m. UTC
No need to call f2fs_issue_discard_timeout() in f2fs_put_super,
when no discard command requires issue. Since the caller of
f2fs_issue_discard_timeout() usually judges the number of discard
commands before using it. Let's move this logic to
f2fs_issue_discard_timeout().
By the way, use f2fs_realtime_discard_enable to simplify the code.
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
fs/f2fs/segment.c | 6 ++++--
fs/f2fs/super.c | 6 ++----
2 files changed, 6 insertions(+), 6 deletions(-)
Comments
Hi Yangtao,
I love your patch! Perhaps something to improve:
[auto build test WARNING on jaegeuk-f2fs/dev-test]
[also build test WARNING on jaegeuk-f2fs/dev linus/master v6.1-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Yangtao-Li/f2fs-issue-discard-when-discard_cmd_cnt-is-not-0-in-f2fs_put_super/20221130-110654
base: https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git dev-test
patch link: https://lore.kernel.org/r/20221129134018.34120-1-frank.li%40vivo.com
patch subject: [PATCH] f2fs: issue discard when discard_cmd_cnt is not 0 in f2fs_put_super()
config: x86_64-randconfig-a011
compiler: gcc-11 (Debian 11.3.0-8) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ecfaeeb102cb22ad0b39670f674763735763db2f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Yangtao-Li/f2fs-issue-discard-when-discard_cmd_cnt-is-not-0-in-f2fs_put_super/20221130-110654
git checkout ecfaeeb102cb22ad0b39670f674763735763db2f
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/f2fs/super.c: In function 'f2fs_remount':
>> fs/f2fs/super.c:2227:37: warning: variable 'dcc' set but not used [-Wunused-but-set-variable]
2227 | struct discard_cmd_control *dcc;
| ^~~
vim +/dcc +2227 fs/f2fs/super.c
4354994f097d06 Daniel Rosenberg 2018-08-20 2209
696c018c7718f5 Namjae Jeon 2013-06-16 2210 static int f2fs_remount(struct super_block *sb, int *flags, char *data)
696c018c7718f5 Namjae Jeon 2013-06-16 2211 {
696c018c7718f5 Namjae Jeon 2013-06-16 2212 struct f2fs_sb_info *sbi = F2FS_SB(sb);
696c018c7718f5 Namjae Jeon 2013-06-16 2213 struct f2fs_mount_info org_mount_opt;
0abd675e97e60d Chao Yu 2017-07-09 2214 unsigned long old_sb_flags;
63189b785960c3 Chao Yu 2018-03-08 2215 int err;
3fd9735908287c Chao Yu 2021-03-17 2216 bool need_restart_gc = false, need_stop_gc = false;
3fd9735908287c Chao Yu 2021-03-17 2217 bool need_restart_ckpt = false, need_stop_ckpt = false;
3fd9735908287c Chao Yu 2021-03-17 2218 bool need_restart_flush = false, need_stop_flush = false;
4d67490498acb4 Fengnan Chang 2021-08-19 2219 bool need_restart_discard = false, need_stop_discard = false;
9cd81ce3c2f01f Chao Yu 2015-09-18 2220 bool no_extent_cache = !test_opt(sbi, EXTENT_CACHE);
277afbde6ca2b3 Chao Yu 2021-07-29 2221 bool enable_checkpoint = !test_opt(sbi, DISABLE_CHECKPOINT);
1f78adfab379e5 Chao Yu 2019-07-12 2222 bool no_io_align = !F2FS_IO_ALIGNED(sbi);
093749e296e29a Chao Yu 2020-08-04 2223 bool no_atgc = !test_opt(sbi, ATGC);
4d67490498acb4 Fengnan Chang 2021-08-19 2224 bool no_discard = !test_opt(sbi, DISCARD);
6ce19aff0b8cd3 Chao Yu 2021-05-20 2225 bool no_compress_cache = !test_opt(sbi, COMPRESS_CACHE);
4f993264fe2965 Chao Yu 2021-08-03 2226 bool block_unit_discard = f2fs_block_unit_discard(sbi);
4d67490498acb4 Fengnan Chang 2021-08-19 @2227 struct discard_cmd_control *dcc;
4b2414d04e9912 Chao Yu 2017-08-08 2228 #ifdef CONFIG_QUOTA
4b2414d04e9912 Chao Yu 2017-08-08 2229 int i, j;
4b2414d04e9912 Chao Yu 2017-08-08 2230 #endif
696c018c7718f5 Namjae Jeon 2013-06-16 2231
696c018c7718f5 Namjae Jeon 2013-06-16 2232 /*
696c018c7718f5 Namjae Jeon 2013-06-16 2233 * Save the old mount options in case we
696c018c7718f5 Namjae Jeon 2013-06-16 2234 * need to restore them.
696c018c7718f5 Namjae Jeon 2013-06-16 2235 */
696c018c7718f5 Namjae Jeon 2013-06-16 2236 org_mount_opt = sbi->mount_opt;
0abd675e97e60d Chao Yu 2017-07-09 2237 old_sb_flags = sb->s_flags;
696c018c7718f5 Namjae Jeon 2013-06-16 2238
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index 9486ca49ecb1..d5f150a08285 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -1655,6 +1655,9 @@ bool f2fs_issue_discard_timeout(struct f2fs_sb_info *sbi) struct discard_policy dpolicy; bool dropped; + if (!atomic_read(&dcc->discard_cmd_cnt)) + return false; + __init_discard_policy(sbi, &dpolicy, DPOLICY_UMOUNT, dcc->discard_granularity); __issue_discard_cmd(sbi, &dpolicy); @@ -2110,8 +2113,7 @@ static void destroy_discard_cmd_control(struct f2fs_sb_info *sbi) * Recovery can cache discard commands, so in error path of * fill_super(), it needs to give a chance to handle them. */ - if (unlikely(atomic_read(&dcc->discard_cmd_cnt))) - f2fs_issue_discard_timeout(sbi); + f2fs_issue_discard_timeout(sbi); kfree(dcc); SM_I(sbi)->dcc_info = NULL; diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 79bf1faf4161..71e6b2bea1f4 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1576,8 +1576,7 @@ static void f2fs_put_super(struct super_block *sb) /* be sure to wait for any on-going discard commands */ dropped = f2fs_issue_discard_timeout(sbi); - if ((f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi)) && - !sbi->discard_blks && !dropped) { + if (f2fs_realtime_discard_enable(sbi) && !sbi->discard_blks && !dropped) { struct cp_control cpc = { .reason = CP_UMOUNT | CP_TRIMMED, }; @@ -2408,8 +2407,7 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) } else { dcc = SM_I(sbi)->dcc_info; f2fs_stop_discard_thread(sbi); - if (atomic_read(&dcc->discard_cmd_cnt)) - f2fs_issue_discard_timeout(sbi); + f2fs_issue_discard_timeout(sbi); need_restart_discard = true; } }