On 7/2/24 12:01, Haoqian He wrote: > The lbpme bit in scsi_disk can be used directly to indicate > if the logical unit supports logical block provisioning > management. The lbpvpd bit is no longer needed, so remove > this field from scsi_disk. > > Signed-off-by: Haoqian He <haoqian.he@xxxxxxxxxx> > Signed-off-by: Li Feng <fengli@xxxxxxxxxx> > --- > drivers/scsi/sd.c | 8 ++++---- > drivers/scsi/sd.h | 1 - > 2 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 44a19945b5b6..b49bab1d8610 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -3306,8 +3306,10 @@ static void sd_read_app_tag_own(struct scsi_disk *sdkp, unsigned char *buffer) > > static unsigned int sd_discard_mode(struct scsi_disk *sdkp) > { > - if (!sdkp->lbpvpd) > - /* Disable discard if LBP VPD page not provided */ > + if (!sdkp->lbpme) > + /* LBPME was not set means the logical unit > + * is fully provisioned, so disable discard. > + */ Incorrect multi-line comment format. Please start the comment with a "/*" line and no text. It may also be a good idea to add curly brackets for this if as it is multi line (but single statement). Or move the comment before the if. > return SD_LBP_DISABLE; > > /* LBP VPD page tells us what to use */ > @@ -3430,7 +3432,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) > struct scsi_vpd *vpd; > > if (!sdkp->lbpme) { > - sdkp->lbpvpd = 0; > sdkp->lbpu = 0; > sdkp->lbpws = 0; > sdkp->lbpws10 = 0; > @@ -3445,7 +3446,6 @@ static void sd_read_block_provisioning(struct scsi_disk *sdkp) > return; > } > > - sdkp->lbpvpd = 1; > sdkp->lbpu = (vpd->data[5] >> 7) & 1; /* UNMAP */ > sdkp->lbpws = (vpd->data[5] >> 6) & 1; /* WRITE SAME(16) w/ UNMAP */ > sdkp->lbpws10 = (vpd->data[5] >> 5) & 1; /* WRITE SAME(10) w/ UNMAP */ > diff --git a/drivers/scsi/sd.h b/drivers/scsi/sd.h > index 36382eca941c..ff9ff2655c25 100644 > --- a/drivers/scsi/sd.h > +++ b/drivers/scsi/sd.h > @@ -146,7 +146,6 @@ struct scsi_disk { > unsigned lbpu : 1; > unsigned lbpws : 1; > unsigned lbpws10 : 1; > - unsigned lbpvpd : 1; > unsigned ws10 : 1; > unsigned ws16 : 1; > unsigned rc_basis: 2; -- Damien Le Moal Western Digital Research