From: sashiko-bot@kernel.org
To: "Damien Le Moal" <dlemoal@kernel.org>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH v11 12/13] scsi: sd_zbc: define storage element management operations
Date: Mon, 16 Nov 2026 21:52:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-217759@kernel.org> (raw)
In-Reply-To: <20261116213702.225970-13-dlemoal@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] scsi: sd_zbc: unused pre-restore report in
sd_zbc_restore_storage_elements()
--
commit 243eb4ceb1c6dd8c1c98cb3da00f3669c1215225
Author: Damien Le Moal <dlemoal@kernel.org>
scsi: sd_zbc: define storage element management operations
This commit defines storage element management operations for ZBC SCSI
disks to support reporting, removing, and restoring storage elements.
> diff --git a/drivers/scsi/sd_zbc.c b/drivers/scsi/sd_zbc.c
> index bf2e60071d577..13cfcef19c38a 100644
> --- a/drivers/scsi/sd_zbc.c
> +++ b/drivers/scsi/sd_zbc.c
[ ... ]
> @@ -560,6 +573,480 @@ static void sd_zbc_print_zones(struct scsi_disk *sdkp)
> sdkp->zone_info.zone_blocks);
> }
>
[ ... ]
> +static int sd_zbc_wait_for_se_restore(struct scsi_disk *sdkp,
> + struct sd_zbc_se_report *rep)
> +{
> + unsigned int i, in_progress, in_error;
> + int ret;
> +
> + /*
> + * Poll the storage elements health to see if we have any element still
> + * being restored or if we got errors. Since restoration is a best
> + * effort process, we care only about failed restoration for elements
> + * that are allowed to be restored.
> + * Since we do not know how long the operation may take, we cannot have
> + * a timeout on this loop. So check for fatal signals so that the user
> + * can terminate this retry loop if the device misbehaves.
> + */
> + do {
> + msleep(1000);
> +
> + ret = sd_zbc_report_se(sdkp, rep);
> + if (ret)
> + return ret;
> + if (rep->nr_reported_elements != rep->nr_elements)
> + return -EIO;
> +
> + in_progress = 0;
> + in_error = 0;
> + for (i = 0; i < rep->nr_reported_elements; i++) {
> + switch (rep->elements[i].status) {
> + case BLK_SE_STS_RESTORE_IN_PROGRESS:
> + in_progress++;
> + break;
> + case BLK_SE_STS_RESTORE_ERROR:
> + if (rep->elements[i].restore_allowed)
> + in_error++;
> + break;
> + default:
> + break;
> + }
> + }
> +
> + if (!in_progress) {
> + if (in_error)
> + return -EIO;
> + return 0;
> + }
> + } while (!fatal_signal_pending(current));
> +
> + return -EINTR;
> +}
> +
> +static int sd_zbc_restore_storage_elements(struct gendisk *disk)
> +{
> + struct scsi_disk *sdkp = scsi_disk(disk);
> + struct sd_zbc_se_report rep;
> + int ret;
> +
> + if (!sdkp->depop_restore_supported)
> + return -EOPNOTSUPP;
> +
> + /*
> + * Get the resources we need to prepare for waiting for the operation to
> + * complete.
> + */
> + ret = sd_zbc_alloc_se_report(NULL, disk->nr_storage_elements,
> + true, &rep);
> + if (ret)
> + return ret;
> +
> + /* To detect restoration errors, count the number of such elements. */
> + ret = sd_zbc_report_se(sdkp, &rep);
> + if (ret)
> + goto free;
> + if (rep.nr_reported_elements != rep.nr_elements) {
> + ret = -EIO;
> + goto free;
> + }
> +
> + /*
> + * Execute the restore command and wait for the elements restoration
> + * operation to complete.
> + */
> + ret = sd_zbc_execute_storage_element_cmd(sdkp,
> + SAI_RESTORE_ELEMENTS_AND_REBUILD, 0);
> + if (!ret)
> + ret = sd_zbc_wait_for_se_restore(sdkp, &rep);
[Severity: Low]
Is the sd_zbc_report_se() call in sd_zbc_restore_storage_elements() missing
the element count described by the comment, or is it left over? Nothing
inspects rep.elements before sd_zbc_wait_for_se_restore() overwrites rep on
its first iteration, so this issues a redundant GET PHYSICAL ELEMENT STATUS
command on every restore operation.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261116213702.225970-1-dlemoal@kernel.org?part=12
next prev parent reply other threads:[~2026-11-16 21:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-16 21:36 [PATCH v11 00/13] Add support for storage element depopulation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 01/13] block: introduce disk_zone_is_offline() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 02/13] block: refactor blk_revalidate_disk_zones() Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 03/13] block: allow dropping all zone write plugs on revalidation Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 04/13] block: introduce storage element management Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 05/13] block: add storage element management ioctls Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 06/13] zloop: fix ordered zone append handling Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 07/13] zloop: fix zone reporting consistency Damien Le Moal
2026-11-16 21:36 ` [PATCH v11 08/13] zloop: add storage element emulation Damien Le Moal
2026-11-16 21:59 ` sashiko-bot
2026-11-16 21:36 ` [PATCH v11 09/13] zloop: add degrade_element control command Damien Le Moal
2026-11-16 21:44 ` sashiko-bot
2026-11-16 21:36 ` [PATCH v11 10/13] scsi: scsi_proto: refine the definition of storage element health Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 11/13] scsi: sd_zbc: always revalidate zones for disks supporting head depopulation Damien Le Moal
2026-11-16 21:37 ` [PATCH v11 12/13] scsi: sd_zbc: define storage element management operations Damien Le Moal
2026-11-16 21:52 ` sashiko-bot [this message]
2026-11-16 21:37 ` [PATCH v11 13/13] scsi: sd: fail read commands to offline zones early Damien Le Moal
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=sashiko-outbox-217759@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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