scsi: fnic: Replace fnic->lock_flags with local flags
Subsystems (2)
Karan Tilak Kumar
maintainerPATCH v2 1/2 scsi: fnic: Replace fnic->lock_flags with local flags
Replace fnic->lock_flags with local variable for usage with spinlocks in fdls_schedule_oxid_free_retry_work.
--- drivers/scsi/fnic/fdls_disc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/scsi/fnic/fdls_disc.c +6 -5
@@ -308,23 +308,24 @@ void fdls_schedule_oxid_free_retry_work(struct work_struct *work)struct fnic *fnic = iport->fnic;struct reclaim_entry_s *reclaim_entry;unsigned long delay_j =msecs_to_jiffies (OXID_RECLAIM_TOV (iport)); +unsigned long flags;int idx; -spin_lock_irqsave (&fnic->fnic_lock, fnic->lock_flags); +spin_lock_irqsave (&fnic->fnic_lock, flags);for_each_set_bit (idx, oxid_pool->pending_schedule_free,FNIC_OXID_POOL_SZ ) {FNIC_FCS_DBG (KERN_INFO , fnic->host, fnic->fnic_num,"Schedule oxid free. oxid idx: %d\n" , idx); -spin_unlock_irqrestore (&fnic->fnic_lock, fnic->lock_flags); +spin_unlock_irqrestore (&fnic->fnic_lock, flags); reclaim_entry =kzalloc (sizeof (*reclaim_entry),GFP_KERNEL ); -spin_lock_irqsave (&fnic->fnic_lock, fnic->lock_flags); +spin_lock_irqsave (&fnic->fnic_lock, flags);if (!reclaim_entry) {schedule_delayed_work (&oxid_pool->schedule_oxid_free_retry,msecs_to_jiffies (SCHEDULE_OXID_FREE_RETRY_TIME )); -spin_unlock_irqrestore (&fnic->fnic_lock, fnic->lock_flags); +spin_unlock_irqrestore (&fnic->fnic_lock, flags);return ; }
@@ -339,7 +340,7 @@ void fdls_schedule_oxid_free_retry_work(struct work_struct *work) } } -spin_unlock_irqrestore (&fnic->fnic_lock, fnic->lock_flags); +spin_unlock_irqrestore (&fnic->fnic_lock, flags); }static bool fdls_is_oxid_fabric_req (uint16_t oxid)
Signature · 1 line
2.47.1
Karan Tilak Kumar
maintainerPATCH v2 2/2 scsi: fnic: Remove unnecessary spinlock locking and unlocking
Remove unnecessary locking and unlocking of spinlock in fdls_schedule_oxid_free_retry_work.
This will shorten the time in the critical section.
---
Changes between v1 and v2:
Incorporate review comments by Dan:
Replace test and clear bit with clear bit.
--- drivers/scsi/fnic/fdls_disc.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-)
drivers/scsi/fnic/fdls_disc.c +7 -17
@@ -311,36 +311,26 @@ void fdls_schedule_oxid_free_retry_work(struct work_struct *work)unsigned long flags;int idx; -spin_lock_irqsave (&fnic->fnic_lock, flags); -for_each_set_bit (idx, oxid_pool->pending_schedule_free,FNIC_OXID_POOL_SZ ) {FNIC_FCS_DBG (KERN_INFO , fnic->host, fnic->fnic_num,"Schedule oxid free. oxid idx: %d\n" , idx); -spin_unlock_irqrestore (&fnic->fnic_lock, flags); reclaim_entry =kzalloc (sizeof (*reclaim_entry),GFP_KERNEL ); -spin_lock_irqsave (&fnic->fnic_lock, flags); -if (!reclaim_entry) {schedule_delayed_work (&oxid_pool->schedule_oxid_free_retry,msecs_to_jiffies (SCHEDULE_OXID_FREE_RETRY_TIME )); -spin_unlock_irqrestore (&fnic->fnic_lock, flags);return ; } -if (test_and_clear_bit (idx, oxid_pool->pending_schedule_free)) { - reclaim_entry->oxid_idx = idx; - reclaim_entry->expires =round_jiffies (jiffies + delay_j); -list_add_tail (&reclaim_entry->links, &oxid_pool->oxid_reclaim_list); -schedule_delayed_work (&oxid_pool->oxid_reclaim_work, delay_j); - }else { -/* unlikely scenario, free the allocated memory and continue */ -kfree (reclaim_entry); - } +clear_bit (idx, oxid_pool->pending_schedule_free); + reclaim_entry->oxid_idx = idx; + reclaim_entry->expires =round_jiffies (jiffies + delay_j); +spin_lock_irqsave (&fnic->fnic_lock, flags); +list_add_tail (&reclaim_entry->links, &oxid_pool->oxid_reclaim_list); +spin_unlock_irqrestore (&fnic->fnic_lock, flags); +schedule_delayed_work (&oxid_pool->oxid_reclaim_work, delay_j); } - -spin_unlock_irqrestore (&fnic->fnic_lock, flags); }static bool fdls_is_oxid_fabric_req (uint16_t oxid)
Signature · 1 line
2.47.1
Re: [PATCH v2 2/2] scsi: fnic: Remove unnecessary spinlock locking and unlocking
Quoted 12 lines · Karan Tilak Kumar
Remove unnecessary locking and unlocking of spinlock in
fdls_schedule_oxid_free_retry_work.
This will shorten the time in the critical section.Suggested-by Dan Carpenter <[email protected]>Fixes a63e78eb2b0f ("scsi: fnic: Add support for fabric based solicited requests and responses")Reviewed-by Sesidhar Baddela <[email protected]>Reviewed-by Arulprabhu Ponnusamy <[email protected]>Reviewed-by Gian Carlo Boffa <[email protected]>Reviewed-by Arun Easi <[email protected]>Tested-by Karan Tilak Kumar <[email protected]>Signed-off-by Karan Tilak Kumar <[email protected]>
Quoted 5 lines
---
Changes between v1 and v2:
Incorporate review comments by Dan:
Replace test and clear bit with clear bit.
---
Thanks!
I'm not really qualified to give a reviewed-by tag to this, but it looks okay to me.
regards,
dan carpenter
Karan Tilak Kumar (kartilak)
maintainerRE: [PATCH v2 2/2] scsi: fnic: Remove unnecessary spinlock locking and unlocking
Quoted 20 lines · Dan Carpenter
Quoted 12 lines · Karan Tilak Kumar
Remove unnecessary locking and unlocking of spinlock in
fdls_schedule_oxid_free_retry_work.
This will shorten the time in the critical section.Suggested-by Dan Carpenter <[email protected]>Fixes a63e78eb2b0f ("scsi: fnic: Add support for fabric based solicited requests and responses")Reviewed-by Sesidhar Baddela <[email protected]>Reviewed-by Arulprabhu Ponnusamy <[email protected]>Reviewed-by Gian Carlo Boffa <[email protected]>Reviewed-by Arun Easi <[email protected]>Tested-by Karan Tilak Kumar <[email protected]>Signed-off-by Karan Tilak Kumar <[email protected]>Quoted 5 lines
---
Changes between v1 and v2:
Incorporate review comments by Dan:
Replace test and clear bit with clear bit.
---
Quoted 9 lines
Thanks!
I'm not really qualified to give a reviewed-by tag to this, but it looks okay to me.
regards,
dan carpenter
Thanks for your review and comments, Dan.
Appreciate your help.
Regards,
Karan
Martin K. Petersen
AppliedRe: [PATCH v2 2/2] scsi: fnic: Remove unnecessary spinlock locking and unlocking
In reply to Karan Tilak KumarKaran,
Quoted 3 lines
Remove unnecessary locking and unlocking of spinlock in
fdls_schedule_oxid_free_retry_work. This will shorten the time in the critical section.
Applied to 6.15/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedKaran,
Quoted 2 lines
Replace
fnic->lock_flagswith local variable for usage with spinlocks infdls_schedule_oxid_free_retry_work.
Applied to 6.15/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering