diff mbox series

[3/3] scsi: sd: remove some redundant initialization code

Message ID 20240702030118.2198570-4-haoqian.he@smartx.com (mailing list archive)
State Changes Requested
Headers show
Series scsi: disable discard when set target full provisioning | expand

Commit Message

Haoqian He July 2, 2024, 3:01 a.m. UTC
Since the memory allocated by kzalloc for sdkp has been
initialized to 0, the code that initializes some sdkp
fields to 0 is no longer needed.

Signed-off-by: Haoqian He <haoqian.he@smartx.com>
Signed-off-by: Li Feng <fengli@smartx.com>
---
 drivers/scsi/sd.c | 7 -------
 1 file changed, 7 deletions(-)

Comments

Damien Le Moal July 2, 2024, 3:33 a.m. UTC | #1
On 7/2/24 12:01, Haoqian He wrote:
> Since the memory allocated by kzalloc for sdkp has been
> initialized to 0, the code that initializes some sdkp
> fields to 0 is no longer needed.
> 
> Signed-off-by: Haoqian He <haoqian.he@smartx.com>
> Signed-off-by: Li Feng <fengli@smartx.com>

Looks OK to me.

Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Haoqian He July 4, 2024, 3:01 a.m. UTC | #2
> 2024年7月2日 11:33,Damien Le Moal <dlemoal@kernel.org> 写道:
> 
> On 7/2/24 12:01, Haoqian He wrote:
>> Since the memory allocated by kzalloc for sdkp has been
>> initialized to 0, the code that initializes some sdkp
>> fields to 0 is no longer needed.
>> 
>> Signed-off-by: Haoqian He <haoqian.he@smartx.com>
>> Signed-off-by: Li Feng <fengli@smartx.com>
> 
> Looks OK to me.
> 
> Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
> 
> -- 
> Damien Le Moal
> Western Digital Research
> 

Hi Martin,

According to the SBC-3 SPEC:
"The device server in a logical unit that supports logical block provisioning
management shall set the LBPME bit to one in the parameter data returned for
a READ CAPACITY (16) command."

So we can use lbpme bit instead of lbpvpd to indicate if the device is thin
provisioned, which was implemented in patch 2 ("scsi: sd: remove scsi_disk
field lbpvpd").

Thanks,
Haoqian
diff mbox series

Patch

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index b49bab1d8610..c7268780c642 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -3957,7 +3957,6 @@  static int sd_probe(struct device *dev)
 	sdkp->disk = gd;
 	sdkp->index = index;
 	sdkp->max_retries = SD_MAX_RETRIES;
-	atomic_set(&sdkp->openers, 0);
 	atomic_set(&sdkp->device->ioerr_cnt, 0);
 
 	if (!sdp->request_queue->rq_timeout) {
@@ -3990,13 +3989,7 @@  static int sd_probe(struct device *dev)
 
 	/* defaults, until the device tells us otherwise */
 	sdp->sector_size = 512;
-	sdkp->capacity = 0;
 	sdkp->media_present = 1;
-	sdkp->write_prot = 0;
-	sdkp->cache_override = 0;
-	sdkp->WCE = 0;
-	sdkp->RCD = 0;
-	sdkp->ATO = 0;
 	sdkp->first_scan = 1;
 	sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;