scsi_debug improvements
Subsystems (2)
v3 cover scsi_debug improvements
Hi Martin,
This patch series fixes a bug in the scsi_debug driver, simplifies the driver and also splits it into two source files. Please consider this patch series for the next merge window.
Thanks,
Bart.
Changes compared to v2:
- Converted a single patch into a patch series.
- Addressed John's comments on the patch that splits the source code into two files.
Changes compared to v1:
- Made the patch description more detailed.
Bart Van Assche (4):
scsi: scsi_debug: Remove a reference to in_use_bm
scsi: scsi_debug: Do not sleep in atomic sections
scsi: scsi_debug: Simplify command handling
scsi: scsi_debug: Make CRC_T10DIF support optional
drivers/scsi/Kconfig | 3 +-
drivers/scsi/Makefile | 2 +
drivers/scsi/scsi_debug_dif.c | 240 +++++++++++
drivers/scsi/scsi_debug_dif.h | 57 +++
.../scsi/{scsi_debug.c => scsi_debug_main.c} | 399 ++----------------
5 files changed, 333 insertions(+), 368 deletions(-)
create mode 100644 drivers/scsi/scsi_debug_dif.c
create mode 100644 drivers/scsi/scsi_debug_dif.h
rename drivers/scsi/{scsi_debug.c => scsi_debug_main.c} (96%)PATCH v3 1/4 scsi: scsi_debug: Remove a reference to in_use_bm
Commit f1437cd1e535 ("scsi: scsi_debug: Drop sdebug_queue") removed the 'in_use_bm' struct member. Hence remove a reference to that struct member from the procfs host info file.
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_debug.c +1 -1
@@ -6516,7 +6516,7 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host)blk_mq_tagset_busy_iter (&host->tag_set, sdebug_submit_queue_iter, &data);if (f >=0 ) { -seq_printf (m," in_use_bm BUSY: %s: %d,%d\n" , +seq_printf (m," BUSY: %s: %d,%d\n" ,"first,last bits" , f, l); } }
Re: [PATCH v3 1/4] scsi: scsi_debug: Remove a reference to in_use_bm
Quoted 8 lines · Bart Van Assche
Commit
f1437cd1e535("scsi:scsi_debug: Dropsdebug_queue") removed the 'in_use_bm' struct member. Hence remove a reference to that struct member from the procfs host info file.Cc Douglas Gilbert<[email protected]>Cc John Garry<[email protected]>Fixes f1437cd1e535 ("scsi: scsi_debug: Drop sdebug_queue")Signed-off-by Bart Van Assche<[email protected]>
Quoted 9 lines
--- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/scsi/scsi_debug.c +0
-0
drivers/scsi/scsi_debug.c static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host) · line 6520
Quoted 6 lines
drivers/scsi/scsi_debug.c +1
-1@@ -6516,7 +6516,7 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host)blk_mq_tagset_busy_iter (&host->tag_set, sdebug_submit_queue_iter, &data);if (f >=0 ) { -seq_printf (m," in_use_bm BUSY: %s: %d,%d\n" , +seq_printf (m," BUSY: %s: %d,%d\n" ,"first,last bits" , f, l);
maybe this can fit on a single line now without exceeding 80 char (which some people still want - I don't mind).
Thanks,
John
Re: [PATCH v3 1/4] scsi: scsi_debug: Remove a reference to in_use_bm
Quoted 16 lines · John Garry
Quoted 8 lines · Bart Van Assche
Commit
f1437cd1e535("scsi:scsi_debug: Dropsdebug_queue") removed the 'in_use_bm' struct member. Hence remove a reference to that struct member from the procfs host info file.Cc Douglas Gilbert<[email protected]>Cc John Garry<[email protected]>Fixes f1437cd1e535 ("scsi: scsi_debug: Drop sdebug_queue")Signed-off-by Bart Van Assche<[email protected]>Reviewed-by John Garry <[email protected]>Quoted 4 lines
---
drivers/scsi/scsi_debug.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/scsi/scsi_debug.c static int scsi_debug_show_info(struct seq_file · line 6521
Quoted 12 lines
drivers/scsi/scsi_debug.c +1
-1@@ -6516,7 +6516,7 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host) blk_mq_tagset_busy_iter(&host->tag_set, sdebug_submit_queue_iter, &data); if (f >= 0) { - seq_printf(m, " in_use_bm BUSY: %s: %d,%d\n", + seq_printf(m, " BUSY: %s: %d,%d\n", "first,last bits", f, l);maybe this can fit on a single line now without exceeding 80 char (which some people still want - I don't mind).
The most compact version of this patch I can come up with is the following:
@@ -6384,8 +6384,8 @@ static int scsi_debug_show_info(struct seq_file *m, struct Scsi_Host *host)
blk_mq_tagset_busy_iter(&host->tag_set, sdebug_submit_queue_iter,
&data);
if (f >= 0) {
- seq_printf(m, " in_use_bm BUSY: %s: %d,%d\n",
- "first,last bits", f, l);
+ seq_printf(m, " BUSY: first,last bits: %d,%d\n", f,
+ l);
}
}
Thanks,
Bart.
PATCH v3 2/4 scsi: scsi_debug: Do not sleep in atomic sections
In reply to Bart Van Asschestop_qc_helper() is called while a spinlock is held. cancel_work_sync() may sleep. Sleeping in atomic sections is not allowed. Hence change the cancel_work_sync() call into a cancel_work() call.
--- drivers/scsi/scsi_debug.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/scsi/scsi_debug.c +3 -6
@@ -5648,7 +5648,7 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp) sdp->hostdata =NULL ; } -/* Returns true if we require the queued memory to be freed by the caller. */ +/* Returns true if the queued command memory should be freed by the caller. */ static bool stop_qc_helper (struct sdebug_defer *sd_dp,enum sdeb_defer_type defer_t) {
@@ -5664,11 +5664,8 @@ static bool stop_qc_helper(struct sdebug_defer *sd_dp,return true; } }else if (defer_t ==SDEB_DEFER_WQ ) { -/* Cancel if pending */ -if (cancel_work_sync (&sd_dp->ew.work)) -return true; -/* Was not pending, so it must have run */ -return false; +/* The caller must free qcmd if cancellation succeeds. */ +return cancel_work (&sd_dp->ew.work); }else if (defer_t ==SDEB_DEFER_POLL ) {return true; }
Re: [PATCH v3 2/4] scsi: scsi_debug: Do not sleep in atomic sections
Quoted 27 lines · Bart Van Assche
stop_qc_helper()is called while a spinlock is held.cancel_work_sync()may sleep. Sleeping in atomic sections is not allowed. Hence change thecancel_work_sync()call into acancel_work()call.Cc Douglas Gilbert <[email protected]>Cc John Garry <[email protected]>Fixes 1107c7b24ee3 ("scsi: scsi_debug: Dynamically allocate sdebug_queued_cmd")Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/scsi_debug.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)drivers/scsi/scsi_debug.c +1
-1@@ -5648,7 +5648,7 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp) sdp->hostdata =NULL ; } -/* Returns true if we require the queued memory to be freed by the caller. */ +/* Returns true if the queued command memory should be freed by the caller. */ static bool stop_qc_helper (struct sdebug_defer *sd_dp,enum sdeb_defer_type defer_t) {
drivers/scsi/scsi_debug.c static bool stop_qc_helper(struct sdebug_defer *sd_dp, · line 5667
Quoted 9 lines
drivers/scsi/scsi_debug.c +1
-5@@ -5664,11 +5664,8 @@ static bool stop_qc_helper(struct sdebug_defer *sd_dp,return true; } }else if (defer_t ==SDEB_DEFER_WQ ) { -/* Cancel if pending */ -if (cancel_work_sync (&sd_dp->ew.work)) -return true; -/* Was not pending, so it must have run */ -return false; +/* The caller must free qcmd if cancellation succeeds. */
We were relying on the work CB not running or runnable when we return from this function, and that is why there is cancel_work_sync() [which is obviously bad under a spinlock]
Otherwise, sdebug_q_cmd_wq_complete() -> sdebug_q_cmd_wq_complete() may be running and reference the scsi_cmnd - that should not be done, because...
Checking the comment on scsi_try_to_abort_cmd(), it reads:
" SUCCESS ... indicates that the LLDDs has cleared all references to that command"
So, if we change to cancel_work(), we really should ensure scsi_debug_abort() -> scsi_debug_abort_cmnd() returns FALSE/FAILED to upper layer for when cancel_work() returns false. Effectively the (!sqcp) check in scsi_debug_stop_cmnd() checks for already run or not even queued. However, we still need to consider when the WQ callback is running.
Cheers,
John
PATCH v3 3/4 scsi: scsi_debug: Simplify command handling
In reply to Bart Van AsscheSimplify command handling by moving struct sdebug_defer into the private SCSI command data instead of allocating it separately. The only functional change is that aborting a SCSI command now fails and is retried at a later time if the completion handler can't be cancelled.
See also commit 1107c7b24ee3 ("scsi: scsi_debug: Dynamically allocate sdebug_queued_cmd"; v6.4).
--- drivers/scsi/scsi_debug.c | 140 +++++++------------------------------- 1 file changed, 26 insertions(+), 114 deletions(-)
drivers/scsi/scsi_debug.c +26 -114
@@ -253,11 +253,6 @@ static const char *sdebug_version_date = "20210520";#define SDEB_XA_NOT_IN_USE XA_MARK_1 -static struct kmem_cache *queued_cmd_cache; - -#define TO_QUEUED_CMD (scmd) ((void *)(scmd)->host_scribble) -#define ASSIGN_QUEUED_CMD (scmnd, qc) { (scmnd)->host_scribble = (void *) qc; } -/* Zone types (zbcr05 table 25) */ enum sdebug_z_type {ZBC_ZTYPE_CNV =0x1 ,
@@ -398,16 +393,9 @@ struct sdebug_defer {enum sdeb_defer_type defer_t; }; -struct sdebug_queued_cmd { -/* corresponding bit set in in_use_bm[] in owning struct sdebug_queue -* instance indicates this slot is in use. -*/ -struct sdebug_defer sd_dp; -struct scsi_cmnd *scmd; -}; -struct sdebug_scsi_cmd {spinlock_t lock; +struct sdebug_defer sd_dp; };static atomic_t sdebug_cmnd_count;/* number of incoming commands */
@@ -559,8 +547,6 @@ static int sdebug_add_store(void);static void sdebug_erase_store (int idx,struct sdeb_store_info *sip);static void sdebug_erase_all_stores (bool apart_from_first); -static void sdebug_free_queued_cmd (struct sdebug_queued_cmd *sqcp); -/* * The following are overflow arrays for cdbs that "hit" the same index in * the opcode_info_arr array. The most time sensitive (or commonly used) cdb
@@ -5332,10 +5318,9 @@ static u32 get_tag(struct scsi_cmnd *cmnd)/* Queued (deferred) command completions converge here. */ static void sdebug_q_cmd_complete (struct sdebug_defer *sd_dp) { - struct sdebug_queued_cmd *sqcp = container_of(sd_dp, struct sdebug_queued_cmd, sd_dp); +struct sdebug_scsi_cmd *sdsc =container_of (sd_dp,typeof (*sdsc), sd_dp); +struct scsi_cmnd *scp = (struct scsi_cmnd *)sdsc -1 ;unsigned long flags; -struct scsi_cmnd *scp = sqcp->scmd; -struct sdebug_scsi_cmd *sdsc;bool aborted;if (sdebug_statistics) {
@@ -5346,7 +5331,7 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp)if (!scp) {pr_err ("scmd=NULL\n" ); - goto out; +return ; } sdsc =scsi_cmd_priv (scp);
@@ -5354,19 +5339,16 @@ static void sdebug_q_cmd_complete(struct sdebug_defer *sd_dp) aborted = sd_dp->aborted;if (unlikely (aborted)) sd_dp->aborted = false; -ASSIGN_QUEUED_CMD (scp,NULL );spin_unlock_irqrestore (&sdsc->lock, flags);if (aborted) {pr_info ("bypassing scsi_done() due to aborted cmd, kicking-off EH\n" );blk_abort_request (scsi_cmd_to_rq (scp)); - goto out; +return ; }scsi_done (scp);/* callback to mid level */ -out: -sdebug_free_queued_cmd (sqcp); }/* When high resolution timer goes off this function is called. */
@@ -5648,50 +5630,32 @@ static void scsi_debug_slave_destroy(struct scsi_device *sdp) sdp->hostdata =NULL ; } -/* Returns true if the queued command memory should be freed by the caller. */ -static bool stop_qc_helper (struct sdebug_defer *sd_dp, -enum sdeb_defer_type defer_t) +/* Returns true if it is safe to complete @cmnd. */ +static bool scsi_debug_stop_cmnd (struct scsi_cmnd *cmnd) { +struct sdebug_scsi_cmd *sdsc =scsi_cmd_priv (cmnd); +struct sdebug_defer *sd_dp = &sdsc->sd_dp; +enum sdeb_defer_type defer_t =READ_ONCE (sd_dp->defer_t); + +lockdep_assert_held (&sdsc->lock); +if (defer_t ==SDEB_DEFER_HRT ) {int res =hrtimer_try_to_cancel (&sd_dp->hrt);switch (res) { -case 0 :/* Not active, it must have already run */ case -1 :/* -1 It's executing the CB */ return false; +case 0 :/* Not active, it must have already run */ case 1 :/* Was active, we've now cancelled */ default :return true; } }else if (defer_t ==SDEB_DEFER_WQ ) { -/* The caller must free qcmd if cancellation succeeds. */ -return cancel_work (&sd_dp->ew.work); - }else if (defer_t ==SDEB_DEFER_POLL ) { -return true; +/* Retry aborting later if the completion handler is running. */ +return cancel_work (&sd_dp->ew.work) || + !work_pending (&sd_dp->ew.work); } -return false; -} - - -static bool scsi_debug_stop_cmnd (struct scsi_cmnd *cmnd) -{ -enum sdeb_defer_type l_defer_t; -struct sdebug_defer *sd_dp; -struct sdebug_scsi_cmd *sdsc =scsi_cmd_priv (cmnd); -struct sdebug_queued_cmd *sqcp =TO_QUEUED_CMD (cmnd); - -lockdep_assert_held (&sdsc->lock); - -if (!sqcp) -return false; - sd_dp = &sqcp->sd_dp; - l_defer_t =READ_ONCE (sd_dp->defer_t); -ASSIGN_QUEUED_CMD (cmnd,NULL ); - -if (stop_qc_helper (sd_dp, l_defer_t)) -sdebug_free_queued_cmd (sqcp); -return true; }
@@ -5706,6 +5670,8 @@ static bool scsi_debug_abort_cmnd(struct scsi_cmnd *cmnd)spin_lock_irqsave (&sdsc->lock, flags); res =scsi_debug_stop_cmnd (cmnd); +if (res) +WRITE_ONCE (sdsc->sd_dp.defer_t,SDEB_DEFER_NONE );spin_unlock_irqrestore (&sdsc->lock, flags);return res;
@@ -5783,7 +5749,7 @@ static int scsi_debug_abort(struct scsi_cmnd *SCpnt)return FAILED ; } -return SUCCESS ; +return ok ?SUCCESS :FAILED ; }static bool scsi_debug_stop_all_queued_iter (struct request *rq,void *data)
@@ -6056,33 +6022,6 @@ static bool inject_on_this_cmd(void)#define INCLUSIVE_TIMING_MAX_NS 1000000/* 1 millisecond */ - -void sdebug_free_queued_cmd (struct sdebug_queued_cmd *sqcp) -{ -if (sqcp) -kmem_cache_free (queued_cmd_cache, sqcp); -} - -static struct sdebug_queued_cmd *sdebug_alloc_queued_cmd (struct scsi_cmnd *scmd) -{ -struct sdebug_queued_cmd *sqcp; -struct sdebug_defer *sd_dp; - - sqcp =kmem_cache_zalloc (queued_cmd_cache,GFP_ATOMIC ); -if (!sqcp) -return NULL ; - - sd_dp = &sqcp->sd_dp; - -hrtimer_init (&sd_dp->hrt,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_PINNED ); - sd_dp->hrt.function = sdebug_q_cmd_hrt_complete; -INIT_WORK (&sd_dp->ew.work, sdebug_q_cmd_wq_complete); - - sqcp->scmd = scmd; - -return sqcp; -} -/* Complete the processing of the thread that queued a SCSI command to this * driver. It either completes the command by calling cmnd_done() or * schedules a hr timer or work queue then returns 0. Returns
@@ -6099,7 +6038,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,struct sdebug_scsi_cmd *sdsc =scsi_cmd_priv (cmnd);unsigned long flags;u64 ns_from_boot =0 ; -struct sdebug_queued_cmd *sqcp;struct scsi_device *sdp;struct sdebug_defer *sd_dp;
@@ -6131,12 +6069,7 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, } } - sqcp =sdebug_alloc_queued_cmd (cmnd); -if (!sqcp) { -pr_err ("%s no alloc\n" , __func__); -return SCSI_MLQUEUE_HOST_BUSY ; - } - sd_dp = &sqcp->sd_dp; + sd_dp = &sdsc->sd_dp;if (polled) ns_from_boot =ktime_get_boottime_ns ();
@@ -6184,7 +6117,6 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,if (kt <= d) {/* elapsed duration >= kt */ /* call scsi_done() from this thread */ -sdebug_free_queued_cmd (sqcp);scsi_done (cmnd);return 0 ; }
@@ -6197,13 +6129,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip,if (polled) {spin_lock_irqsave (&sdsc->lock, flags); sd_dp->cmpl_ts =ktime_add (ns_to_ktime (ns_from_boot), kt); -ASSIGN_QUEUED_CMD (cmnd, sqcp);WRITE_ONCE (sd_dp->defer_t,SDEB_DEFER_POLL );spin_unlock_irqrestore (&sdsc->lock, flags); }else {/* schedule the invocation of scsi_done() for a later time */ spin_lock_irqsave (&sdsc->lock, flags); -ASSIGN_QUEUED_CMD (cmnd, sqcp);WRITE_ONCE (sd_dp->defer_t,SDEB_DEFER_HRT );hrtimer_start (&sd_dp->hrt, kt,HRTIMER_MODE_REL_PINNED );/*
@@ -6227,13 +6157,11 @@ static int schedule_resp(struct scsi_cmnd *cmnd, struct sdebug_dev_info *devip, sd_dp->issuing_cpu =raw_smp_processor_id ();if (polled) {spin_lock_irqsave (&sdsc->lock, flags); -ASSIGN_QUEUED_CMD (cmnd, sqcp); sd_dp->cmpl_ts =ns_to_ktime (ns_from_boot);WRITE_ONCE (sd_dp->defer_t,SDEB_DEFER_POLL );spin_unlock_irqrestore (&sdsc->lock, flags); }else {spin_lock_irqsave (&sdsc->lock, flags); -ASSIGN_QUEUED_CMD (cmnd, sqcp);WRITE_ONCE (sd_dp->defer_t,SDEB_DEFER_WQ );schedule_work (&sd_dp->ew.work);spin_unlock_irqrestore (&sdsc->lock, flags);
@@ -7587,12 +7515,6 @@ static int __init scsi_debug_init(void) hosts_to_add = sdebug_add_host; sdebug_add_host =0 ; - queued_cmd_cache =KMEM_CACHE (sdebug_queued_cmd,SLAB_HWCACHE_ALIGN ); -if (!queued_cmd_cache) { - ret = -ENOMEM ; - goto driver_unreg; - } - sdebug_debugfs_root =debugfs_create_dir ("scsi_debug" ,NULL );if (IS_ERR_OR_NULL (sdebug_debugfs_root))pr_info ("%s: failed to create initial debugfs directory\n" , __func__);
@@ -7619,8 +7541,6 @@ static int __init scsi_debug_init(void)return 0 ; -driver_unreg: -driver_unregister (&sdebug_driverfs_driver); bus_unreg:bus_unregister (&pseudo_lld_bus); dev_unreg:
@@ -7636,7 +7556,6 @@ static void __exit scsi_debug_exit(void)for (; k; k--)sdebug_do_remove_host (true); -kmem_cache_destroy (queued_cmd_cache);driver_unregister (&sdebug_driverfs_driver);bus_unregister (&pseudo_lld_bus);root_device_unregister (pseudo_primary);
@@ -8018,7 +7937,6 @@ static bool sdebug_blk_mq_poll_iter(struct request *rq, void *opaque)struct sdebug_defer *sd_dp;u32 unique_tag =blk_mq_unique_tag (rq);u16 hwq =blk_mq_unique_tag_to_hwq (unique_tag); -struct sdebug_queued_cmd *sqcp;unsigned long flags;int queue_num = data->queue_num;ktime_t time;
@@ -8034,13 +7952,7 @@ static bool sdebug_blk_mq_poll_iter(struct request *rq, void *opaque) time =ktime_get_boottime ();spin_lock_irqsave (&sdsc->lock, flags); - sqcp =TO_QUEUED_CMD (cmd); -if (!sqcp) { -spin_unlock_irqrestore (&sdsc->lock, flags); -return true; - } - - sd_dp = &sqcp->sd_dp; + sd_dp = &sdsc->sd_dp;if (READ_ONCE (sd_dp->defer_t) !=SDEB_DEFER_POLL ) {spin_unlock_irqrestore (&sdsc->lock, flags);return true;
@@ -8050,8 +7962,6 @@ static bool sdebug_blk_mq_poll_iter(struct request *rq, void *opaque)spin_unlock_irqrestore (&sdsc->lock, flags);return true; } - -ASSIGN_QUEUED_CMD (cmd,NULL );spin_unlock_irqrestore (&sdsc->lock, flags);if (sdebug_statistics) {
@@ -8060,8 +7970,6 @@ static bool sdebug_blk_mq_poll_iter(struct request *rq, void *opaque)atomic_inc (&sdebug_miss_cpus); } -sdebug_free_queued_cmd (sqcp); -scsi_done (cmd);/* callback to mid level */ (*data->num_entries)++;return true;
@@ -8376,8 +8284,12 @@ static int scsi_debug_queuecommand(struct Scsi_Host *shost,static int sdebug_init_cmd_priv (struct Scsi_Host *shost,struct scsi_cmnd *cmd) {struct sdebug_scsi_cmd *sdsc =scsi_cmd_priv (cmd); +struct sdebug_defer *sd_dp = &sdsc->sd_dp;spin_lock_init (&sdsc->lock); +hrtimer_init (&sd_dp->hrt,CLOCK_MONOTONIC ,HRTIMER_MODE_REL_PINNED ); + sd_dp->hrt.function = sdebug_q_cmd_hrt_complete; +INIT_WORK (&sd_dp->ew.work, sdebug_q_cmd_wq_complete);return 0 ; }
PATCH v3 4/4 scsi: scsi_debug: Make CRC_T10DIF support optional
In reply to Bart Van AsscheNot all scsi_debug users need data integrity support. Hence modify the scsi_debug driver such that it becomes possible to build this driver without data integrity support. The changes in this patch are as follows:
- Split the scsi_debug source code into two files without modifying any functionality.
- Instead of selecting CRC_T10DIF no matter how the scsi_debug driver is built, only select CRC_T10DIF if the scsi_debug driver is built-in to the kernel.
---
drivers/scsi/Kconfig | 3 +-
drivers/scsi/Makefile | 2 +
drivers/scsi/scsi_debug_dif.c | 240 +++++++++++++++++
drivers/scsi/scsi_debug_dif.h | 57 ++++
.../scsi/{scsi_debug.c => scsi_debug_main.c} | 254 +-----------------
5 files changed, 306 insertions(+), 250 deletions(-)
create mode 100644 drivers/scsi/scsi_debug_dif.c
create mode 100644 drivers/scsi/scsi_debug_dif.h
rename drivers/scsi/{scsi_debug.c => scsi_debug_main.c} (97%)drivers/scsi/Kconfig +1 -2
@@ -1226,8 +1226,7 @@ config SCSI_WD719X config SCSI_DEBUG tristate "SCSI debugging host and device simulator" - depends on SCSI - select CRC_T10DIF + depends on SCSI && (m || CRC_T10DIF = y) help This pseudo driver simulates one or more hosts (SCSI initiators), each with one or more targets, each with one or more logical units.
drivers/scsi/Makefile +2 -0
@@ -156,6 +156,8 @@ obj-$(CONFIG_SCSI_HISI_SAS) += hisi_sas/ # This goes last, so that "real" scsi devices probe earlier obj-$(CONFIG_SCSI_DEBUG) += scsi_debug.o +scsi_debug-y += scsi_debug_main.o +scsi_debug-$(CONFIG_CRC_T10DIF) += scsi_debug_dif.o scsi_mod-y += scsi.o hosts.o scsi_ioctl.o \ scsicam.o scsi_error.o scsi_lib.o scsi_mod-$(CONFIG_SCSI_CONSTANTS) += constants.o
drivers/scsi/scsi_debug_dif.c new file +240 -0
240 lines not on this page · raw message
drivers/scsi/scsi_debug_dif.h new file +57 -0
57 lines not on this page · raw message
drivers/scsi/scsi_debug_main.c renamed from drivers/scsi/scsi_debug.c +6 -248
362 lines not on this page · raw message