On Thu, 2019-02-14 at 22:15 +0100, Jean Delvare wrote: > From: Hannes Reinecke <[email protected]> > > When evaluating the 'block limits' VPD page we need to check if > the 'lbpme' (logical block provisioning management enable) bit > is set in the READ CAPACITY (16) output. > If it isn't we can safely assume that we cannot use DISCARD on > this device. > > [JD: forward-ported to kernel v4.20] > > Signed-off-by: Hannes Reinecke <[email protected]> > Signed-off-by: Jean Delvare <[email protected]> > --- > Hannes, please double-check that my forward-port is correct. > > drivers/scsi/sd.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -411,6 +411,13 @@ provisioning_mode_store(struct device *d > if (mode < 0) > return -EINVAL; > > + /* > + * If logical block provisioning isn't enabled we can only > + * select 'disable' here. > + */ > + if (!sdkp->lbpme && mode != SD_LBP_DISABLE) > + return -EINVAL; > + > sd_config_discard(sdkp, mode); > > return count; > @@ -2942,8 +2949,10 @@ static void sd_read_block_limits(struct > > sdkp->max_ws_blocks = (u32)get_unaligned_be64(&buffer[36]); > > - if (!sdkp->lbpme) > + if (!sdkp->lbpme) { > + sd_config_discard(sdkp, SD_LBP_DISABLE); > goto out; > + } > > lba_count = get_unaligned_be32(&buffer[20]); > desc_count = get_unaligned_be32(&buffer[24]);
What is the impact of this patch on SATA SSDs? Since these SSDs do not support logical provisioning, does this patch break trim support for these SSDs? Bart.

