diff options
author | Chao Yu <yuchao0@huawei.com> | 2019-04-22 20:22:36 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2019-05-08 21:23:12 -0700 |
commit | f824deb54b683165b953371a0529446c723ef6d6 (patch) | |
tree | f2fa33f3cc0b3e10d8c50acb2eed730c5191f223 /fs/f2fs/f2fs.h | |
parent | b471eb99e64495a1f0e430da3f96b88f600d3bb5 (diff) | |
download | linux-stable-f824deb54b683165b953371a0529446c723ef6d6.tar.gz linux-stable-f824deb54b683165b953371a0529446c723ef6d6.tar.bz2 linux-stable-f824deb54b683165b953371a0529446c723ef6d6.zip |
f2fs: fix to consider multiple device for readonly check
This patch introduce f2fs_hw_is_readonly() to check whether lower
device is readonly or not, it adapts multiple device scenario.
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs/f2fs.h')
-rw-r--r-- | fs/f2fs/f2fs.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 97e4ef71de64..1c814a309748 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -3609,6 +3609,20 @@ static inline bool f2fs_realtime_discard_enable(struct f2fs_sb_info *sbi) f2fs_hw_should_discard(sbi); } +static inline bool f2fs_hw_is_readonly(struct f2fs_sb_info *sbi) +{ + int i; + + if (!f2fs_is_multi_device(sbi)) + return bdev_read_only(sbi->sb->s_bdev); + + for (i = 0; i < sbi->s_ndevs; i++) + if (bdev_read_only(FDEV(i).bdev)) + return true; + return false; +} + + static inline void set_opt_mode(struct f2fs_sb_info *sbi, unsigned int mt) { clear_opt(sbi, ADAPTIVE); |