Re: [RFC v2 1/3] nvme: move fault injector to nvme-debugfs.c

Pankaj Raghav
2023-03-27T11:08:41Z

Could we still retain the fault_inject.c code to avoid #ifdef for the fault_inject
code in debugfs.c?

We have two options:
- We could have both fault_inject.c and nvme-debugfs.c. Move the fault inject code from
nvme-debugfs.c to fault_inject.c so that we get rid of #ifdefs from nvme-debugfs.c.

- As the code for nvme-debugfs.c itself is not a lot (just 3 small functions including the next
patch) apart from the fault_inject code, we could move them to the header with the appropriate
#ifdefs and conditionally link the fault_inject.c code as before.

Let me know what you think.

--
Pankaj

On 2023-03-24 00:03, Alan Adamson wrote:
> Move the nvme fault injector code associated with debugfs into
> nvme-debugfs.c (new file) so all nvme debugfs associated can
> reside in a common place.
>
> CONFIG_NVME_FAULT_INJECTION_DEBUG_FS needs to be enabled to
> be able to use fault injection.
>
> Signed-off-by: Alan Adamson <alan.adamson@oracle.com>
> ---
> drivers/nvme/host/Kconfig | 6 ++
> drivers/nvme/host/Makefile | 2 +-
> drivers/nvme/host/core.c | 11 ++--
> .../host/{fault_inject.c => nvme-debugfs.c} | 56 +++++++++----------
> drivers/nvme/host/nvme.h | 31 +++++-----
> 5 files changed, 59 insertions(+), 47 deletions(-)
> rename drivers/nvme/host/{fault_inject.c => nvme-debugfs.c} (60%)
>