From: Chao Yu <chao@kernel.org>
To: jaegeuk@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 1/3] f2fs: clean up __update_extent_tree_range()
Date: Tue, 31 Jan 2023 22:46:59 +0800 [thread overview]
Message-ID: <20230131144701.34418-1-chao@kernel.org> (raw)
No logic change, just avoid goto statement.
Signed-off-by: Chao Yu <chao@kernel.org>
---
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)
--
2.36.1
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next reply other threads:[~2023-01-31 14:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-31 14:46 Chao Yu [this message]
2023-01-31 14:47 ` [f2fs-dev] [PATCH 2/3] f2fs: fix to update age extent correctly during truncation Chao Yu
2023-01-31 14:47 ` [f2fs-dev] [PATCH 3/3] f2fs: fix to update age extent in f2fs_do_zero_range() Chao Yu
2023-01-31 18:56 ` [f2fs-dev] [PATCH 1/3] f2fs: clean up __update_extent_tree_range() Jaegeuk Kim
2023-02-01 8:53 ` Chao Yu
2023-02-06 3:41 ` Jaegeuk Kim
2023-02-07 12:33 ` Chao Yu
2023-01-31 19:10 ` patchwork-bot+f2fs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230131144701.34418-1-chao@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).