lkml.org 
[lkml]   [2024]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
SubjectRe: [f2fs-dev] [PATCH v7] f2fs: unify the error handling of f2fs_is_valid_blkaddr
From
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


\
 
 \ /
  Last update: 2024-05-27 15:11    [W:0.102 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site