Skip to contentSkip to conversation

scsi: remove unused sd_cdb_cache

PATCH Superseded Fengnan Chang 3 participants 3 messages Feb 20, 2023 – Feb 21, 2023 SCSI

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: remove unused sd_cdb_cache

sd_cdb_cache is useless, just remove it.

---
 drivers/scsi/sd.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/scsi/sd.c +1 -15
index 47dafe6b8a66..46d814035323 100644
@@ -121,7 +121,6 @@ static void scsi_disk_release(struct device *cdev);
 
 static DEFINE_IDA(sd_index_ida);
 
-static struct kmem_cache *sd_cdb_cache;
 static mempool_t *sd_page_pool;
 static struct lock_class_key sd_bio_compl_lkclass;
 
@@ -3826,19 +3825,11 @@ static int __init init_sd(void)
 	if (err)
 		goto err_out;
 
-	sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
-					 0, 0, NULL);
-	if (!sd_cdb_cache) {
-		printk(KERN_ERR "sd: can't init extended cdb cache\n");
-		err = -ENOMEM;
-		goto err_out_class;
-	}
-
 	sd_page_pool = mempool_create_page_pool(SD_MEMPOOL_SIZE, 0);
 	if (!sd_page_pool) {
 		printk(KERN_ERR "sd: can't init discard page pool\n");
 		err = -ENOMEM;
-		goto err_out_cache;
+		goto err_out_class;
 	}
 
 	err = scsi_register_driver(&sd_template.gendrv);
@@ -3849,10 +3840,6 @@ static int __init init_sd(void)
 
 err_out_driver:
 	mempool_destroy(sd_page_pool);
-
-err_out_cache:
-	kmem_cache_destroy(sd_cdb_cache);
-
 err_out_class:
 	class_unregister(&sd_disk_class);
 err_out:
@@ -3874,7 +3861,6 @@ static void __exit exit_sd(void)
 
 	scsi_unregister_driver(&sd_template.gendrv);
 	mempool_destroy(sd_page_pool);
-	kmem_cache_destroy(sd_cdb_cache);
 
 	class_unregister(&sd_disk_class);
 
Signature · 1 line
2.37.1 (Apple Git-137.1)
Reviewed-by on v1 1/1
#1 lore raw

On 20/02/2023 13:05, Fengnan Chang wrote:

Adding "core" to the headline would be better, like "scsi: core: remove unused sd_cdb_cache"

Quoted 1 line

sd_cdb_cache is useless, just remove it.

Like in the commit headline, I'd be more inclined to say it's unused, not useless.

It might be also useful to mention when we stopped using it, which was commit ce70fd9a551a ("scsi: core: Remove the cmd field from struct scsi_request") AFAICS

Apart from that, feel free to add:

Quoted 58 lines
---
  drivers/scsi/sd.c | 16 +---------------
  1 file changed, 1 insertion(+), 15 deletions(-)
drivers/scsi/sd.c +1 -15
index 47dafe6b8a66..46d814035323 100644
@@ -121,7 +121,6 @@ static void scsi_disk_release(struct device *cdev);
 
  static DEFINE_IDA(sd_index_ida);
 
-static struct kmem_cache *sd_cdb_cache;
  static mempool_t *sd_page_pool;
  static struct lock_class_key sd_bio_compl_lkclass;
 
@@ -3826,19 +3825,11 @@ static int __init init_sd(void)
  	if (err)
  		goto err_out;
 
-	sd_cdb_cache = kmem_cache_create("sd_ext_cdb", SD_EXT_CDB_SIZE,
-					 0, 0, NULL);
-	if (!sd_cdb_cache) {
-		printk(KERN_ERR "sd: can't init extended cdb cache\n");
-		err = -ENOMEM;
-		goto err_out_class;
-	}
-
  	sd_page_pool = mempool_create_page_pool(SD_MEMPOOL_SIZE, 0);
  	if (!sd_page_pool) {
  		printk(KERN_ERR "sd: can't init discard page pool\n");
  		err = -ENOMEM;
-		goto err_out_cache;
+		goto err_out_class;
  	}
 
  	err = scsi_register_driver(&sd_template.gendrv);
@@ -3849,10 +3840,6 @@ static int __init init_sd(void)
 
  err_out_driver:
  	mempool_destroy(sd_page_pool);
-
-err_out_cache:
-	kmem_cache_destroy(sd_cdb_cache);
-
  err_out_class:
  	class_unregister(&sd_disk_class);
  err_out:
@@ -3874,7 +3861,6 @@ static void __exit exit_sd(void)
 
  	scsi_unregister_driver(&sd_template.gendrv);
  	mempool_destroy(sd_page_pool);
-	kmem_cache_destroy(sd_cdb_cache);
 
  	class_unregister(&sd_disk_class);