From patchwork Thu Jun 6 09:52:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13688216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3AD7C25B75 for ; Thu, 6 Jun 2024 09:53:02 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sF9nq-0007y4-TQ; Thu, 06 Jun 2024 09:53:02 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sF9np-0007xv-Um for linux-f2fs-devel@lists.sourceforge.net; Thu, 06 Jun 2024 09:53:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=kYLhpAMZR61cty6AvZweA/m3vDLXR4UUWCD1h1qb/EA=; b=iW90LQxiMTCqkpyrXKKpxuzkJR 3LKEfcIAPNp7wrDcd+PD59FpxwyZCSh2AS3OPMFgdXWTD28rYHmKlQfYvxxaHhdaUM1olHWoXftF+ dFOIIL7kikoM5AqiqPAGtGlmSPiR5PJykk/1HEl7Foa1gdku5fY7j+U1wxvQf0HtChTo=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=kYLhpAMZR61cty6AvZweA/m3vDLXR4UUWCD1h1qb/EA=; b=f TbCQ3vfUL1n2VBtvErvGCJLpQAKicxgwekruKVi7dfK6+rur2OulS3W1nYEsyw+5JKgei1FZ6RBt9 phs3yKt+vSrd3Lady+7lG9LEvbMwiLGDTvbrLZP1SeN9IFps5aIIWSSKuriptEKEqKqRG6SKoTDQ1 I3SGy7quQDBxSVYA=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sF9np-0004Qm-GZ for linux-f2fs-devel@lists.sourceforge.net; Thu, 06 Jun 2024 09:53:01 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 67E5361A94; Thu, 6 Jun 2024 09:52:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCEDEC32782; Thu, 6 Jun 2024 09:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717667545; bh=vpCESMH7oAFny3mUZ0bjEmQ2oG/eItdcKHHoG8MCYVk=; h=From:To:Cc:Subject:Date:From; b=l27xivrEPzpxVDgprs68EK4yUasJGbA3yLIIjSfpYXxi4LKXBtuHRk3WlVi8bFqBl Fj1gX8Xt0d4KAY+1AYWagZ7etA/10ur6WFFgl6vdJiXexEemB1+im/tVI/QIrgzF3X f1G/cARZ64LKcMhxzm8o0LiSm2H2CPd5p5PDCMp1zhJHceulunVb6iNrOpuuS2HQQY G9LEs8KrwtxDcnWjuFxQ+OSkUTsv+Dsq2SIuLe8KqVaPL9Askqvx7yP//gUluOuOiV uCwEk1RMO0OlCve3ITcXAab+usskbJA5oTG4IDZvoyRUN9AB0KhrafemKm2h9gNFmJ ZK7RYlkSTtCsg== From: Chao Yu To: jaegeuk@kernel.org Date: Thu, 6 Jun 2024 17:52:12 +0800 Message-Id: <20240606095213.4087668-1-chao@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Headers-End: 1sF9np-0004Qm-GZ Subject: [f2fs-dev] [PATCH 1/2] f2fs: fix to add missing sb_{start, end}_intwrite() for ckpt thread X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net After commit 261eeb9c1585 ("f2fs: introduce checkpoint_merge mount option"), checkpoint can be triggered in background thread, it missed to cover f2fs inner checkpoint operation w/ sb_{start,end}_intwrite(), fix it. Fixes: 261eeb9c1585 ("f2fs: introduce checkpoint_merge mount option") Cc: Daeho Jeong Signed-off-by: Chao Yu Reviewed-by: Daeho Jeong --- fs/f2fs/checkpoint.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 55d444bec5c0..66eaad591b60 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -1828,8 +1828,11 @@ static int issue_checkpoint_thread(void *data) if (kthread_should_stop()) return 0; - if (!llist_empty(&cprc->issue_list)) + if (!llist_empty(&cprc->issue_list)) { + sb_start_intwrite(sbi->sb); __checkpoint_and_complete_reqs(sbi); + sb_end_intwrite(sbi->sb); + } wait_event_interruptible(*q, kthread_should_stop() || !llist_empty(&cprc->issue_list)); From patchwork Thu Jun 6 09:52:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 13688215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8632DC25B75 for ; Thu, 6 Jun 2024 09:52:40 +0000 (UTC) Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1sF9nS-0000z0-Lb; Thu, 06 Jun 2024 09:52:39 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1sF9nQ-0000yq-Kd for linux-f2fs-devel@lists.sourceforge.net; Thu, 06 Jun 2024 09:52:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=0Qtit0s+ubEdwb2l1dDcIyvlNhAk3ps4t2tuYcweImE=; b=Ma6/fwXhy7UvrJsQioIWJvKaCN NFSocfuiYQPXHlrO+fQvSVskUeHk8sARW/Iu0EcqLH7uwrT1p5gmU1F81tdgfuZ9FC53M0PaFG5gt DtJNhq8PHBGiqhNGPVpOSUagQ9TQwt0QJaP6KhK068wWq4avJuQCsHjgbCnuJ03DbAKE=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=0Qtit0s+ubEdwb2l1dDcIyvlNhAk3ps4t2tuYcweImE=; b=SRB534L+ieVWlHE5gnXlBnhwct 972bc5gdZfEc2NX1lv2/EjglbDeh1iu5bDSYfA2Ag57yc++NbO4moFYgVYhbN3GwTx/OH6/J+jeTB jZVlcb+AI+r8Wuxe0e/mp4R+ruTo0/rRbUft6hR/vrVR9bnvNfkJnEobDp1pZzdfhptQ=; Received: from dfw.source.kernel.org ([139.178.84.217]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1sF9nS-0004OY-0r for linux-f2fs-devel@lists.sourceforge.net; Thu, 06 Jun 2024 09:52:37 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id E340461A14 for ; Thu, 6 Jun 2024 09:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92FD0C4AF0D; Thu, 6 Jun 2024 09:52:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717667546; bh=1A4x52edkxk15o++tyYBiiibRgkm7p/CeiPX3AK72eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oV1szKEXx6PIDhSbDwjHlwMXPTlD3x5MY2IXcNWWkyCBSwTAi4TTEqjoO82yl/M3V wexutYQvf6Us0ZnAb3IVk5F0DOHvq/HHBJc3K0nqvJ8R4Ls3xScHAUNMQEt00vBuTO qJ8zEjiMTFZVKYGKoFBPDM7j19NjNhiCuXhjhLhOctvqM/mVCxdHgNkgi4rV8B/dV1 wpQ+PC1TYhkRcOFGap0X9agTgBsi7kcRlDcGw1vRCmssuziSfF06JYLnwrHny7C1aM 6cIF2Ta+qHN05PRw+eXQvw+ZrzNCmalA1PDUvlbwc1Qt0Wu7h5yRQSw43g21/b7rOK 73qjGvTanl74w== From: Chao Yu To: jaegeuk@kernel.org Date: Thu, 6 Jun 2024 17:52:13 +0800 Message-Id: <20240606095213.4087668-2-chao@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240606095213.4087668-1-chao@kernel.org> References: <20240606095213.4087668-1-chao@kernel.org> MIME-Version: 1.0 X-Headers-End: 1sF9nS-0004OY-0r Subject: [f2fs-dev] [PATCH 2/2] f2fs: fix to use sb_{start, end}_intwrite{_trylock, }() in gc_thread_func() X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net Since background GC is f2fs inner operation, so, let's use sb_{start,end}_intwrite{_trylock,}() instead of sb_{start,end}_write{_trylock,}() in gc_thread_func(). Signed-off-by: Chao Yu --- fs/f2fs/gc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index ef667fec9a12..004587ac5530 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -76,7 +76,7 @@ static int gc_thread_func(void *data) f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_FAULT_INJECT); - if (!sb_start_write_trylock(sbi->sb)) { + if (!sb_start_intwrite_trylock(sbi->sb)) { stat_other_skip_bggc_count(sbi); continue; } @@ -163,7 +163,7 @@ static int gc_thread_func(void *data) } spin_unlock(&sbi->gc_remaining_trials_lock); } - sb_end_write(sbi->sb); + sb_end_intwrite(sbi->sb); } while (!kthread_should_stop()); return 0;