Re: [PATCH v3 2/5] scsi: sd: Fix data corruption in WRITE SAME(10) write zeroes

From: Christoph Hellwig

Date: Mon Nov 30 2026 - 04:18:05 EST


I find the subject a bit odd. Something like:

sd: don't use WRITE SAME(10) on device requiring 64-bit addressing

a bit more useful.

The commit log could probably also use a bit trimming from the overly
verbose LLM style.

> +/* WRITE SAME(10) only has a 32-bit LBA field. */
> +static bool sd_can_use_ws10(struct scsi_disk *sdkp)
> +{
> + sector_t max_blocks = (sector_t)U32_MAX + 1;
> +
> + /*
> + * A removable disk without a medium has an sdkp->capacity of zero,
> + * but the gendisk keeps its old capacity until the next revalidate.
> + */
> + return sdkp->capacity <= max_blocks &&
> + get_capacity(sdkp->disk) <=
> + logical_to_sectors(sdkp->device, max_blocks);
> +}

The comment seems oddly misplace, as it doesn't seem relevant
to any of the conditions.

The code change itself looks fine.