On 05/04/2017 19:21, Christoph Hellwig wrote:
> +static ssize_t
> +zeroing_mode_store(struct device *dev, struct device_attribute *attr,
> +                const char *buf, size_t count)
> +{
> +     struct scsi_disk *sdkp = to_scsi_disk(dev);
> +
> +     if (!capable(CAP_SYS_ADMIN))
> +             return -EACCES;
> +
> +
> +     if (!strncmp(buf, zeroing_mode[SD_ZERO_WRITE], 20))
> +             sdkp->zeroing_mode = SD_ZERO_WRITE;
> +     else if (!strncmp(buf, zeroing_mode[SD_ZERO_WS], 20))
> +             sdkp->zeroing_mode = SD_ZERO_WS;
> +     else if (!strncmp(buf, zeroing_mode[SD_ZERO_WS16_UNMAP], 20))
> +             sdkp->zeroing_mode = SD_ZERO_WS16_UNMAP;
> +     else if (!strncmp(buf, zeroing_mode[SD_ZERO_WS10_UNMAP], 20))
> +             sdkp->zeroing_mode = SD_ZERO_WS10_UNMAP;

Should this be conditional on lbprz, lbpws, lbpws10 and max_ws_blocks?

Thanks,

Paolo

Reply via email to