Re: [PATCH 06/15] hpsa: use scsi_host_busy_iter() to traverse outstanding commands

Hannes Reinecke
2021-11-27T17:02:59Z

On 11/26/21 10:33 AM, John Garry wrote:
> On 25/11/2021 15:10, Hannes Reinecke wrote:
>>   static void hpsa_drain_accel_commands(struct ctlr_info *h)
>>   {
>> -    struct CommandList *c = NULL;
>> -    int i, accel_cmds_out;
>> -    int refcount;
>> +    struct hpsa_command_iter_data iter_data = {
>> +        .h = h,
>> +    };
>>       do { /* wait for all outstanding ioaccel commands to drain out */
>> -        accel_cmds_out = 0;
>> -        for (i = 0; i < h->nr_cmds; i++) {
>> -            c = h->cmd_pool + i;
>> -            refcount = atomic_inc_return(&c->refcount);
>> -            if (refcount > 1) /* Command is allocated */
>> -                accel_cmds_out += is_accelerated_cmd(c);
>> -            cmd_free(h, c);
>> -        }
>> -        if (accel_cmds_out <= 0)
>> +        iter_data.count = 0;
>> +        scsi_host_busy_iter(h->scsi_host,
>> +                    hpsa_drain_accel_commands_iter,
>> +                    &iter_data);
>
> I haven't following this code exactly, but I assume that you want to
> iter the reserved requests as well (or in other places in others drivers
> in this series). For that to work we need to call
> blk_mq_start_request(), right? I could not see it called.
>
Actually, no; this is iterating over 'accel' commands, ie fastpath
commands for RAID I/0. Which none of the reserved commands are.

But that doesn't mean that your comment about reserved commands not
being started is invalid. Hmm.

Cheers,

Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer