From patchwork Mon Oct 24 17:54:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5p2O5oms6Z+s?= X-Patchwork-Id: 10002 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp616745wru; Mon, 24 Oct 2022 12:29:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6hYcJWdnXqkM2LoB3OYxq5U7iU/jE4NNcXDQH9BZBFQ9abhMNVNovsDdXgTzWF2rwW9o4F X-Received: by 2002:aa7:dd45:0:b0:458:7474:1fbe with SMTP id o5-20020aa7dd45000000b0045874741fbemr32495182edw.334.1666639795896; Mon, 24 Oct 2022 12:29:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1666639795; cv=pass; d=google.com; s=arc-20160816; b=m56sMSxoBwy7NL+NE4RwOCt55aRLVMj2njma8kLmvbN8t3RjWq0aAtLfug8EK4y2Vq mK8CsJgV6GJl00/U4f8flKzg11sN+stZPiDKOqRVcyCeCIcxfNWANHq+5Tj0VKL5A40r rdSBz/8HAmpn7cyFDd9TOJlJr2pXIvcxaYwYIl2qI3S4yVegE+3Pkvqf/EDf5uuUS2YH 64VDzd4JLcvK9jC31tgQU6ki8lofGgmL50JDk2tCATYU2nxSSpWZXUQuBguKbw4bigkb 9/PFivjDA4LBARy2oMUcp1Rxh188ODnFEm28OedRBTz4spAEivh9PgtMLoo0+JqeJhsM Ys6g== 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=DJuYJRTZDba9KMvD8fVPY2yJ15td7zaIKsDLJAQQWCY=; b=muX6xcUn4DosY7vQB/Oc7nWFrCthdckrEIoLoUjjAwglT9+EN8g5WXLMnE2Y9/JGLi VJ/ttOrHZqMbifAAC2wH9pHn0HTssYqdbLKbC1hAL1Mi+YoqsJSlqsbWSNN+FFsFVEiP 2mDYFvg5hox29MO3zRlvou71BeT5q0DI/L1J4l770MEqzUhMG+6tqgAycc0NYcnpIMa9 eEAX0sTRtaQAbKqnSv9NxTkcKEZt5Pw/PWBC2U59ifRD6Hce6FH719T96BDgwQF8t67m 8x+Ow5TeuMTyKuMqdBilXd4cqK/Cdv0B1qsbdZQFAokbGYOMcQpecqRfC7j77+UcZWLW NPWQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=pZKdfwm8; 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 m21-20020a056402431500b0045d27e4f95dsi653128edc.334.2022.10.24.12.29.26; Mon, 24 Oct 2022 12:29:55 -0700 (PDT) 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=pZKdfwm8; 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 S232477AbiJXTZl (ORCPT + 99 others); Mon, 24 Oct 2022 15:25:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231282AbiJXTXE (ORCPT ); Mon, 24 Oct 2022 15:23:04 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on20714.outbound.protection.outlook.com [IPv6:2a01:111:f400:feae::714]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90C9B114DC0 for ; Mon, 24 Oct 2022 10:57:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KWY2aZSOOgAMjyOd8TmzZJTFzVVgTY8CKlJY59oZ+oD0Kw3aLl8hOvirCR2//OTWYtbEpCJjSFiLrMDDfH50eopDK4GvecxcDtFHYhLMmrRglTcugZTlfzeu9EAkR4r4L9qpDGOGuetnJ1S1sNDL6ILBCjUFak0bd2U6L825GLY8VVWGjQdl8ONBq2ONlaBAyiXpQpqZq8EmmaTiQyQusQVH4s4ekOGqsFQPAReYpmnG+2hLW10wNWI5uxyhY7jBFMslIu9GIK7H3J2u4iiG2er6agzrqYCL9UCH/cL8F77UaYPRepN6xVBe84OHCjVZzmdILFhNq0oBcK8dhVklDg== 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=DJuYJRTZDba9KMvD8fVPY2yJ15td7zaIKsDLJAQQWCY=; b=m0tWhbmcirL3PjVsKAI7FWTC/nHFnuVWVVAmmqiCXtFrHvEEyLvfOYu0YXNZMSJCjmYxFORSzLBChQSDrkDJqHYqwUwfXQIvq75QOmnAM2FrJDD9gHMnFXC29heYyWUsbJxzzM15TrvGJC5ise9eMZyJ/KGq7DAXEAcxzOs3NTl6G6Pwti7sd2+ykehkycpx24SyUkJRzy3bL/j8DIQ7WQt3cqINa3KArRnrT08FMiTi+oZjB+hpzDv/ZxdWAHxfMrLhBvnF42PuOhUlsPwh6NE6gtMWfB1jEd0mSTRZKdYw0zpZVo8SQ8gebKpMt+MXT1txRbjQhyagtqXOMfnryg== 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=DJuYJRTZDba9KMvD8fVPY2yJ15td7zaIKsDLJAQQWCY=; b=pZKdfwm8O6fhiJ/ndH6KPHaz2UmE9hKsni4jPw1S0kK/nGLyzwg48H3R4eyXWp+mBX08yLYiMY39mW30vRHNs+cOlo5WEuT9yCefAdGrAIC8y3nApuC5RlCqCN8r88P8C16FAwdsxo+MHO0rS9BnpsXmtacGc0rMnPwKs6U4NIsSDHLYvpTaV3virON2LqGPBC/bnrHVFRePgCNXyFBfRV3focViqFv/kltTbdZfVtfV0PkojcuoyyFVbWkxfTax9eBIaSjWZY4AyPYRzZcCbh67l5VjvkiI/AauMJDoQKOVnyZbrC6mzFsy94ZanHvIfgVTaeScNxHWZhVlLVDjeA== 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 PSAPR06MB3992.apcprd06.prod.outlook.com (2603:1096:301:37::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5746.21; Mon, 24 Oct 2022 17:54:11 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::c84b:5a6c:d66f:c0fd]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::c84b:5a6c:d66f:c0fd%3]) with mapi id 15.20.5746.023; Mon, 24 Oct 2022 17:54:11 +0000 From: Yangtao Li To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Yangtao Li Subject: [PATCH] f2fs: add barrier mount option Date: Tue, 25 Oct 2022 01:54:01 +0800 Message-Id: <20221024175401.18888-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|PSAPR06MB3992:EE_ X-MS-Office365-Filtering-Correlation-Id: 46835af5-73a3-4258-808f-08dab5e8c16b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1yCeMsqyP91+OYEimQv3+K8Lx0GwduKj9dF6N++rY6jKKqg72pvFiboF2qzs0gc3cvFq2ZE51ZBbZWodWlTGSb+XbBv7AQv5iFQw4036JufLIjwB4feqV7Fp7jfi7MtS2z0AvmqqSpxuuSxIcQQnxzQucRUP6EzWdC7MnhFrnst9I8VlIBKu4P9bhe6FRUk86vlEtmzQTCqLOroDBpwImNSwqyqk6edrb0btVpRMy88O4VF1i5RrtBasdug0p//r3WLiMPPwnD8DqjZA1Pa1E1mMfnx6FT+9rRY8/ZT3SzQfYuXLdygrQWTHtVqBJ1hvuGQbyRsNjiTRUvJjPseAavFMPSbKiwvcf5fDaTvNVzvkgumrJwuyRmChwkUYAWFsRZYlgafASz04i2JM0QA2TPjpNb5QI/pqiGJ159UJDRBji6UMFg8Snnm5Usfr0nuziDwCD2WlUPgMXWLx5YPujYkmDyqcn/0U0F/LGcG0W2l7U1IttO7jY9kAj+g0Y9G0A9HSQxlD/51nHLaWIHQtwCILlA3SCZBA4dgnAOPqAlkmuTNFF49pktM90xTYh6DHlPVplV00xNT3y4grElgAxoGOD67eBjp6/7XVTPW+PuSb2wHmK+IixjEez93gnjL8R4WROMQZ3ZeHs8HEkvEIhXbllYZhwmhBrD+Lv+euQcpmrjBTJqDyG3yipErLWHuOh2AxUbjvpxYNT+8lBCl1NXsmtn4p7uuL62zx7oZsPVYk3gr9DUs+PhTYaXfiCJZR 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)(136003)(346002)(366004)(396003)(39860400002)(376002)(451199015)(186003)(2616005)(5660300002)(83380400001)(1076003)(6486002)(86362001)(38100700002)(41300700001)(38350700002)(2906002)(8936002)(26005)(6512007)(6506007)(52116002)(107886003)(6666004)(8676002)(66556008)(66946007)(478600001)(4326008)(316002)(36756003)(66476007);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EJwP7cBkz6ElmKrVkFLykwiVLlGEtm6Pqqf0hyilK8SAEjSQXCAkXOaTsZlk/50Wt+cSDZp4pyyGYhWFoHKHfekHvxwnVmHrzPY43l6cIzvmqWx9C5A6YfURRMdMsYNgvQGMhKXaGqCWC2Tuuqxy9qYBeyVkd2slTQEVvfbWWfkr0F/CpN0FKoP32Edm1nyBGjzwLcY0MT55NyqhRGWLTd2kbrVK/LzoWYp4JLPrtzsZp3w8Zj9tNh2uOGeXKU5VZWWyfS6geZwTNOerZYGIEwqTqLPWQLkds2wfnAhSoDYnJFgBxDZLauKlK2TGt8Ua7KokANz/ZwOoFepQwL4tfoYc7E/PFD63hQ98hySdR0uc9S+eW3A83Lcn5AIkkE+5WI76ttg3p5STS8f5qlyw5bLnDQyBr+Q3OZVE064H+QlEQjdmcNR+qFXu5dBhMbnSZaEdPt/S3l+2QsrlBnYqBmcxnGCe21Uksa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LrFxQy6pRWQkzpxeW+dYbYwNy7UMGE6jpkSBtVvY8XxsZT8f3NnKyqzB X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46835af5-73a3-4258-808f-08dab5e8c16b X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Oct 2022 17:54:11.0153 (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: NJVkfxC+joBDtFypTP1TuMt/CplZVyIqkF0gQu8uWIaKAMt+8xI5gLdc6X6paOHAtf6lYs9C3MtuYapsRSHoCA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PSAPR06MB3992 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747598490903012482?= X-GMAIL-MSGID: =?utf-8?q?1747598490903012482?= This patch adds a mount option, barrier, in f2fs. The barrier option is the opposite of nobarrier. If this option is set, cache_flush commands are allowed to be issued. Signed-off-by: Yangtao Li Reviewed-by: Chao Yu --- Documentation/filesystems/f2fs.rst | 2 ++ fs/f2fs/super.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/Documentation/filesystems/f2fs.rst b/Documentation/filesystems/f2fs.rst index 17df9a02ccff..5eccc4b3eef5 100644 --- a/Documentation/filesystems/f2fs.rst +++ b/Documentation/filesystems/f2fs.rst @@ -154,6 +154,8 @@ nobarrier This option can be used if underlying storage guarantees If this option is set, no cache_flush commands are issued but f2fs still guarantees the write ordering of all the data writes. +barrier If this option is set, cache_flush commands are allowed to be + issued. fastboot This option is used when a system wants to reduce mount time as much as possible, even though normal performance can be sacrificed. diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 3834ead04620..f0613ea266bd 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -110,6 +110,7 @@ enum { Opt_noinline_dentry, Opt_flush_merge, Opt_noflush_merge, + Opt_barrier, Opt_nobarrier, Opt_fastboot, Opt_extent_cache, @@ -186,6 +187,7 @@ static match_table_t f2fs_tokens = { {Opt_noinline_dentry, "noinline_dentry"}, {Opt_flush_merge, "flush_merge"}, {Opt_noflush_merge, "noflush_merge"}, + {Opt_barrier, "barrier"}, {Opt_nobarrier, "nobarrier"}, {Opt_fastboot, "fastboot"}, {Opt_extent_cache, "extent_cache"}, @@ -806,6 +808,9 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) case Opt_nobarrier: set_opt(sbi, NOBARRIER); break; + case Opt_barrier: + clear_opt(sbi, NOBARRIER); + break; case Opt_fastboot: set_opt(sbi, FASTBOOT); break; @@ -1939,6 +1944,8 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) seq_puts(seq, ",flush_merge"); if (test_opt(sbi, NOBARRIER)) seq_puts(seq, ",nobarrier"); + else + seq_puts(seq, ",barrier"); if (test_opt(sbi, FASTBOOT)) seq_puts(seq, ",fastboot"); if (test_opt(sbi, EXTENT_CACHE))