Skip to content

Commit 68f0453

Browse files
chaseyuJaegeuk Kim
authored andcommitted
f2fs: use f2fs_hw_is_readonly() instead of bdev_read_only()
f2fs has supported multi-device feature, to check devices' rw status, it should use f2fs_hw_is_readonly() rather than bdev_read_only(), fix it. Meanwhile, it removes f2fs_hw_is_readonly() check condition in: - f2fs_write_checkpoint() - f2fs_convert_inline_inode() As it has checked f2fs_readonly() condition, and if f2fs' devices were readonly, f2fs_readonly() must be true. Signed-off-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
1 parent 0c9f452 commit 68f0453

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

fs/f2fs/checkpoint.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@ int f2fs_recover_orphan_inodes(struct f2fs_sb_info *sbi)
715715
if (!is_set_ckpt_flags(sbi, CP_ORPHAN_PRESENT_FLAG))
716716
return 0;
717717

718-
if (bdev_read_only(sbi->sb->s_bdev)) {
718+
if (f2fs_hw_is_readonly(sbi)) {
719719
f2fs_info(sbi, "write access unavailable, skipping orphan cleanup");
720720
return 0;
721721
}

fs/f2fs/super.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3274,7 +3274,7 @@ static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi,
32743274
raw_super->segment_count = cpu_to_le32((main_end_blkaddr -
32753275
segment0_blkaddr) >> log_blocks_per_seg);
32763276

3277-
if (f2fs_readonly(sb) || bdev_read_only(sb->s_bdev)) {
3277+
if (f2fs_readonly(sb) || f2fs_hw_is_readonly(sbi)) {
32783278
set_sbi_flag(sbi, SBI_NEED_SB_WRITE);
32793279
res = "internally";
32803280
} else {
@@ -3850,7 +3850,7 @@ int f2fs_commit_super(struct f2fs_sb_info *sbi, bool recover)
38503850
int err;
38513851

38523852
if ((recover && f2fs_readonly(sbi->sb)) ||
3853-
bdev_read_only(sbi->sb->s_bdev)) {
3853+
f2fs_hw_is_readonly(sbi)) {
38543854
set_sbi_flag(sbi, SBI_NEED_SB_WRITE);
38553855
return -EROFS;
38563856
}

0 commit comments

Comments
 (0)