public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: Sergey Shtylyov <s.shtylyov@omp.ru>,
	linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	John Garry <john.garry@huawei.com>
Subject: Re: [PATCH 2/2] ata: libata-sata: Fix device queue depth control
Date: Mon, 26 Sep 2022 08:00:20 +0900	[thread overview]
Message-ID: <0e2ff01a-d972-1765-ee50-3b04476fa696@opensource.wdc.com> (raw)
In-Reply-To: <b1595afb-49cd-2e19-1b5f-bfbe9836784e@omp.ru>

On 9/24/22 18:49, Sergey Shtylyov wrote:
> Hello!
> 
> On 9/24/22 9:29 AM, Damien Le Moal wrote:
> 
>> The function __ata_change_queue_depth() uses the helper
>> ata_scsi_find_dev() to get the ata_device structure of a scsi device and
>> set that device maximum queue depth. However, when the ata device is
>> managed by libsas, ata_scsi_find_dev() return NULL, turning
> 
>    Returns?
> 
>> __ata_change_queue_depth() into a nop, which prevents the user from
>> setting the maximum queue depth of ATA devices used with libsas based
>> HBAs.
>>
>> Fix this by renaming __ata_change_queue_depth() to
>> ata_change_queue_depth() and adding a pointer to the ata_device
>> structure of the target device as argument. This pointer is provided by
>> ata_scsi_change_queue_depth() using ata_scsi_find_dev() in the case ofi
> 
>    Of?
> 
>> a libata managed device and by sas_change_queue_depth() using
>> sas_to_ata_dev() in the case of a libsas managed ata device.
>>
>> Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
> [...]
> 
>> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
>> index ff9602a0e54e..c63bb50323c1 100644
>> --- a/drivers/ata/libata-scsi.c
>> +++ b/drivers/ata/libata-scsi.c
>> @@ -1101,6 +1101,11 @@ int ata_scsi_dev_config(struct scsi_device *sdev, struct ata_device *dev)
>>  	if (dev->flags & ATA_DFLAG_AN)
>>  		set_bit(SDEV_EVT_MEDIA_CHANGE, sdev->supported_events);
>>  
>> +	pr_info("#### can queue %d, ata qd %d, scsi qd %d\n",
> 
>     Hm... isn't this a debugging pr_info() call you forgot to remove?

Oops. Yes. Sending an update. Thanks for the review.

> 
>> +		sdev->host->can_queue,
>> +		ata_id_queue_depth(dev->id),
>> +		sdev->queue_depth);
>> +
>>  	if (dev->flags & ATA_DFLAG_NCQ)
>>  		depth = min(sdev->host->can_queue, ata_id_queue_depth(dev->id));
>>  	depth = min(ATA_MAX_QUEUE, depth);
> [...]
> 
> MBR, Sergey

-- 
Damien Le Moal
Western Digital Research


      reply	other threads:[~2022-09-25 23:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-24  6:29 [PATCH 0/2] Fixes for ATA device queue depth control Damien Le Moal
2022-09-24  6:29 ` [PATCH 1/2] ata: libata-scsi: Fix initialization of device queue depth Damien Le Moal
2022-09-24  6:29 ` [PATCH 2/2] ata: libata-sata: Fix device queue depth control Damien Le Moal
2022-09-24  9:49   ` Sergey Shtylyov
2022-09-25 23:00     ` Damien Le Moal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e2ff01a-d972-1765-ee50-3b04476fa696@opensource.wdc.com \
    --to=damien.lemoal@opensource.wdc.com \
    --cc=john.garry@huawei.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=s.shtylyov@omp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox