[PATCH 5/7] staging: erofs: introduce a new helper erofs_get_fault_rate()
Chengguang Xu
cgxu519 at gmx.com
Wed Sep 12 15:10:32 AEST 2018
Introduce a new helper for getting fault rate, so that we
don't have to check macro in calling place.
Signed-off-by: Chengguang Xu <cgxu519 at gmx.com>
---
drivers/staging/erofs/super.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c
index 8df680aee55a..a6ae60564c65 100644
--- a/drivers/staging/erofs/super.c
+++ b/drivers/staging/erofs/super.c
@@ -144,6 +144,11 @@ char *erofs_fault_name[FAULT_MAX] = {
[FAULT_KMALLOC] = "kmalloc",
};
+static unsigned int erofs_get_fault_rate(struct erofs_sb_info *sbi)
+{
+ return sbi->fault_info.inject_rate;
+}
+
static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
unsigned int rate)
{
@@ -173,6 +178,11 @@ static int erofs_build_fault_attr(struct erofs_sb_info *sbi,
return 0;
}
#else
+static unsigned int erofs_get_fault_rate(struct erofs_sb_info *sbi)
+{
+ return 0;
+}
+
static void __erofs_build_fault_attr(struct erofs_sb_info *sbi,
unsigned int rate)
{
--
2.17.1
More information about the Linux-erofs
mailing list