Re: [PATCH 10/14] scsi: sd: Move WRITE_ZEROES configuration to a separate function

Bart Van Assche
2022-03-03T00:52:37Z

On 3/1/22 21:35, Martin K. Petersen wrote:
> + if (mode == SD_ZERO_DEFAULT)
> + sdkp->zeroing_override = false;
> + else
> + sdkp->zeroing_override = true;

Hmm ... since sd_config_write_zeroes() special-cases mode ==
SD_ZERO_DEFAULT, does the value of zeroing_override matter if mode ==
SD_ZERO_DEFAULT?

> +static void sd_config_write_zeroes(struct scsi_disk *sdkp,
> + enum sd_zeroing_mode mode)
> +{
> + struct request_queue *q = sdkp->disk->queue;
> + unsigned int logical_block_size = sdkp->device->sector_size;
> +
> + if (mode == SD_ZERO_DEFAULT && !sdkp->zeroing_override) {
> + if (sdkp->lbprz && sdkp->lbpws)
> + mode = SD_ZERO_WS16_UNMAP;
> + else if (sdkp->lbprz && sdkp->lbpws10)
> + mode = SD_ZERO_WS10_UNMAP;
> + else if (sdkp->max_ws_blocks)
> + mode = SD_ZERO_WS;
> + else
> + mode = SD_ZERO_WRITE;
> + }
> +
> + if (mode == SD_ZERO_DISABLE)
> + sdkp->zeroing_override = true;

What does "zeroing_override" mean? I would expect if mode ==
SD_ZERO_DISABLE that that choice from the user is not overridden.

Thanks,

Bart.