Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1154910rbb; Sun, 25 Feb 2024 23:41:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX6k0eT2womjMIQz6qToSxg+TnXxNMi5WKar0ItiRzd42WvEvnDRmECoJb40uaVPuVImiVm6GetWWFYbRAcDX9FanMq65CBmkBMFL8CNg== X-Google-Smtp-Source: AGHT+IE/9GKDkI2poZULuAXTnaIlx3U9GZMQxGKuvGkT7SMOdkoRppWCF1lplxJ6AyfhFcjuFZYA X-Received: by 2002:a0c:f303:0:b0:68f:5103:161b with SMTP id j3-20020a0cf303000000b0068f5103161bmr5806270qvl.40.1708933276925; Sun, 25 Feb 2024 23:41:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708933276; cv=pass; d=google.com; s=arc-20160816; b=invYY02rxKZIj2CUPSWRKsi05Q0GEELjR1FDd6QBe5TM+P/kh+EiLgU8arMFv6/dmQ /Lvyhx1lPG3o+1eftd2J7eJ61W+2MJ0B7BI3LR3wakACoKBJGleT6hFQZoAqW9O/hIXx F7zKcqSYa6YWVSKPPZ8iYf19bC1kXSxOeKburWdS0oeGxYSCehs+n/UoM5yUUOQM6cip XL/euEOJlzD4S5HhX3Vm9g+X8QQ2R2wHiIUezT/n72m771kddTRjjU3OLxSiYnsG7mC8 XUPsOKF5iUJ1GWq2B5UPzLIJI5QBkHC5eJ+551qXg1jrod+7xbhdR0awL1Uh639q5snX AfTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nEPJ26NFMrTmL49thufpcKhb2K7Qjw5iU5l47qd9Nlw=; fh=X1/oBJvTGJUQ0YtRp03u+3tPfRw/dXXALWynfOSlfQQ=; b=mSYQ1ZNvooEFoNCR38Q60hmuEbBWBWKog1YhiTuWlC3zlLTme537dizigi3qaBOna1 /bbA+hHtLCQk3aPOjFnkrvFCMGwxNZGuaeZrJhBc8paX5Dfe0yWhArL68fJ/apRaoLRg kdLlGTJKMzSNS+pNOIdNu/2ONit0s6CDgWXTedRgWUGg5zUTztcVimxKvIag96zTDHeF iDqhdReNqMEGFp3WdmyJki/jwu1m0QDrUoDBslNm50i67Z3qe6TEPUs4el+JAhDrj91L l1RSJglzxHqV1LkNbkTddCKd6jh/58QXs+qwgQTdJIYCCaN6Pw9OhW1PvsdilM1Qu6Ye Jz2A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3ajVGpg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id i15-20020ad45c6f000000b0068fc8a0b9fasi4479339qvh.422.2024.02.25.23.41.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Feb 2024 23:41:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=I3ajVGpg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-80679-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80679-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id A870C1C2234D for ; Mon, 26 Feb 2024 07:41:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6B2591EB55; Mon, 26 Feb 2024 07:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I3ajVGpg" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EC8B1DA24 for ; Mon, 26 Feb 2024 07:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708932948; cv=none; b=Fi7Bm3z5mCRI2E94mKuvdY+004Y2W2TNMORrIuXa60z63Sp4DyzOGmIaFpqC8vHzh9VHwKPXPVlO59QMC/5APybSnBN97EMcQIZmzlDetKKDpMYaK0kEmv+3OT2g/zQu6zN5FzBrEpaB9wMso6RLesoqVok2KnCRfBAG/YfjJ4U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708932948; c=relaxed/simple; bh=DM7lCeAQkkrdeMDm7IxgfNbaFgZdno2MS54NUJmA8dw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MA4IjdnrKKBEJupmZ1CE0cNPh+piKpSr6CH8F23zk5VagBmJUSmaJRbJOBfEeWB6g99BDo4yrSS0oXiZ+s04RoRs7D4Ef2gR3aC3KTbyipD7apY3ZTt0XLYa94G2yQAUsMWVMb0EE/fbSX7+fvkW+6oc5uLexcbYLeKJuhwqD/o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I3ajVGpg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C106C433B2; Mon, 26 Feb 2024 07:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708932947; bh=DM7lCeAQkkrdeMDm7IxgfNbaFgZdno2MS54NUJmA8dw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I3ajVGpgQc6l7+OU17u75YYhHNroOTJz8hHJTRRGAnv31ib+bQX+ozAzTBiBlyody 2trvL2ADY8ta0KNNzk6otf5eBw74LSiUdxJURZJgqTmT8SckTYPAwS1AO+ykCMImQy 2L74/p3AcflUs0sYfV6OVwSsN6l78h659dpZsrI6uciQzUVioiuGLSxXRuG9+99DJX Zt6L4BprJAHNjZJx+BjVzuOtUIlubCWPyXKRfmZUSfOqZdTfirUQuZ32PMcuuEnUvC /3OV5svysGVXzPXYeF5YwxKHZpa8twJqYPGmkPfShE9aHNaDRDwEjs8RrDAmAutWnC nZRx0aWJ7IAqA== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 2/2] f2fs: ro: don't start discard thread for readonly image Date: Mon, 26 Feb 2024 15:35:39 +0800 Message-Id: <20240226073539.2509926-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240226073539.2509926-1-chao@kernel.org> References: <20240226073539.2509926-1-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit [ 9299.893835] F2FS-fs (vdd): Allow to mount readonly mode only mount: /mnt/f2fs: WARNING: source write-protected, mounted read-only. root@qemu:/ ps -ef|grep f2fs root 94 2 0 03:46 ? 00:00:00 [kworker/u17:0-f2fs_post_read_wq] root 6282 2 0 06:21 ? 00:00:00 [f2fs_discard-253:48] There will be no deletion in readonly image, let's skip starting discard thread to save system resources. Signed-off-by: Chao Yu --- fs/f2fs/segment.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index b486fe4485f9..cc27c5440188 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -2253,6 +2253,12 @@ int f2fs_start_discard_thread(struct f2fs_sb_info *sbi) struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; int err = 0; + if (f2fs_sb_has_readonly(sbi)) { + f2fs_info(sbi, + "Skip to start discard thread for readonly image"); + return 0; + } + if (!f2fs_realtime_discard_enable(sbi)) return 0; -- 2.40.1