linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* scsi_debug driver puzzle
@ 2014-03-31 17:32 Laurence Oberman
  2014-03-31 18:01 ` Bryn M. Reeves
  0 siblings, 1 reply; 2+ messages in thread
From: Laurence Oberman @ 2014-03-31 17:32 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org

Hello

I have what to me is a puzzle but is likely a stupid question about
the queuecommand interface in the scsi_debug driver.

I see the host template set for  scsi_debug_queuecommand but in the
driver we have the function declared as int
scsi_debug_queuecommand_lck
So how is this working.

Egrep pattern: scsi_debug_queuecommand

  File         Line
0 scsi_debug.c 3551 int scsi_debug_queuecommand_lck(struct scsi_cmnd
*SCpnt, done_funct_t done)
1 scsi_debug.c 3900 static DEF_SCSI_QCMD(scsi_debug_queuecommand)
2 scsi_debug.c 3912 .queuecommand =  scsi_debug_queuecommand,

Thanks
Laurence

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: scsi_debug driver puzzle
  2014-03-31 17:32 scsi_debug driver puzzle Laurence Oberman
@ 2014-03-31 18:01 ` Bryn M. Reeves
  0 siblings, 0 replies; 2+ messages in thread
From: Bryn M. Reeves @ 2014-03-31 18:01 UTC (permalink / raw)
  To: Laurence Oberman; +Cc: linux-scsi

On 03/31/2014 06:32 PM, Laurence Oberman wrote:
>   File         Line
> 0 scsi_debug.c 3551 int scsi_debug_queuecommand_lck(struct scsi_cmnd
> *SCpnt, done_funct_t done)
> 1 scsi_debug.c 3900 static DEF_SCSI_QCMD(scsi_debug_queuecommand)
> 2 scsi_debug.c 3912 .queuecommand =  scsi_debug_queuecommand,

Magical scsi_host.h macro as part of the effort to push host_lock down.
The macro creates a function named as its argument which takes and drops
the shost->host_lock around a call to the real queuecommand function:

        spin_lock_irqsave(shost->host_lock, irq_flags);
        scsi_cmd_get_serial(shost, cmd);
        rc = func_name##_lck (cmd,cmd->scsi_done);
        spin_unlock_irqrestore(shost->host_lock, irq_flags);

http://fpaste.org/90345/88875139/

Cheers,
Bryn.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-31 18:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31 17:32 scsi_debug driver puzzle Laurence Oberman
2014-03-31 18:01 ` Bryn M. Reeves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).