aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs/segment.c
diff options
context:
space:
mode:
authorChao Yu <yuchao0@huawei.com>2019-06-20 11:36:14 +0800
committerJaegeuk Kim <jaegeuk@kernel.org>2019-07-02 15:40:41 -0700
commit10f966bbf521bb9b2e497bbca496a5141f4071d0 (patch)
tree828ab169692133b6220c3a547631349c0a0cbced /fs/f2fs/segment.c
parentf2fs: Use DIV_ROUND_UP() instead of open-coding (diff)
downloadlinux-dev-10f966bbf521bb9b2e497bbca496a5141f4071d0.tar.xz
linux-dev-10f966bbf521bb9b2e497bbca496a5141f4071d0.zip
f2fs: use generic EFSBADCRC/EFSCORRUPTED
f2fs uses EFAULT as error number to indicate filesystem is corrupted all the time, but generic filesystems use EUCLEAN for such condition, we need to change to follow others. This patch adds two new macros as below to wrap more generic error code macros, and spread them in code. EFSBADCRC EBADMSG /* Bad CRC detected */ EFSCORRUPTED EUCLEAN /* Filesystem is corrupted */ Reported-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Chao Yu <yuchao0@huawei.com> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/segment.c')
-rw-r--r--fs/f2fs/segment.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index ee96e6fb1a50..478284db3065 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -2819,7 +2819,7 @@ int f2fs_trim_fs(struct f2fs_sb_info *sbi, struct fstrim_range *range)
if (is_sbi_flag_set(sbi, SBI_NEED_FSCK)) {
f2fs_warn(sbi, "Found FS corruption, run fsck to fix.");
- return -EIO;
+ return -EFSCORRUPTED;
}
/* start/end segment number in main_area */
@@ -3244,7 +3244,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
set_sbi_flag(sbi, SBI_NEED_FSCK);
f2fs_warn(sbi, "%s: incorrect segment(%u) type, run fsck to fix.",
__func__, segno);
- return -EFAULT;
+ return -EFSCORRUPTED;
}
stat_inc_inplace_blocks(fio->sbi);
@@ -4153,7 +4153,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
f2fs_err(sbi, "Wrong journal entry on segno %u",
start);
set_sbi_flag(sbi, SBI_NEED_FSCK);
- err = -EINVAL;
+ err = -EFSCORRUPTED;
break;
}
@@ -4193,7 +4193,7 @@ static int build_sit_entries(struct f2fs_sb_info *sbi)
f2fs_err(sbi, "SIT is corrupted node# %u vs %u",
total_node_blocks, valid_node_count(sbi));
set_sbi_flag(sbi, SBI_NEED_FSCK);
- err = -EINVAL;
+ err = -EFSCORRUPTED;
}
return err;
@@ -4311,7 +4311,7 @@ out:
"Current segment's next free block offset is inconsistent with bitmap, logtype:%u, segno:%u, type:%u, next_blkoff:%u, blkofs:%u",
i, curseg->segno, curseg->alloc_type,
curseg->next_blkoff, blkofs);
- return -EINVAL;
+ return -EFSCORRUPTED;
}
}
return 0;