> 
> It is tiny probable to collide with running timer, and we can probe colliding,
> then the overhead of unlock/lock is removed.
> 
> Any comment is appreciated.
> 
> Thanks
> 
> Signed-off-by: Hillf Danton <[email protected]>
> ---
>  drivers/scsi/libfc/fc_fcp.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
> index 9cd2149..725f308 100644
> --- a/drivers/scsi/libfc/fc_fcp.c
> +++ b/drivers/scsi/libfc/fc_fcp.c
> @@ -1272,11 +1272,11 @@ static int fc_lun_reset(struct fc_lport
> *lport, struct fc_fcp_pkt *fsp,
> 
>       spin_lock_bh(&fsp->scsi_pkt_lock);
>       fsp->state |= FC_SRB_COMPL;
> -     spin_unlock_bh(&fsp->scsi_pkt_lock);
> -
> -     del_timer_sync(&fsp->timer);
> -
> -     spin_lock_bh(&fsp->scsi_pkt_lock);
> +     if (try_to_del_timer_sync(&fsp->timer) < 0) {
> +             spin_unlock_bh(&fsp->scsi_pkt_lock);
> +             del_timer_sync(&fsp->timer);
> +             spin_lock_bh(&fsp->scsi_pkt_lock);
> +     }
I am not sure if we will get any benefit of this. This fsp is for
lun reset, i.e., not the i/o from queuecommand, it seems to me we would
always end up do the unlock/del_timer_sync/lock, which is even more 
overhead.

yi


>       if (fsp->seq_ptr) {
>               lport->tt.exch_done(fsp->seq_ptr);
>               fsp->seq_ptr = NULL;
> @@ -1890,7 +1890,7 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
>       fc_fcp_ddp_done(fsp);
> 
>       fsp->state |= FC_SRB_COMPL;
> -     if (!(fsp->state & FC_SRB_FCP_PROCESSING_TMO)) {
> +     if (try_to_del_timer_sync(&fsp->timer) < 0) {
>               spin_unlock_bh(&fsp->scsi_pkt_lock);
>               del_timer_sync(&fsp->timer);
>               spin_lock_bh(&fsp->scsi_pkt_lock);
> _______________________________________________
> devel mailing list
> [email protected]
> https://lists.open-fcoe.org/mailman/listinfo/devel
_______________________________________________
devel mailing list
[email protected]
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to