From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Zhiguo Niu <niuzhiguo84@gmail.com>
Cc: ke.wang@unisoc.com, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, hongyu.jin@unisoc.com,
Zhiguo Niu <zhiguo.niu@unisoc.com>
Subject: Re: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr
Date: Tue, 20 Feb 2024 10:36:34 +0800 [thread overview]
Message-ID: <4bcf0a1c-b21d-4735-bf57-b78439a65df5@kernel.org> (raw)
In-Reply-To: <17c9e85a-54b6-4e1c-b95f-262c771b0f1d@kernel.org>
On 2024/2/19 22:36, Chao Yu wrote:
>>>> Please think about how to optimize this, which is really ugly now
---
fs/f2fs/checkpoint.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
index 87b7c988c8ca..089c26b80be3 100644
--- a/fs/f2fs/checkpoint.c
+++ b/fs/f2fs/checkpoint.c
@@ -135,7 +135,7 @@ struct page *f2fs_get_tmp_page(struct f2fs_sb_info *sbi, pgoff_t index)
}
static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
- int type)
+ int type, bool *record_error)
{
struct seg_entry *se;
unsigned int segno, offset;
@@ -160,6 +160,7 @@ static bool __is_bitmap_valid(struct f2fs_sb_info *sbi, block_t blkaddr,
blkaddr, exist);
set_sbi_flag(sbi, SBI_NEED_FSCK);
dump_stack();
+ *record_error = true;
}
return exist;
@@ -209,10 +210,13 @@ static bool __f2fs_is_valid_blkaddr(struct f2fs_sb_info *sbi,
dump_stack();
goto err;
} else {
- valid = __is_bitmap_valid(sbi, blkaddr, type);
- if ((!valid && type != DATA_GENERIC_ENHANCE_UPDATE) ||
- (valid && type == DATA_GENERIC_ENHANCE_UPDATE))
+ bool record_error = false;
+
+ valid = __is_bitmap_valid(sbi, blkaddr, type,
+ &record_error);
+ if (!valid || record_error)
goto err;
+ return valid;
}
break;
case META_GENERIC:
--
2.40.1
next prev parent reply other threads:[~2024-02-20 2:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 3:30 [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr Zhiguo Niu
2024-02-05 3:47 ` Chao Yu
2024-02-06 3:32 ` Jaegeuk Kim
2024-02-06 3:36 ` Chao Yu
2024-02-06 23:38 ` Zhiguo Niu
2024-02-19 3:46 ` Chao Yu
2024-02-19 11:19 ` Zhiguo Niu
2024-02-19 14:36 ` Chao Yu
2024-02-20 2:36 ` Chao Yu [this message]
2024-02-20 5:34 ` [f2fs-dev] " Zhiguo Niu
2024-02-20 6:13 ` Chao Yu
2024-02-20 6:32 ` Chao Yu
[not found] ` <CAHJ8P3J8WUAxOrG91id+sKKt7ndLnETdbzz6Zy7haoC9qfT0tg@mail.gmail.com>
2024-02-20 7:58 ` Chao Yu
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=4bcf0a1c-b21d-4735-bf57-b78439a65df5@kernel.org \
--to=chao@kernel.org \
--cc=hongyu.jin@unisoc.com \
--cc=jaegeuk@kernel.org \
--cc=ke.wang@unisoc.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=niuzhiguo84@gmail.com \
--cc=zhiguo.niu@unisoc.com \
/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