summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChengguang Xu <cgxu519@gmx.com>2018-09-19 22:53:45 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-20 12:26:29 +0200
commit2ab3dd84c0a1a0a7fc5ef2d893fb2612086bc94f (patch)
treedeca050f099b3ac5fa9add086485f6f50cdde353 /drivers
parent01e4ae4b687fad12fa00ebf0bc0723f1fbbeec30 (diff)
downloadlinux-stable-2ab3dd84c0a1a0a7fc5ef2d893fb2612086bc94f.tar.gz
linux-stable-2ab3dd84c0a1a0a7fc5ef2d893fb2612086bc94f.tar.bz2
linux-stable-2ab3dd84c0a1a0a7fc5ef2d893fb2612086bc94f.zip
staging: erofs: code cleanup for erofs_show_options()
Add new helper erofs_get_fault_rate() to get fault rate instead of directly getting it from sbi, so we can remove the macro check surrounding it. Signed-off-by: Chengguang Xu <cgxu519@gmx.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Reviewed-by: Gao Xiang <gaoxiang25@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/erofs/super.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index b4d33a71ec5f..d5a6106b5897 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -165,6 +165,11 @@ static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
set_opt(sbi, FAULT_INJECTION);
return 0;
}
+
+static unsigned int erofs_get_fault_rate(struct erofs_sb_info *sbi)
+{
+ return sbi->fault_info.inject_rate;
+}
#else
static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
substring_t *args)
@@ -172,6 +177,11 @@ static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
infoln("fault_injection options not supported");
return 0;
}
+
+static unsigned int erofs_get_fault_rate(struct erofs_sb_info *sbi)
+{
+ return 0;
+}
#endif
static void default_options(struct erofs_sb_info *sbi)
@@ -631,11 +641,9 @@ static int erofs_show_options(struct seq_file *seq, struct dentry *root)
else
seq_puts(seq, ",noacl");
#endif
-#ifdef CONFIG_EROFS_FAULT_INJECTION
if (test_opt(sbi, FAULT_INJECTION))
seq_printf(seq, ",fault_injection=%u",
- sbi->fault_info.inject_rate);
-#endif
+ erofs_get_fault_rate(sbi));
return 0;
}