Recommand · October 14, 2021 0

Outstanding commands are half what the device driver supports

I’m writing a SCSI driver that supports queue-depth of 32.
The driver sets the can_queue and cmd_per_lun in the template and in the Scsi_Host
also the scsi_change_queue_depth is called to set the expected queue depth.

After the driver is inserted into kernel the following values are seen:

  • /sys/block/sdb/device/queue_depth : 32
  • /sys/block/sdb/queue/nr_requests : 64

When I use iometer or any other tool to submit multiple commands to /dev/sdb only 16 outstanding requests are submitted by the block layer.

If I modified the driver to support 64 queue-depth, the block layer submits 32 outstanding commands only

  • /sys/block/sdb/device/queue_depth : 64
  • /sys/block/sdb/queue/nr_requests : 128

So it looks like the block layer submits half what the driver reports as a supported queue-depth.
I appreciate any help on this.