Skip to content

Commit 6e2d15f

Browse files
wenchao-haomartinkpetersen
authored andcommitted
scsi: scsi_debug: Create scsi_debug directory in the debugfs filesystem
Create directory scsi_debug in the root of the debugfs filesystem. Prepare to add interface for manage error injection. Acked-by: Douglas Gilbert <[email protected]> Signed-off-by: Wenchao Hao <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 0bb80ec commit 6e2d15f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include <linux/random.h>
4242
#include <linux/xarray.h>
4343
#include <linux/prefetch.h>
44+
#include <linux/debugfs.h>
4445

4546
#include <net/checksum.h>
4647

@@ -862,6 +863,8 @@ static const int device_qfull_result =
862863

863864
static const int condition_met_result = SAM_STAT_CONDITION_MET;
864865

866+
static struct dentry *sdebug_debugfs_root;
867+
865868

866869
/* Only do the extra work involved in logical block provisioning if one or
867870
* more of the lbpu, lbpws or lbpws10 parameters are given and we are doing
@@ -7011,6 +7014,10 @@ static int __init scsi_debug_init(void)
70117014
goto driver_unreg;
70127015
}
70137016

7017+
sdebug_debugfs_root = debugfs_create_dir("scsi_debug", NULL);
7018+
if (IS_ERR_OR_NULL(sdebug_debugfs_root))
7019+
pr_info("%s: failed to create initial debugfs directory\n", __func__);
7020+
70147021
for (k = 0; k < hosts_to_add; k++) {
70157022
if (want_store && k == 0) {
70167023
ret = sdebug_add_host_helper(idx);
@@ -7057,6 +7064,7 @@ static void __exit scsi_debug_exit(void)
70577064

70587065
sdebug_erase_all_stores(false);
70597066
xa_destroy(per_store_ap);
7067+
debugfs_remove(sdebug_debugfs_root);
70607068
}
70617069

70627070
device_initcall(scsi_debug_init);

0 commit comments

Comments
 (0)