diff mbox series

[2/3] scsi: sd: remove scsi_disk field lbpvpd

Message ID 20240702030118.2198570-3-haoqian.he@smartx.com
State New
Headers show
Series scsi: disable discard when set target full provisioning | expand

Commit Message

Haoqian He July 2, 2024, 3:01 a.m. UTC
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@smartx.com>
Signed-off-by: Li Feng <fengli@smartx.com>
---
 drivers/scsi/sd.c | 8 ++++----
 drivers/scsi/sd.h | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)
diff mbox series

Patch

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.
+		 */
 		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;