diff options
author | Chao Yu <chao@kernel.org> | 2022-09-28 23:38:53 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2022-10-04 13:31:44 -0700 |
commit | a9cfee0ef98e99c8b1951dfd1d57a88580354d0d (patch) | |
tree | 203825dc4c216998dd91f4bdcc4c121d259c9056 /fs/f2fs/super.c | |
parent | f2fs: remove the unnecessary check in f2fs_xattr_fiemap (diff) | |
download | linux-a9cfee0ef98e99c8b1951dfd1d57a88580354d0d.tar.gz linux-a9cfee0ef98e99c8b1951dfd1d57a88580354d0d.tar.bz2 linux-a9cfee0ef98e99c8b1951dfd1d57a88580354d0d.zip |
f2fs: support recording stop_checkpoint reason into super_block
This patch supports to record stop_checkpoint error into
f2fs_super_block.s_stop_reason[].
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/super.c')
-rw-r--r-- | fs/f2fs/super.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index b8e5fe244596..2533d309a924 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -3846,6 +3846,26 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover) return err; } +void f2fs_handle_stop(struct f2fs_sb_info *sbi, unsigned char reason) +{ + struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); + int err; + + f2fs_bug_on(sbi, reason >= MAX_STOP_REASON); + + f2fs_down_write(&sbi->sb_lock); + + if (raw_super->s_stop_reason[reason] < ((1 << BITS_PER_BYTE) - 1)) + raw_super->s_stop_reason[reason]++; + + err = f2fs_commit_super(sbi, false); + if (err) + f2fs_err(sbi, "f2fs_commit_super fails to record reason:%u err:%d", + reason, err); + + f2fs_up_write(&sbi->sb_lock); +} + static int f2fs_scan_devices(struct f2fs_sb_info *sbi) { struct f2fs_super_block *raw_super = F2FS_RAW_SUPER(sbi); |