On 11/18/19 1:22 AM, Hannes Reinecke wrote:
+/** + * scsi_host_flush_commands -- Terminate all running commands + * @shost: Scsi Host on which commands should be terminated + * @status: Status to be set for the terminated commands + */ +static bool flush_cmds_iter(struct request *rq, void *data, bool reserved) +{ + struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq); + int status = *(int *)data; + + if (reserved) + return true; + scmd->result = status << 16; + scmd->scsi_done(scmd); + return true; +} + +void scsi_host_flush_commands(struct Scsi_Host *shost, int status) +{ + blk_mq_tagset_busy_iter(&shost->tag_set, flush_cmds_iter, &status); +}
Should the kernel-doc comment be moved from the static function to the exported function? Please also add a comment that it is only safe to call scsi_host_flush_commands() from inside a LLD reset handler.
Thanks, Bart.