Skip to content

Commit f91a800

Browse files
bvanasschekawasaki
authored andcommitted
scsi: scsi_debug: Add the preserves_write_order module parameter
Zone write locking is not used for zoned devices if the block driver reports that it preserves the order of write commands. Make it easier to test not using zone write locking by adding support for setting the driver_preserves_write_order flag. Acked-by: Douglas Gilbert <dgilbert@interlog.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> Cc: Martin K. Petersen <martin.petersen@oracle.com> Cc: Christoph Hellwig <hch@lst.de> Cc: Ming Lei <ming.lei@redhat.com> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
1 parent 59fd0b9 commit f91a800

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/scsi/scsi_debug.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ static int dix_reads;
10041004
static int dif_errors;
10051005

10061006
/* ZBC global data */
1007+
static bool sdeb_preserves_write_order;
10071008
static bool sdeb_zbc_in_use; /* true for host-aware and host-managed disks */
10081009
static int sdeb_zbc_zone_cap_mb;
10091010
static int sdeb_zbc_zone_size_mb;
@@ -6607,10 +6608,15 @@ static struct sdebug_dev_info *find_build_dev_info(struct scsi_device *sdev)
66076608

66086609
static int scsi_debug_sdev_init(struct scsi_device *sdp)
66096610
{
6611+
struct request_queue *q = sdp->request_queue;
6612+
66106613
if (sdebug_verbose)
66116614
pr_info("sdev_init <%u %u %u %llu>\n",
66126615
sdp->host->host_no, sdp->channel, sdp->id, sdp->lun);
66136616

6617+
if (sdeb_preserves_write_order)
6618+
q->limits.features |= BLK_FEAT_ORDERED_HWQ;
6619+
66146620
return 0;
66156621
}
66166622

@@ -7339,6 +7345,8 @@ module_param_named(statistics, sdebug_statistics, bool, S_IRUGO | S_IWUSR);
73397345
module_param_named(strict, sdebug_strict, bool, S_IRUGO | S_IWUSR);
73407346
module_param_named(submit_queues, submit_queues, int, S_IRUGO);
73417347
module_param_named(poll_queues, poll_queues, int, S_IRUGO);
7348+
module_param_named(preserves_write_order, sdeb_preserves_write_order, bool,
7349+
S_IRUGO);
73427350
module_param_named(tur_ms_to_ready, sdeb_tur_ms_to_ready, int, S_IRUGO);
73437351
module_param_named(unmap_alignment, sdebug_unmap_alignment, int, S_IRUGO);
73447352
module_param_named(unmap_granularity, sdebug_unmap_granularity, int, S_IRUGO);
@@ -7411,6 +7419,8 @@ MODULE_PARM_DESC(opts, "1->noise, 2->medium_err, 4->timeout, 8->recovered_err...
74117419
MODULE_PARM_DESC(per_host_store, "If set, next positive add_host will get new store (def=0)");
74127420
MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)");
74137421
MODULE_PARM_DESC(poll_queues, "support for iouring iopoll queues (1 to max(submit_queues - 1))");
7422+
MODULE_PARM_DESC(preserves_write_order,
7423+
"Whether or not to inform the block layer that this driver preserves the order of WRITE commands (def=0)");
74147424
MODULE_PARM_DESC(ptype, "SCSI peripheral type(def=0[disk])");
74157425
MODULE_PARM_DESC(random, "If set, uniformly randomize command duration between 0 and delay_in_ns");
74167426
MODULE_PARM_DESC(removable, "claim to have removable media (def=0)");

0 commit comments

Comments
 (0)