From: Damien Le Moal <dlemoal@kernel.org>
To: Phil Pemberton <philpem@philpem.me.uk>,
linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Niklas Cassel <cassel@kernel.org>,
"James E . J . Bottomley" <James.Bottomley@HansenPartnership.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v3 5/7] ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices
Date: Mon, 27 Apr 2026 08:36:19 +0900 [thread overview]
Message-ID: <cdd57593-e43f-455e-bd30-f3f89c10b135@kernel.org> (raw)
In-Reply-To: <20260426190920.2051289-6-philpem@philpem.me.uk>
On 4/27/26 4:09 AM, Phil Pemberton wrote:
> After LUN 0 is added for an ATAPI device, check its BLIST_FORCELUN
> flag. If set, call scsi_scan_target() with SCAN_WILD_CARD to trigger
> the SCSI layer's built-in sequential LUN scan for that target only.
> This probes LUNs 1..shost->max_lun, driven by the atapi_max_lun module
> parameter from patch 1/6. Devices without BLIST_FORCELUN (the vast
Please remove the mention of patch 1/6. Once the patches are applied, that will
not mean anything.
> majority of ATAPI devices) are left with only LUN 0 -- no sequential
> scan is triggered, so single-LUN devices like the iHAS124 DVD writer
> are completely unaffected.
>
> Non-responding LUNs (PQ=0/PDT=0x1f) are silently skipped by
> scsi_probe_and_add_lun() when BLIST_NO_LUN_1F is set on the device
> via scsi_devinfo (see patch 4/6).
Same thing here.
>
> Signed-off-by: Phil Pemberton <philpem@philpem.me.uk>
> ---
> drivers/ata/libata-scsi.c | 37 ++++++++++++++++++++++++++++---------
> 1 file changed, 28 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index 48c7d323d6f9..fc719e3d7d60 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -26,6 +26,7 @@
> #include <scsi/scsi_device.h>
> #include <scsi/scsi_tcq.h>
> #include <scsi/scsi_transport.h>
> +#include <scsi/scsi_devinfo.h>
> #include <linux/libata.h>
> #include <linux/hdreg.h>
> #include <linux/uaccess.h>
> @@ -4700,7 +4701,6 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
> repeat:
> ata_for_each_link(link, ap, EDGE) {
> ata_for_each_dev(dev, link, ENABLED) {
> - struct scsi_device *sdev;
> int channel = 0, id = 0;
>
> if (dev->sdev[0])
> @@ -4711,15 +4711,34 @@ void ata_scsi_scan_host(struct ata_port *ap, int sync)
> else
> channel = link->pmp;
>
> - sdev = __scsi_add_device(ap->scsi_host, channel, id, 0,
> - NULL);
> - if (!IS_ERR(sdev)) {
> - dev->sdev[0] = sdev;
> - ata_scsi_assign_ofnode(dev, ap);
> - scsi_device_put(sdev);
> - } else {
> - dev->sdev[0] = NULL;
> + {
> + struct scsi_device *sdev;
This is not pretty... Please leave the declaration of sdev where it was and
remove this curly bracket. That will save one level of identation and make the
code cleaner.
> +
> + sdev = __scsi_add_device(ap->scsi_host,
> + channel, id, 0, NULL);
> + if (!IS_ERR(sdev)) {
> + /*
> + * For multi-LUN ATAPI (BLIST_FORCELUN),
> + * trigger the sequential LUN scan.
> + * pdt_1f_for_no_lun (set during LUN 0
> + * configure) ensures non-responding LUNs
> + * are silently skipped. dev->sdev[] is
> + * populated by ata_scsi_dev_config()
> + * during the scan callbacks.
> + */
> + if (dev->class == ATA_DEV_ATAPI &&
> + sdev->sdev_bflags & BLIST_FORCELUN)
> + scsi_scan_target(
> + &ap->scsi_host->shost_gendev,
> + channel, id,
> + SCAN_WILD_CARD,
> + SCSI_SCAN_RESCAN);
> + scsi_device_put(sdev);
> + }
> }
> +
> + if (dev->sdev[0])
> + ata_scsi_assign_ofnode(dev, ap);
> }
> }
>
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2026-04-26 23:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-26 19:09 [PATCH v3 0/7] ata: libata-scsi: multi-LUN ATAPI device support Phil Pemberton
2026-04-26 19:09 ` [PATCH v3 1/7] ata: libata-scsi: add atapi_max_lun module parameter Phil Pemberton
2026-04-26 23:14 ` Damien Le Moal
2026-04-26 19:09 ` [PATCH v3 2/7] ata: libata-scsi: convert dev->sdev to per-LUN array Phil Pemberton
2026-04-26 23:25 ` Damien Le Moal
2026-04-26 19:09 ` [PATCH v3 3/7] ata: libata-scsi: route non-zero LUN commands for multi-LUN ATAPI Phil Pemberton
2026-04-26 23:29 ` Damien Le Moal
2026-04-27 11:53 ` Hannes Reinecke
2026-04-26 19:09 ` [PATCH v3 4/7] scsi: add BLIST_NO_LUN_1F blacklist flag Phil Pemberton
2026-04-26 23:32 ` Damien Le Moal
2026-04-27 11:54 ` Hannes Reinecke
2026-04-26 19:09 ` [PATCH v3 5/7] ata: libata-scsi: probe additional LUNs for multi-LUN ATAPI devices Phil Pemberton
2026-04-26 23:36 ` Damien Le Moal [this message]
2026-04-26 19:09 ` [PATCH v3 6/7] scsi: scsi_devinfo: add COMPAQ PD-1 multi-LUN ATAPI device quirk Phil Pemberton
2026-04-26 23:37 ` Damien Le Moal
2026-04-27 11:55 ` Hannes Reinecke
2026-04-26 19:09 ` [PATCH v3 7/7] scsi: scsi_devinfo: extend BLIST_NO_LUN_1F to MATSHITA and NEC PD-1 variants Phil Pemberton
2026-04-26 23:37 ` Damien Le Moal
2026-04-27 11:56 ` Hannes Reinecke
2026-04-27 12:12 ` Phil Pemberton
2026-05-06 0:52 ` Phil Pemberton
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=cdd57593-e43f-455e-bd30-f3f89c10b135@kernel.org \
--to=dlemoal@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=cassel@kernel.org \
--cc=hare@suse.de \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=philpem@philpem.me.uk \
/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