From patchwork Tue Jan 31 14:46:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Yu X-Patchwork-Id: 50901 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2790595wrn; Tue, 31 Jan 2023 06:47:41 -0800 (PST) X-Google-Smtp-Source: AK7set+EwZXUj7RsJsu3LMTi83a1B1GWwg49/4Iyz0ExcZZL8fTE2FchgHI+qDsC0yej8256uwar X-Received: by 2002:a05:6a21:9005:b0:bc:93c7:96ad with SMTP id tq5-20020a056a21900500b000bc93c796admr10013733pzb.12.1675176461035; Tue, 31 Jan 2023 06:47:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675176461; cv=none; d=google.com; s=arc-20160816; b=UnJ4rbQeEh3nmCiau9FlW5i7YsPeo10X65nMu7iBmS5JugDoRofjjbpZNvNuzsBFga ESc0N15/c/PjPhxS6RNawwfH3fTJ29u+R3hvB3tz82vCQP18aXZ7pOTZvr/RI2rdWW7i A5TbRGvA+tlGgEN1duYHH0eVzoyznojk/vtj/X/lStmBdbp6bItremZLqgURZzo/T3FY NjZi3tjqSrrWsJeF5g3l8CMaXURInstylFlnUot5lNYX9qofjgk1plRKT7vy6rDtRwE5 mGT2mKVuhFAPMa0Yi3K4TwA4fqOXeVMpIAWeg7r83lp+LqPSX1eXlDpinGb4oVrY1SMf /iGQ== 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:dkim-signature; bh=+FGTf5HuvO5/puVIx6bwuBMFZQlk4rXc/PUC03GODvA=; b=wXBT2zl+iptXpwBs6ChR6Ti7pagZbEt/41tBbz7DnS6lggTkQvIeSfbSDZLfWUGqWL JotnOMcVscV4dgFM9fAEUoDI7Hu4aoyWt794IR5CA7oABqoOOvkm7siun23tb5I+Wviv 58b0lR9p5tNEH6NO+E0R6NBR6RzoCvkwG9F8esRH0Kzv0+hMpWhXDgANG0S3PW9dFeU6 J9b+iH8GxsW7+3G/Z/uUE3/Iv1gi5/g7IV3vJqbf10UID2X2A1TGzAIG77KRvJq3Sxlx X9rfCeP0zWnQb0dLMJcQzCmot2TgQfDVSUUelZu1YU9WGhMcLXPr34GT8p3MkEk1dktD EefQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WSgUT5zF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i11-20020a63bf4b000000b004b377960752si15410131pgo.353.2023.01.31.06.47.28; Tue, 31 Jan 2023 06:47:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WSgUT5zF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231968AbjAaOrK (ORCPT + 99 others); Tue, 31 Jan 2023 09:47:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231910AbjAaOrJ (ORCPT ); Tue, 31 Jan 2023 09:47:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3C1C46727 for ; Tue, 31 Jan 2023 06:47:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7687661489 for ; Tue, 31 Jan 2023 14:47:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2456CC4339B; Tue, 31 Jan 2023 14:47:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1675176426; bh=MmOxigM59X8JlcAHThlYTmmNijEJl7O6QUjLV9hpxdU=; h=From:To:Cc:Subject:Date:From; b=WSgUT5zF8Y2q8+duHXiW8g+tcnUn16069rvwvf8xaKL8/mDJAaqVDHG0Y3JMhplgg tKMSGbfB1liLsTfja/zODR7ZrbxJpocaSHAxnGZ3A1sJcQe6CsKPUS+W9rnt1JPTUn 5cYPmTkBSjaHktth2/i8hUa1AKDA+phUWfml4Gmm9GmWL6UMBxusf8ATwiw8ULjL2L 0nFiC06B3b9LFjZCf11QuDydPeaNNz1F6H+oXiV17rlVcxTwm2+5G09fW5FZ+ao4Gv 4whexxOWEJZxq1DI+SxxlFluyIMrPaX8LqPZ3XJajBL5OIUgFBx+yImGM5EyB+M7LW mGiSLhDazvA4g== From: Chao Yu To: jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, Chao Yu Subject: [PATCH 1/3] f2fs: clean up __update_extent_tree_range() Date: Tue, 31 Jan 2023 22:46:59 +0800 Message-Id: <20230131144701.34418-1-chao@kernel.org> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756549832646705987?= X-GMAIL-MSGID: =?utf-8?q?1756549832646705987?= No logic change, just avoid goto statement. Signed-off-by: Chao Yu Signed-off-by: Chao Yu --- fs/f2fs/extent_cache.c | 66 ++++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/fs/f2fs/extent_cache.c b/fs/f2fs/extent_cache.c index d70ad6a44cbf..cf65a188d112 100644 --- a/fs/f2fs/extent_cache.c +++ b/fs/f2fs/extent_cache.c @@ -782,47 +782,43 @@ static void __update_extent_tree_range(struct inode *inode, en = next_en; } - if (type == EX_BLOCK_AGE) - goto update_age_extent_cache; - - /* 3. update extent in read extent cache */ - BUG_ON(type != EX_READ); - - if (tei->blk) { - __set_extent_info(&ei, fofs, len, tei->blk, false, - 0, 0, EX_READ); - if (!__try_merge_extent_node(sbi, et, &ei, prev_en, next_en)) - __insert_extent_tree(sbi, et, &ei, + /* 3. update extent in extent cache */ + if (type == EX_READ) { + if (tei->blk) { + __set_extent_info(&ei, fofs, len, tei->blk, false, + 0, 0, EX_READ); + if (!__try_merge_extent_node(sbi, et, &ei, + prev_en, next_en)) + __insert_extent_tree(sbi, et, &ei, insert_p, insert_parent, leftmost); - /* give up extent_cache, if split and small updates happen */ - if (dei.len >= 1 && - prev.len < F2FS_MIN_EXTENT_LEN && - et->largest.len < F2FS_MIN_EXTENT_LEN) { - et->largest.len = 0; - et->largest_updated = true; - set_inode_flag(inode, FI_NO_EXTENT); + /* give up read extent cache, if split and small updates happen */ + if (dei.len >= 1 && + prev.len < F2FS_MIN_EXTENT_LEN && + et->largest.len < F2FS_MIN_EXTENT_LEN) { + et->largest.len = 0; + et->largest_updated = true; + set_inode_flag(inode, FI_NO_EXTENT); + } } - } - - if (is_inode_flag_set(inode, FI_NO_EXTENT)) - __free_extent_tree(sbi, et); - if (et->largest_updated) { - et->largest_updated = false; - updated = true; - } - goto out_read_extent_cache; -update_age_extent_cache: - if (!tei->last_blocks) - goto out_read_extent_cache; + if (is_inode_flag_set(inode, FI_NO_EXTENT)) + __free_extent_tree(sbi, et); - __set_extent_info(&ei, fofs, len, 0, false, - tei->age, tei->last_blocks, EX_BLOCK_AGE); - if (!__try_merge_extent_node(sbi, et, &ei, prev_en, next_en)) - __insert_extent_tree(sbi, et, &ei, + if (et->largest_updated) { + et->largest_updated = false; + updated = true; + } + } else if (type == EX_BLOCK_AGE) { + if (tei->last_blocks) { + __set_extent_info(&ei, fofs, len, 0, false, + tei->age, tei->last_blocks, EX_BLOCK_AGE); + if (!__try_merge_extent_node(sbi, et, &ei, + prev_en, next_en)) + __insert_extent_tree(sbi, et, &ei, insert_p, insert_parent, leftmost); -out_read_extent_cache: + } + } write_unlock(&et->lock); if (updated)