Messages in this thread | | | Date | Thu, 27 Oct 2022 09:16:37 +0100 | Subject | Re: [PATCH RFC v3 03/22] scsi: core: Implement reserved command handling | From | John Garry <> |
| |
On 27/10/2022 08:51, Hannes Reinecke wrote: >>> >>> Signed-off-by: Hannes Reinecke <hare@suse.de> >>> #jpg: Set tag_set->queue_depth = shost->can_queue, and not >>> = shost->can_queue + shost->nr_reserved_cmds; >>> Signed-off-by: John Garry <john.garry@huawei.com> >>> --- >>> drivers/scsi/hosts.c | 3 +++ >>> drivers/scsi/scsi_lib.c | 2 ++ >>> include/scsi/scsi_host.h | 15 ++++++++++++++- >>> 3 files changed, 19 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c >>> index 12346e2297fd..db89afc37bc9 100644 >>> --- a/drivers/scsi/hosts.c >>> +++ b/drivers/scsi/hosts.c >>> @@ -489,6 +489,9 @@ struct Scsi_Host *scsi_host_alloc(struct >>> scsi_host_template *sht, int privsize) >>> if (sht->virt_boundary_mask) >>> shost->virt_boundary_mask = sht->virt_boundary_mask; >>> + if (sht->nr_reserved_cmds) >>> + shost->nr_reserved_cmds = sht->nr_reserved_cmds; >>> + >> >> Nit: the if is not really necessary I think. But it does not hurt. >> > Yes, we do. > Not all HBAs are able to figure out the number of reserved commands > upfront; some modify that based on the PCI device used etc. > So I'd keep it for now.
I think logically Damien is right as in the shost alloc shost->nr_reserved_cmds is initially zero, so:
if (sht->nr_reserved_cmds) shost->nr_reserved_cmds = sht->nr_reserved_cmds;
is same as simply:
shost->nr_reserved_cmds = sht->nr_reserved_cmds;
However I am just copying the coding style.
Thanks, John
| |