summaryrefslogtreecommitdiff
path: root/fs/f2fs/file.c
diff options
context:
space:
mode:
authorZhiguo Niu <zhiguo.niu@unisoc.com>2024-03-08 14:25:25 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2024-03-12 18:25:17 -0700
commit31f85ccc84b82cc7eb122af01f5017fbe1e29289 (patch)
tree71eaa44bd312d580e5f84d5ccf7f62af752d3377 /fs/f2fs/file.c
parent11bec96afbfbc4679863db55258de440d786821e (diff)
f2fs: unify the error handling of f2fs_is_valid_blkaddr
There are some cases of f2fs_is_valid_blkaddr not handled as ERROR_INVALID_BLKADDR,so unify the error handling about all of f2fs_is_valid_blkaddr. Do f2fs_handle_error in __f2fs_is_valid_blkaddr for cleanup. Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com> Signed-off-by: Chao Yu <chao@kernel.org> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/file.c')
-rw-r--r--fs/f2fs/file.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index dc9c6bac678d..4dfe38e73130 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -608,10 +608,8 @@ void f2fs_truncate_data_blocks_range(struct dnode_of_data *dn, int count)
if (time_to_inject(sbi, FAULT_BLKADDR_CONSISTENCE))
continue;
if (!f2fs_is_valid_blkaddr_raw(sbi, blkaddr,
- DATA_GENERIC_ENHANCE)) {
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
+ DATA_GENERIC_ENHANCE))
continue;
- }
if (compressed_cluster)
valid_blocks++;
}
@@ -1209,7 +1207,6 @@ next_dnode:
!f2fs_is_valid_blkaddr(sbi, *blkaddr,
DATA_GENERIC_ENHANCE)) {
f2fs_put_dnode(&dn);
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
return -EFSCORRUPTED;
}
@@ -1495,7 +1492,6 @@ static int f2fs_do_zero_range(struct dnode_of_data *dn, pgoff_t start,
if (!f2fs_is_valid_blkaddr(sbi, dn->data_blkaddr,
DATA_GENERIC_ENHANCE)) {
ret = -EFSCORRUPTED;
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
break;
}
@@ -3474,10 +3470,8 @@ static int release_compress_blocks(struct dnode_of_data *dn, pgoff_t count)
if (!__is_valid_data_blkaddr(blkaddr))
continue;
if (unlikely(!f2fs_is_valid_blkaddr(sbi, blkaddr,
- DATA_GENERIC_ENHANCE))) {
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
+ DATA_GENERIC_ENHANCE)))
return -EFSCORRUPTED;
- }
}
while (count) {
@@ -3639,10 +3633,8 @@ static int reserve_compress_blocks(struct dnode_of_data *dn, pgoff_t count,
if (!__is_valid_data_blkaddr(blkaddr))
continue;
if (unlikely(!f2fs_is_valid_blkaddr(sbi, blkaddr,
- DATA_GENERIC_ENHANCE))) {
- f2fs_handle_error(sbi, ERROR_INVALID_BLKADDR);
+ DATA_GENERIC_ENHANCE)))
return -EFSCORRUPTED;
- }
}
while (count) {
@@ -3924,8 +3916,6 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg)
DATA_GENERIC_ENHANCE)) {
ret = -EFSCORRUPTED;
f2fs_put_dnode(&dn);
- f2fs_handle_error(sbi,
- ERROR_INVALID_BLKADDR);
goto out;
}