Skip to contentSkip to conversation

ata: libata-scsi: Remove superfluous local_irq_save()

PATCH In review Niklas Cassel 3 participants 4 messages Dec 4, 2025 – Dec 8, 2025 libata

lore
Share & tools
lore

Niklas Cassel

author maintainer
#0 lore raw

PATCH 1/1 ata: libata-scsi: Remove superfluous local_irq_save()

Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added ata_scsi_report_zones_complete(). Since the beginning, this function has disabled IRQs on the local CPU using local_irq_save().

qc->complete_fn is always called with ap->lock held, and the ap->lock is always taking using spin_lock_irq*().

Thus, this local_irq_save() is superfluous and can be removed.

---
 drivers/ata/libata-scsi.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/libata-scsi.c +2 -3
index 434774e71fe61..86d283d340e32 100644
@@ -3572,13 +3572,13 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
 {
 	struct scsi_cmnd *scmd = qc->scsicmd;
 	struct sg_mapping_iter miter;
-	unsigned long flags;
 	unsigned int bytes = 0;
 
+	lockdep_assert_held(qc->ap->lock);
+
 	sg_miter_start(&miter, scsi_sglist(scmd), scsi_sg_count(scmd),
 		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
 
-	local_irq_save(flags);
 	while (sg_miter_next(&miter)) {
 		unsigned int offset = 0;
 
@@ -3626,7 +3626,6 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
 		}
 	}
 	sg_miter_stop(&miter);
-	local_irq_restore(flags);
 
 	ata_scsi_qc_complete(qc);
 }
Signature · 1 line
2.52.0
author maintainer
#1 lore raw
Quoted 6 lines · Niklas Cassel

Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added ata_scsi_report_zones_complete(). Since the beginning, this function has disabled IRQs on the local CPU using local_irq_save().

qc->complete_fn is always called with ap->lock held, and the ap->lock is always taking using spin_lock_irq*().

s/taking/taken/

Reviewed-by on v1 1/1
#2 lore raw
In reply to Niklas Cassel
Quoted 35 lines · Niklas Cassel

Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added ata_scsi_report_zones_complete(). Since the beginning, this function has disabled IRQs on the local CPU using local_irq_save().

qc->complete_fn is always called with ap->lock held, and the ap->lock is always taking using spin_lock_irq*().

Thus, this local_irq_save() is superfluous and can be removed.

---
  drivers/ata/libata-scsi.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
drivers/ata/libata-scsi.c +2 -2
index 434774e71fe61..86d283d340e32 100644
@@ -3572,13 +3572,13 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
  {
  	struct scsi_cmnd *scmd = qc->scsicmd;
  	struct sg_mapping_iter miter;
-	unsigned long flags;
  	unsigned int bytes = 0;
 
+	lockdep_assert_held(qc->ap->lock);
+
  	sg_miter_start(&miter, scsi_sglist(scmd), scsi_sg_count(scmd),
  		       SG_MITER_TO_SG | SG_MITER_ATOMIC);
 
-	local_irq_save(flags);
  	while (sg_miter_next(&miter)) {
  		unsigned int offset = 0;
 

drivers/ata/libata-scsi.c static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc) · line 3631

Quoted 7 lines
drivers/ata/libata-scsi.c +0 -1
@@ -3626,7 +3626,6 @@ static void ata_scsi_report_zones_complete(struct ata_queued_cmd *qc)
  		}
  	}
  	sg_miter_stop(&miter);
-	local_irq_restore(flags);
 
  	ata_scsi_qc_complete(qc);
  }

Cheers,

Hannes

Signature · 4 lines
Dr. Hannes Reinecke                  Kernel Storage Architect
[email protected]                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
maintainer
#3 lore raw
In reply to Niklas Cassel
Quoted 10 lines · Niklas Cassel

Commit 28a3fc2295a7 ("libata: implement ZBC IN translation") added ata_scsi_report_zones_complete(). Since the beginning, this function has disabled IRQs on the local CPU using local_irq_save().

qc->complete_fn is always called with ap->lock held, and the ap->lock is always taking using spin_lock_irq*().

Thus, this local_irq_save() is superfluous and can be removed.

I staged this in for-6.20, which I will rebase once rc1 is out.

Signature · 2 lines
Damien Le Moal
Western Digital Research