From patchwork Thu Nov 10 09:15: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: 18023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp39389wru; Thu, 10 Nov 2022 01:25:14 -0800 (PST) X-Google-Smtp-Source: AMsMyM5xD9qD0ZcMLr+0CwGyqbuzr12puJbwKyksrExXBMmK5Cq8wUU2YbRKuw3eO+RKAthNAUG1 X-Received: by 2002:a63:450b:0:b0:46f:6321:1e2c with SMTP id s11-20020a63450b000000b0046f63211e2cmr55437590pga.390.1668072313955; Thu, 10 Nov 2022 01:25:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668072313; cv=pass; d=google.com; s=arc-20160816; b=qCm87zOEVvcU+KKiQ3xtHsrDCRNjVsdksvIgAJb5YHG0UvhC6ASWlYbHbNUaMwIltG 7w5W4OpfhG4PyiCHC0OJGEFvj4Php63Ok1u2d5jTBzoDAeIAujOCMFs3cKHSS1rtsu03 tONOkF1ca/DsK0Q9YyRlsrWbF1l2mbfkKtz95YkegRnHK8V1clhNGLaYwiGzv5V7x3FR 2NzBrUSFLOTwbZNvCB/tuwP25i0sxyc9NJmj/5o3EnskLX4NUDPXEYfTZ1cdfv9+LVR/ nvOYjsxpz9Z4j7cf3lesG1DwxOLglS71kOINJAi8DTT6Oqeb+BpwoU3BAHXZ+ECJI8dh /k0g== 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=1lolKSnELQLD9UIlg/BjT2W03GMK6mDHzGBgpd0jJKQ=; b=lBoT0vBuWEQX6LRLOnHvJUONKVEqsvP+Cu6EJMKcHsXOgYlY9FzYQ+AnHG1cWrvK3P n+Qgn2Q6xK13pBV4J7uea1vF0kmSXZw/6/bgTYhmdUfiSeDN5jtehSUHTgbHBVxrBO4a jq05zWrGV2Sls89DB8B0OdFxan9AuLjREv1AmRkXSvAqfBK1MXM4HND78FGmk+T8+n1g EbnzN7WgtVMvogTu2CaA9xBmHGg6COw2yTPgB4+uBawKL5VL2DUw/XqnTfeovnAnAgS/ nk6cHXeUNtAAeVBzxQYva6HoV9tFV1TK3lsBxOgCRf608Nh7Lc345JhxAI8FbHdBVN4d BQ/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@vivo.com header.s=selector2 header.b=iGxo3HNV; 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 k25-20020a634b59000000b0045cc8781244si8721755pgl.220.2022.11.10.01.24.58; Thu, 10 Nov 2022 01:25:13 -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=iGxo3HNV; 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 S229784AbiKJJPV (ORCPT + 99 others); Thu, 10 Nov 2022 04:15:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229791AbiKJJPP (ORCPT ); Thu, 10 Nov 2022 04:15:15 -0500 Received: from APC01-TYZ-obe.outbound.protection.outlook.com (mail-tyzapc01on2095.outbound.protection.outlook.com [40.107.117.95]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 448346A6AF for ; Thu, 10 Nov 2022 01:15:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MWYB4NZSXahJI5Y5cPXErj/cq3k7wMBR/V4H5a5O+kuUzdQ0+eho9A07rT9GPj9vYopHeZJ53ONnBIfOVm9j5cpc59X0Erk1DuJCfMy+Vqc0s7J13EjtVHT+n+Q21oHRI4CJogH5Xl+dotyWBbc/NSvAUWN0Vr1IxV3DUSsmxzpPGQL06XTSywdAwGhyr9WxNSFGD22olSd6/H58rte0jBJjzSecvPn02sqSciAhoPxYmG9kBu/6wgy91hwH9xGLB6MRaA/pZG00Pl6sJDkeOWc9peg/JWDmsGgI5AXchmJpc59tfAnbE0vkAnWp8JgCgWdU68h7NW/4iQZbpPxsVA== 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=1lolKSnELQLD9UIlg/BjT2W03GMK6mDHzGBgpd0jJKQ=; b=Cdu3WVOeAy4TCzdCnoRuksceF2XKTvFgEjZ1dMZv3CPZ2LoLKNad2Ypi+JrtIDxlaYKZ5S3OKggkklpMwuzHJUvXMf0z+Ts0ZGzFY9Tf/VNfCW+hR9XhXuJ/gcwHHGDRqbX9i7XImyXjeZwuEc3CeFS2oCWtnpjYLNunnHrkYPsh9VpOgkj8Up9NqaFCBJt6hy5wSB/zaT+voyMbLKcIePp4Mzg0bY83jyg4P7queXdfwBDI6p8ZeoVlzB8jucV1iux6wn3p3OkcfJ3muF7kmKVapKuJgVx+1z7lqUB+jPTZEFb3fgFoyBrYQ1O4eBcSM2gnRcMwI8qAgBRlXausgQ== 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=1lolKSnELQLD9UIlg/BjT2W03GMK6mDHzGBgpd0jJKQ=; b=iGxo3HNVgzBCK5hldEW0XyqyBf00wxDtONnvxVA/Xd84JkZcOgQB98Ay6b6xRyOTe/3AX6YanNGuomfmAVbjyu7nn/cEYCcy0QUKjkOHnYL6fpLjetppUffOSkBJLVBn9j1Wz3IxoOEwoqrmWqxEtmtGTCy+M7vQidV1aCOpSSv6zyC5vVzj8o3n35vNp9faFE8Q2Efbn5d+MW7JE6hICAOkqnPpfYcKwvYFgaqqomQOZL+GZivWWu/uF9UOdCFrrGe2Lr7LwCBZUa7YZEN/Yx8frk+bjPxZen4W7zUlriOcq4AojtR/nVTu3jr5XwgQZ/ZCVwwnerfNHZLWHv/NPQ== 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 KL1PR0601MB4483.apcprd06.prod.outlook.com (2603:1096:820:7a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.27; Thu, 10 Nov 2022 09:15:11 +0000 Received: from SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::1230:5f04:fe98:d139]) by SEZPR06MB5269.apcprd06.prod.outlook.com ([fe80::1230:5f04:fe98:d139%8]) with mapi id 15.20.5791.027; Thu, 10 Nov 2022 09:15:10 +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 v2] f2fs: fix to set flush_merge opt and show noflush_merge Date: Thu, 10 Nov 2022 17:15:01 +0800 Message-Id: <20221110091501.546-1-frank.li@vivo.com> X-Mailer: git-send-email 2.35.1 X-ClientProxiedBy: SI2PR02CA0001.apcprd02.prod.outlook.com (2603:1096:4:194::10) To SEZPR06MB5269.apcprd06.prod.outlook.com (2603:1096:101:78::6) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEZPR06MB5269:EE_|KL1PR0601MB4483:EE_ X-MS-Office365-Filtering-Correlation-Id: e644081d-45c1-4436-1b8e-08dac2fc115f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r9piJ6bUIlh2oUB0U6fdTRsAzLuVj4kY56difsGSkVemf8d+b2agSfdJL7I3pwmO6azEfRxChgkAr/6lDkrDA9t6YPM/VbGpoIoB2NoOgEkvMRrVMYE8bkel2nw1JnDURGa/f2gWW3PYU7I/bMSI0mKL6AUROFQ61R9O+r471QuSna9hY9QOp2rfYoy6yN5SlCB82I7Kqikpam6soYJORjFo5nGyFv6z10iXuytQbSMBfHTUA9OKGk/cieL9PPU3i+WqvIJGP+cPBDFEkspOkI4rtcoEM4xYW1WrkHRVZ2M63kH/6okr3rbpnO7GIvkbzdZ/vbUUsrqM+rcadhfghugdXxMCOARJCw6wXkHoRkRWBq0Ni4yyND3OcgKcs4YSokcSE4wIAUwuk2QFnsPsZTwUnheG37FqTOXAEwa37dOzInwJDHLOYP+shrzDXkHhBkiMCRhA5saAxREPU4+IIIJwu4czqp7HwfNSrfLEgjyrWIJl55I6c8V8ccp6TOlkjrNumhHmeDDl283vBBnVF+vbd/qBHWkGMy9ksOlke6uu2Ts+V8hXKlsdWN9600riD64CUzfopcXn/OvUNo+2xBQA0WQPyEtA26kr9hxYWBYG3pv37LNKzLP1QYmK4sQGuKQftJpGNic+/7SVG6hDT2i2xBRaxBY4PkhZaookLbgi+WkbIw8lXLwU3B8OB4u1GTJ5YJbqpTjZT2YHwazZ8asCegHptw1kHaZ22CSCpe4ZZ3THD6VDpELkeZVE4A89 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)(39860400002)(136003)(366004)(376002)(396003)(346002)(451199015)(83380400001)(86362001)(66476007)(2906002)(5660300002)(52116002)(4326008)(41300700001)(38350700002)(8936002)(66556008)(66946007)(8676002)(6666004)(6506007)(107886003)(2616005)(316002)(6512007)(1076003)(186003)(26005)(6486002)(478600001)(36756003)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 2hDooA6fcGWeCZ7pKccdBi+pRonIXPfoD1zNgaJILL1gQ5odw0IFFgQIXVg2SPUpHECN/62neauMk7gHbuSkxRm1biQc22yc6Z+7o3kp8z6aLNxcBK9pUFVk+/XSz3hAR4tRjxBUmFXAuG/LUuqTozM8zw+5qhxF5bfXDKYOqV5XcZCIFCzfqEN+ZkynHnK+8bJHpMG8OUXTNO/9Pi2h8I59c2QiJK+bLYugw1UhrKqjCYSKuKSz/ev57GfQZtb880mAiiXu7COiN8CVy3tnZISBggd7EW8UXCs1HJrCrnPalhR88xeJOdYoaXbPTwi8SkU3eYoQ9Su40/12VJLBPT9tb1zgFklDCTgBZFHrQkxK+u8nOaY31064FsvGwvCtlfDnk58NWme8jd1w/LHHqgimFRdlVipOW3ifM4sf2Dw2kiFLKKHIWMHK1wcX6ufjatvlKuPeYIQdT+yaBqtfQjLzF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jQedJYKeIFI4fhDjQWx1hASR5UGeB2veq5/+PJeXtEfswp2bxbLP X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: e644081d-45c1-4436-1b8e-08dac2fc115f X-MS-Exchange-CrossTenant-AuthSource: SEZPR06MB5269.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2022 09:15:10.7213 (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: 3SG0nAmnmJE4QVhfWYTTtUNiRQ4CXxpjRhsrXcRMCdoZLBXbxgXDYKmIIsU8ubm5d/Dlke+xKSLI8qG8dHGaUw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR0601MB4483 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749100594581210259?= X-GMAIL-MSGID: =?utf-8?q?1749100594581210259?= Some minor modifications to flush_merge and related parameters: 1.The FLUSH_MERGE opt is set by default only in non-ro mode. 2.When ro and merge are set at the same time, an error is reported. 3.Display noflush_merge mount opt. Suggested-by: Chao Yu Signed-off-by: Yangtao Li --- fs/f2fs/super.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index a43d8a46a6e5..89d6024748ad 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -1353,6 +1353,12 @@ static int parse_options(struct super_block *sb, char *options, bool is_remount) return -EINVAL; } + if ((f2fs_sb_has_readonly(sbi) || f2fs_readonly(sbi->sb)) && + test_opt(sbi, FLUSH_MERGE)) { + f2fs_err(sbi, "FLUSH_MERGE not compatible with readonly mode"); + return -EINVAL; + } + if (f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb)) { f2fs_err(sbi, "Allow to mount readonly mode only"); return -EROFS; @@ -1941,8 +1947,10 @@ static int f2fs_show_options(struct seq_file *seq, struct dentry *root) seq_puts(seq, ",inline_dentry"); else seq_puts(seq, ",noinline_dentry"); - if (!f2fs_readonly(sbi->sb) && test_opt(sbi, FLUSH_MERGE)) + if (test_opt(sbi, FLUSH_MERGE)) seq_puts(seq, ",flush_merge"); + else + seq_puts(seq, ",noflush_merge"); if (test_opt(sbi, NOBARRIER)) seq_puts(seq, ",nobarrier"); else @@ -2073,7 +2081,8 @@ static void default_options(struct f2fs_sb_info *sbi) set_opt(sbi, MERGE_CHECKPOINT); F2FS_OPTION(sbi).unusable_cap = 0; sbi->sb->s_flags |= SB_LAZYTIME; - set_opt(sbi, FLUSH_MERGE); + if (!f2fs_sb_has_readonly(sbi) && !f2fs_readonly(sbi->sb)) + set_opt(sbi, FLUSH_MERGE); if (f2fs_hw_support_discard(sbi) || f2fs_hw_should_discard(sbi)) set_opt(sbi, DISCARD); if (f2fs_sb_has_blkzoned(sbi)) {