per-entity statistics

Jose R. Santos jrs@us.ibm.com
Thu Jan 12 20:21:00 GMT 2006


Martin Peschke wrote:

>Jose R. Santos wrote:
>> Unless you only have a single SCSI card with just one channel, just 
>> getting the LUN is not enough. You need the SCSI host number, channel, 
>> lun, and ID. Here is a bit of code from the trace tool that shows how to 
>> get that information using SystemTap.
>> 
>> function log_scsi_iodone_extra(var:long)
>> %{
>> struct scsi_cmnd *cmd = (struct scsi_cmnd *)((long)THIS->var);
>> long long scsi_info;
>> 
>> scsi_info = ((cmd->device->host->host_no & 0xFF) << 24) |
>> ((cmd->device->channel & 0xFF) << 16) |
>> ((cmd->device->lun & 0xFF) << 8) |
>> (cmd->device->id & 0xFF);
>
>Well, it is obvious why you have masked, shifted and or'ed
>thoses numbers. But one might get easily in trouble doing this.
>Think about storage area networks and lots of devices being
>attached to a single Linux. For now this code works in
>most environments because the Linux SCSI stack does its
>own compact LUN enumeration. But it's not airtight.
>
>Martin
>
>  
>
I'll admit that I chose these based on my limited experience with 
storage devices. While connecting a large amount of devices in a single 
Linux system is no rare this is usually (in my experience) not done 
through a single SCSI channel. It would seem odd to me for someone to 
configure more than 256 SCSI device on a single SCSI channel, but it 
could happen. Have you seen environments were this is not the case?

I don't have a problem changing this (especially now that we do not have 
post-processing scripts that depend on the structure of the data).

-JRS



More information about the Systemtap mailing list