Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp193317pxf; Wed, 17 Mar 2021 02:58:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwFe/DLt/UKSJRlm/d2bF0waNRrBejQ+X1AfL6zxH5eD7chcXIvIyCjAMZEhibL3CGOvD7U X-Received: by 2002:a05:6402:520b:: with SMTP id s11mr41610033edd.212.1615975093387; Wed, 17 Mar 2021 02:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615975093; cv=none; d=google.com; s=arc-20160816; b=UQbUyX4KoCjeK8HVFZu95C9grNLMktHmx3O6b/91iBWAAqYSJav7DJAEswhOfsak11 cO9d8kpzvN/Iw9Y8QDEAXFqqb00mEPGXLB3h9oTgyHvy10RjmxLK67n5FTpjxSQXNDbp c+ep4uQymvC7qDxd0rvnp/Fe1BDvtQvNjxHwyu9ShErVhw3MNH7RNfwGmuPbTWB+IIKq eyyQ6qks9Dwa3mqhTZJ7T7lw0lbmnBXMJoPncGPKDJgk7VdoMtluMVrJf8Hrm7RA0Iph nQEc5e+BiOkaahviKVJyZ/JgaeHwPXcojwaozVbkhevFNwZotGsiM8aJfyjYA9Wu5hZm NnGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=D1gSK5XQZheuw6cJxSoQFUe6jvZIU8eUYgZr3yXcwtA=; b=aHG8+Jx9L+qeb3gptBurApqU1w9K9brBcbOLppfzMHqb0BhhelwfrdAkehiuwTVe8n V2waXQPM604X10rMqBN3i+oQyFIYJdKrO8Shs/lAYq7MrmEMKowcAxFqqvmtbr56kKJP p9bBmUQjV9st66tws/l1M4PGidDDnXOq5FZaBWt0dkQ85IcLdXT/9MJS2CcbaBCLVsj+ XoKppxlp0ToZWTrsMACmtC5uFUrRgIIAmbFeu8QfIGyZT9xRK/bDjNnmtMdpvWfvKRdW mjpQZZ/qxbglv+LRLzV8msXG7tAW1ShYLe67tQKFjLhs1iGElzoLsUk4CqwGeJ7OG0X3 xlcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c18si15443123eds.285.2021.03.17.02.57.51; Wed, 17 Mar 2021 02:58:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230287AbhCQJ4e (ORCPT + 99 others); Wed, 17 Mar 2021 05:56:34 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:14390 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbhCQJ4X (ORCPT ); Wed, 17 Mar 2021 05:56:23 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4F0lr913WxzkZvM; Wed, 17 Mar 2021 17:54:49 +0800 (CST) Received: from szvp000203569.huawei.com (10.120.216.130) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Wed, 17 Mar 2021 17:56:11 +0800 From: Chao Yu To: CC: , , , Chao Yu Subject: [PATCH 1/2] f2fs: don't start checkpoint thread in readonly mountpoint Date: Wed, 17 Mar 2021 17:56:03 +0800 Message-ID: <20210317095604.125820-1-yuchao0@huawei.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.120.216.130] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In readonly mountpoint, there should be no write IOs include checkpoint IO, so that it's not needed to create kernel checkpoint thread. Signed-off-by: Chao Yu --- fs/f2fs/super.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index ce88db0170fa..6716af216dca 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -2091,8 +2091,10 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) } } - if (!test_opt(sbi, DISABLE_CHECKPOINT) && - test_opt(sbi, MERGE_CHECKPOINT)) { + if ((*flags & SB_RDONLY) || test_opt(sbi, DISABLE_CHECKPOINT) || + !test_opt(sbi, MERGE_CHECKPOINT)) { + f2fs_stop_ckpt_thread(sbi); + } else { err = f2fs_start_ckpt_thread(sbi); if (err) { f2fs_err(sbi, @@ -2100,8 +2102,6 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data) err); goto restore_gc; } - } else { - f2fs_stop_ckpt_thread(sbi); } /* @@ -3857,7 +3857,7 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent) /* setup checkpoint request control and start checkpoint issue thread */ f2fs_init_ckpt_req_control(sbi); - if (!test_opt(sbi, DISABLE_CHECKPOINT) && + if (!f2fs_readonly(sb) && !test_opt(sbi, DISABLE_CHECKPOINT) && test_opt(sbi, MERGE_CHECKPOINT)) { err = f2fs_start_ckpt_thread(sbi); if (err) { -- 2.29.2