From mboxrd@z Thu Jan 1 00:00:00 1970 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 A255BC54798 for ; Tue, 27 Feb 2024 17:50:34 +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 1rf1b6-0001ag-JF; Tue, 27 Feb 2024 17:50:33 +0000 Received: from [172.30.20.202] (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 1rf1b4-0001aX-19 for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Feb 2024 17:50:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: 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=h/8jspnH+YKtNW5qt3Wug3HFjqQ5IsuWiYgMj5TwX0s=; b=bz7TtjZjU0AGbktA+lEBgy3hhv wvPS2zVsyRxVHu2bxwFccgVB63MHVVtDmU/0YwokP9fHRiyfkTLTE8FvyhmolhC6TMeAzCbm93Mwj d0ljAr/5YFKC5CjFoKtUMLTHi1DzUyoIYLTLCpB8lQEQvlrooXep/lEXEVXOAyQvteFs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding: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=h/8jspnH+YKtNW5qt3Wug3HFjqQ5IsuWiYgMj5TwX0s=; b=Ueuh06iNcKowHnfHZ5LwG3xT3q V6+8aSTmfSl4FolygtFJWREGUmI9/NoMdDiDCpir0x044/XCzqcPpZuzL8lapmKyKoOscVPon6plb UWqMwBr8Zz5Yk+M8Q8xere3pWlnsk384OxAVM0RcvSVDyPMU0wVAuA2eofKioba4uDvw=; 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 1rf1b4-0007Uu-0M for linux-f2fs-devel@lists.sourceforge.net; Tue, 27 Feb 2024 17:50:30 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 91B1C61307 for ; Tue, 27 Feb 2024 17:50:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 226DDC433F1; Tue, 27 Feb 2024 17:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709056219; bh=DDIKRf6Ufecl9u57nNBqnT2apz/dSFBQ9/B2HzYZIKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MiavqekT8D8nUaX8Elm1x2Eu9AMmI2cT+u3IkMJ9CSglk2muojEs+Y49uOoEuqYv1 mbPo+W/3LR01UUG7RnQgOSrJMzzZ+lLZxueIEWbCTFbxuIsP7YELh1pGfcuD7W+NW0 nZN4yT37tv0ebz6G6jckbv6AVNrpBWoQYzpTYxFtmiTDqCYG5fzlYetCOgjh4tr8mt zQRi4DSaVHM/6/gnShQkQyVfvSo9b2bB3/4G2qeGRdW5td0adH84w2IySP2V4BMS1F YupOmDsM9mSqb8QR2kG7XkIBohQ9D2lU70KdApgbqz+WIhpqbxt+No8jCL/0SKPmlJ xvYBKRJCnCaJQ== Date: Tue, 27 Feb 2024 09:50:17 -0800 From: Jaegeuk Kim To: Chao Yu Message-ID: References: <20240222121851.883141-1-chao@kernel.org> <20240222121851.883141-2-chao@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240222121851.883141-2-chao@kernel.org> X-Headers-End: 1rf1b4-0007Uu-0M Subject: Re: [f2fs-dev] [PATCH 2/4] f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 02/22, Chao Yu wrote: > f2fs_stop_checkpoint(, false) is complex and it may sleep, so we should > move it outside segmap_lock spinlock coverage in get_new_segment(). Chao, I merged this patch into https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev-test&id=f3b576d209983b5d6e1cb130bfc8ca1f0bbcad6d > > Signed-off-by: Chao Yu > --- > fs/f2fs/segment.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index d0209ea77dd2..8edc42071e6f 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -2646,6 +2646,7 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > unsigned int old_zoneno = GET_ZONE_FROM_SEG(sbi, *newseg); > bool init = true; > int i; > + int ret = 0; > > spin_lock(&free_i->segmap_lock); > > @@ -2671,9 +2672,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > secno = find_first_zero_bit(free_i->free_secmap, > MAIN_SECS(sbi)); > if (secno >= MAIN_SECS(sbi)) { > - f2fs_stop_checkpoint(sbi, false, > - STOP_CP_REASON_NO_SEGMENT); > - f2fs_bug_on(sbi, 1); > + ret = -ENOSPC; > + goto out_unlock; > } > } > segno = GET_SEG_FROM_SEC(sbi, secno); > @@ -2704,7 +2704,13 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > f2fs_bug_on(sbi, test_bit(segno, free_i->free_segmap)); > __set_inuse(sbi, segno); > *newseg = segno; > +out_unlock: > spin_unlock(&free_i->segmap_lock); > + > + if (ret) { > + f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_NO_SEGMENT); > + f2fs_bug_on(sbi, 1); > + } > } > > static void reset_curseg(struct f2fs_sb_info *sbi, int type, int modified) > -- > 2.40.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 AAC994E1CB for ; Tue, 27 Feb 2024 17:50:19 +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=1709056219; cv=none; b=K5RNL4AIUD4rDpBWdrgoLZpjNeO53suYAPJAnTXknZCOeJWJtv4SuXWF1pPn1g3dWsqjImccaBO/pDUN0yYt+8fRU5yQ+vkJ7NZLUc5S5oZTFYHlXWtqKgE4dVImdU+/FoKYPzoIOdLkPvVTL3NStU/AekoQUFqehFE0M7T8aXc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709056219; c=relaxed/simple; bh=DDIKRf6Ufecl9u57nNBqnT2apz/dSFBQ9/B2HzYZIKc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uL330ZwkPdDT/ljKznWaf+PSoSUjJUaz0E+I+iO2UNrIgLKEldTNdzZHQdaszv61pOf0d6eifQPKRiC11JDliEF9RuyCl142vC/K0HoW5lqwS3gpwud7epUgv5jpaNBTZDdG95gIvpUysWY3/GJ6zmkpWINseE/qzjPw2dFu9vk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=MiavqekT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="MiavqekT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 226DDC433F1; Tue, 27 Feb 2024 17:50:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709056219; bh=DDIKRf6Ufecl9u57nNBqnT2apz/dSFBQ9/B2HzYZIKc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MiavqekT8D8nUaX8Elm1x2Eu9AMmI2cT+u3IkMJ9CSglk2muojEs+Y49uOoEuqYv1 mbPo+W/3LR01UUG7RnQgOSrJMzzZ+lLZxueIEWbCTFbxuIsP7YELh1pGfcuD7W+NW0 nZN4yT37tv0ebz6G6jckbv6AVNrpBWoQYzpTYxFtmiTDqCYG5fzlYetCOgjh4tr8mt zQRi4DSaVHM/6/gnShQkQyVfvSo9b2bB3/4G2qeGRdW5td0adH84w2IySP2V4BMS1F YupOmDsM9mSqb8QR2kG7XkIBohQ9D2lU70KdApgbqz+WIhpqbxt+No8jCL/0SKPmlJ xvYBKRJCnCaJQ== Date: Tue, 27 Feb 2024 09:50:17 -0800 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] f2fs: fix to don't call f2fs_stop_checkpoint in spinlock coverage Message-ID: References: <20240222121851.883141-1-chao@kernel.org> <20240222121851.883141-2-chao@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240222121851.883141-2-chao@kernel.org> On 02/22, Chao Yu wrote: > f2fs_stop_checkpoint(, false) is complex and it may sleep, so we should > move it outside segmap_lock spinlock coverage in get_new_segment(). Chao, I merged this patch into https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs.git/commit/?h=dev-test&id=f3b576d209983b5d6e1cb130bfc8ca1f0bbcad6d > > Signed-off-by: Chao Yu > --- > fs/f2fs/segment.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > index d0209ea77dd2..8edc42071e6f 100644 > --- a/fs/f2fs/segment.c > +++ b/fs/f2fs/segment.c > @@ -2646,6 +2646,7 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > unsigned int old_zoneno = GET_ZONE_FROM_SEG(sbi, *newseg); > bool init = true; > int i; > + int ret = 0; > > spin_lock(&free_i->segmap_lock); > > @@ -2671,9 +2672,8 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > secno = find_first_zero_bit(free_i->free_secmap, > MAIN_SECS(sbi)); > if (secno >= MAIN_SECS(sbi)) { > - f2fs_stop_checkpoint(sbi, false, > - STOP_CP_REASON_NO_SEGMENT); > - f2fs_bug_on(sbi, 1); > + ret = -ENOSPC; > + goto out_unlock; > } > } > segno = GET_SEG_FROM_SEC(sbi, secno); > @@ -2704,7 +2704,13 @@ static void get_new_segment(struct f2fs_sb_info *sbi, > f2fs_bug_on(sbi, test_bit(segno, free_i->free_segmap)); > __set_inuse(sbi, segno); > *newseg = segno; > +out_unlock: > spin_unlock(&free_i->segmap_lock); > + > + if (ret) { > + f2fs_stop_checkpoint(sbi, false, STOP_CP_REASON_NO_SEGMENT); > + f2fs_bug_on(sbi, 1); > + } > } > > static void reset_curseg(struct f2fs_sb_info *sbi, int type, int modified) > -- > 2.40.1