From patchwork Fri Apr 4 19:54:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jaegeuk Kim X-Patchwork-Id: 14038892 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 24096C369A2 for ; Fri, 4 Apr 2025 19:55:15 +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 1u0n8D-0004C3-6o; Fri, 04 Apr 2025 19:55:13 +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 1u0n8B-0004Bv-Kp for linux-f2fs-devel@lists.sourceforge.net; Fri, 04 Apr 2025 19:55:12 +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=zwgj395ajodfe4c6ojvFdoR0yT6FlsSXGPbOr5KeF/E=; b=N4vigO6FEMmD6WFyxw44I1Mhna i0XyVL8LOGDn79m4SHQSuW6d2zlrZy9wSqAMKBuy8coKJS6a5zWD6qq9lTdcy4LKnu0UIxvlNySiF jco/79FMUWP3aOCUfR2HmqO5I4lcytJ44cyXvKSrtTjDu8Tlq4wM1umK7zbDsrH4EU5c=; 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=zwgj395ajodfe4c6ojvFdoR0yT6FlsSXGPbOr5KeF/E=; b=V cscMKYwiHIHVPIa0ZsXaF/syvILvHEZiszh7HMknIl/LucxQFQIgcqmOrDE3OFD2DGnBhO32UgUOq COLKnjPJjdAKetHH9OFR0c0iuOvbHZnvr6QMICBLePMb4ZQIHxmDtYAi/FqMayS3P3hj7prPBePjv e8BcBnb8DM8LKwmY=; Received: from tor.source.kernel.org ([172.105.4.254]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1u0n7w-0006iz-EF for linux-f2fs-devel@lists.sourceforge.net; Fri, 04 Apr 2025 19:55:12 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 58BDA61139 for ; Fri, 4 Apr 2025 19:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41F32C4CEDD; Fri, 4 Apr 2025 19:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1743796485; bh=2UlsTHi7AOc8miGOqZhj4VPJ8gnJHtkD07YzMrfULlg=; h=From:To:Cc:Subject:Date:From; b=CEx/U85jhoYAMt09WN2v5Ga+FezzbD2Dz5tMaeiDaquWBw0BMfPsEDsVjFdLPVm92 4o2Y07hxNTgPv3ZSG6ryzQgaGNk2Zs5ae+h1pDop+MAbB1lW5GdupMzofjas0x0ozY hWXYsa6L3cJGv8nUP+yTvtDINa+2ji6aTzTxZdDraEieAPu5pRFPPam1esWAj9yY/R 31+WkXtfgqzTomaDLBVWEeDai9GYo/0Le+fBNxS4V8530CuLL4KDbtlyFemTRSKSCW qJyjLnB5yqJq7Bd8JX4p0n4cwHPYs4uijlS+QaoPUdz/zQgvlNsSX9FeODtdHX7pqU exNpjk2u4UFcA== To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Date: Fri, 4 Apr 2025 19:54:42 +0000 Message-ID: <20250404195442.413945-1-jaegeuk@kernel.org> X-Mailer: git-send-email 2.49.0.504.g3bcea36a83-goog MIME-Version: 1.0 X-Headers-End: 1u0n7w-0006iz-EF Subject: [f2fs-dev] [PATCH] f2fs: clean up unnecessary indentation 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: , X-Patchwork-Original-From: Jaegeuk Kim via Linux-f2fs-devel From: Jaegeuk Kim Reply-To: Jaegeuk Kim Cc: Jaegeuk Kim Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net No functional change. Signed-off-by: Jaegeuk Kim Reviewed-by: Chao Yu --- fs/f2fs/segment.h | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/fs/f2fs/segment.h b/fs/f2fs/segment.h index 0465dc00b349..5fcb1f92d506 100644 --- a/fs/f2fs/segment.h +++ b/fs/f2fs/segment.h @@ -429,7 +429,6 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno) unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno); unsigned int next; - unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi); spin_lock(&free_i->segmap_lock); clear_bit(segno, free_i->free_segmap); @@ -437,7 +436,7 @@ static inline void __set_free(struct f2fs_sb_info *sbi, unsigned int segno) next = find_next_bit(free_i->free_segmap, start_segno + SEGS_PER_SEC(sbi), start_segno); - if (next >= start_segno + usable_segs) { + if (next >= start_segno + f2fs_usable_segs_in_sec(sbi)) { clear_bit(secno, free_i->free_secmap); free_i->free_sections++; } @@ -463,22 +462,31 @@ static inline void __set_test_and_free(struct f2fs_sb_info *sbi, unsigned int secno = GET_SEC_FROM_SEG(sbi, segno); unsigned int start_segno = GET_SEG_FROM_SEC(sbi, secno); unsigned int next; - unsigned int usable_segs = f2fs_usable_segs_in_sec(sbi); + bool ret; spin_lock(&free_i->segmap_lock); - if (test_and_clear_bit(segno, free_i->free_segmap)) { - free_i->free_segments++; - - if (!inmem && IS_CURSEC(sbi, secno)) - goto skip_free; - next = find_next_bit(free_i->free_segmap, - start_segno + SEGS_PER_SEC(sbi), start_segno); - if (next >= start_segno + usable_segs) { - if (test_and_clear_bit(secno, free_i->free_secmap)) - free_i->free_sections++; - } - } -skip_free: + ret = test_and_clear_bit(segno, free_i->free_segmap); + if (!ret) + goto unlock_out; + + free_i->free_segments++; + + if (!inmem && IS_CURSEC(sbi, secno)) + goto unlock_out; + + /* check large section */ + next = find_next_bit(free_i->free_segmap, + start_segno + SEGS_PER_SEC(sbi), start_segno); + if (next < start_segno + f2fs_usable_segs_in_sec(sbi)) + goto unlock_out; + + ret = test_and_clear_bit(secno, free_i->free_secmap); + if (!ret) + goto unlock_out; + + free_i->free_sections++; + +unlock_out: spin_unlock(&free_i->segmap_lock); }