From: Zhihao Cheng <chengzhihao1@huawei.com>
To: ZhaoLong Wang <wangzhaolong1@huawei.com>, <richard@nod.at>,
<miquel.raynal@bootlin.com>, <vigneshr@ti.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<yi.zhang@huawei.com>
Subject: Re: [PATCH V2 2/5] ubi: Split io_failures into write_failure and erase_failure
Date: Mon, 31 Jul 2023 19:24:47 +0800 [thread overview]
Message-ID: <bb696f09-a89c-1c16-0154-961c4dabfed9@huawei.com> (raw)
In-Reply-To: <20230718085119.3885747-3-wangzhaolong1@huawei.com>
在 2023/7/18 16:51, ZhaoLong Wang 写道:
> The emulate_io_failures debugfs entry controls both write
> failure and erase failure. This patch split io_failures
> to write_failure and erase_failure.
>
> Signed-off-by: ZhaoLong Wang <wangzhaolong1@huawei.com>
> ---
> drivers/mtd/ubi/debug.c | 13 +++++++++----
> drivers/mtd/ubi/debug.h | 14 ++++++++------
> 2 files changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
> index 9ca584da32c6..7826bc8166e8 100644
> --- a/drivers/mtd/ubi/debug.c
> +++ b/drivers/mtd/ubi/debug.c
> @@ -14,7 +14,8 @@
>
> #ifdef CONFIG_MTD_UBI_FAULT_INJECTION
> static DECLARE_FAULT_ATTR(fault_bitflips_attr);
> -static DECLARE_FAULT_ATTR(fault_io_failures_attr);
> +static DECLARE_FAULT_ATTR(fault_write_failure_attr);
> +static DECLARE_FAULT_ATTR(fault_erase_failure_attr);
> static DECLARE_FAULT_ATTR(fault_power_cut_attr);
>
> #define FAIL_ACTION(name, fault_attr) \
> @@ -24,7 +25,8 @@ bool should_fail_##name(void) \
> }
>
> FAIL_ACTION(bitflips, fault_bitflips_attr)
> -FAIL_ACTION(io_failures, fault_io_failures_attr)
> +FAIL_ACTION(write_failure, fault_write_failure_attr)
> +FAIL_ACTION(erase_failure, fault_erase_failure_attr)
> FAIL_ACTION(power_cut, fault_power_cut_attr)
> #endif
>
> @@ -245,8 +247,11 @@ static void dfs_create_fault_entry(struct dentry *parent)
> fault_create_debugfs_attr("emulate_bitflips", dir,
> &fault_bitflips_attr);
>
> - fault_create_debugfs_attr("emulate_io_failures", dir,
> - &fault_io_failures_attr);
> + fault_create_debugfs_attr("emulate_write_failure", dir,
> + &fault_write_failure_attr);
> +
> + fault_create_debugfs_attr("emulate_erase_failure", dir,
> + &fault_erase_failure_attr);
>
> fault_create_debugfs_attr("emulate_power_cut", dir,
> &fault_power_cut_attr);
> diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
> index fc4234c9a90a..6bc698b38e35 100644
> --- a/drivers/mtd/ubi/debug.h
> +++ b/drivers/mtd/ubi/debug.h
> @@ -92,10 +92,12 @@ static inline int ubi_dbg_erase_failure(const struct ubi_device *ubi)
> /* Emulate bit-flips */
> #define MASK_BITFLIPS (1 << 3)
> /* Emulates -EIO during write/erase */
> -#define MASK_IO_FAILURE (1 << 4)
> +#define MASK_WRITE_FAILURE (1 << 4)
> +#define MASK_ERASE_FAILURE (1 << 5)
>
> extern bool should_fail_bitflips(void);
> -extern bool should_fail_io_failures(void);
> +extern bool should_fail_write_failure(void);
> +extern bool should_fail_erase_failure(void);
> extern bool should_fail_power_cut(void);
>
> static inline bool ubi_dbg_fail_bitflip(const struct ubi_device *ubi)
> @@ -107,15 +109,15 @@ static inline bool ubi_dbg_fail_bitflip(const struct ubi_device *ubi)
>
> static inline bool ubi_dbg_fail_write(const struct ubi_device *ubi)
> {
> - if (ubi->dbg.emulate_failures & MASK_IO_FAILURE)
> - return should_fail_io_failures();
> + if (ubi->dbg.emulate_failures & MASK_WRITE_FAILURE)
> + return should_fail_write_failure();
> return false;
> }
>
> static inline bool ubi_dbg_fail_erase(const struct ubi_device *ubi)
> {
> - if (ubi->dbg.emulate_failures & MASK_IO_FAILURE)
> - return should_fail_io_failures();
> + if (ubi->dbg.emulate_failures & MASK_ERASE_FAILURE)
> + return should_fail_erase_failure();
> return false;
> }
>
>
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
next prev parent reply other threads:[~2023-07-31 11:24 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-18 8:51 [PATCH V2 0/5] ubi: Enhanced fault injection capability for the UBI driver ZhaoLong Wang
2023-07-18 8:51 ` [PATCH V2 1/5] ubi: Use the fault injection framework to enhance the fault injection capability ZhaoLong Wang
2023-07-31 11:15 ` Zhihao Cheng
2023-07-18 8:51 ` [PATCH V2 2/5] ubi: Split io_failures into write_failure and erase_failure ZhaoLong Wang
2023-07-31 11:24 ` Zhihao Cheng [this message]
2023-07-18 8:51 ` [PATCH V2 3/5] ubi: Add six fault injection type for testing ZhaoLong Wang
2023-07-31 11:57 ` Zhihao Cheng
2023-07-31 12:09 ` Zhihao Cheng
2023-07-31 12:21 ` Zhihao Cheng
2023-07-18 8:51 ` [PATCH V2 4/5] ubi: Reserve sufficient buffer length for the input mask ZhaoLong Wang
2023-07-31 12:13 ` Zhihao Cheng
2023-07-18 8:51 ` [PATCH V2 5/5] mtd: Add several functions to the fail_function list ZhaoLong Wang
2023-07-31 12:16 ` Zhihao Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bb696f09-a89c-1c16-0154-961c4dabfed9@huawei.com \
--to=chengzhihao1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=wangzhaolong1@huawei.com \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®