public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Matthew Wilcox <matthew@wil.cx>
To: Rob Landley <rob@landley.net>
Cc: James Bottomley <James.Bottomley@steeleye.com>,
	linux-scsi@vger.kernel.org
Subject: Re: Questions about proc_scsi_write() in scsi_proc.c
Date: Fri, 26 Oct 2007 16:58:19 -0600	[thread overview]
Message-ID: <20071026225819.GU27248@parisc-linux.org> (raw)
In-Reply-To: <200710261729.53400.rob@landley.net>

On Fri, Oct 26, 2007 at 05:29:53PM -0500, Rob Landley wrote:
> Ok, I'm unclear on what a LUN is.  All the devices I have lying around give me 
> a LUN of zero.  I used to think that a LUN was a bit like partition, and 
> mostly used for CD changes.  The structure "scsi_target" seems to aggregate 
> host/channel/target and I thought it referred to a device.

Maybe the best way to understand this is by analogy with PCI.  With PCI,
you have a 5-bit device id and a 3-bit function ID.  Most physical
devices implement only one function, but we create a pci_dev for every
implemented function.  I'm not sure how many bits we have for target and
lun in SCSI, but it works much the same way; the target is the physical
thing, and the LUN is a logical entity within that hunk of hardware.  We
create a scsi_device for each LUN.

> Every device I have that shows up as SCSI has shown up with a LUN of 0, which 
> is target-wide unique because none of those targets have sub-functions that 
> need to be independently addressed as devices.

I have two devices with multiple LUNs.  One is a Plasmon PD-2000 combo
CD-reader and optical-disc.  If you put a CD-ROM in it, that's LUN 0
(sr) and if you put an optical disc in it, that shows up on LUN 1 (sd).

The other device is an HP fibre-channel Virtual Array which is a 3U
piece of metal with up to 15 drives inside it.  It splits those discs
up into as many LUNs as you configure it to, at whatever RAID level you
configure it to, and (in my configuration) presents itself as a single
target with 128 LUNs.

Not all storage arrays behave like that; I have another HP array that
presents each disc within it as an individual target, and the controller
is another target (it shows up as a PROCESSOR device).  In this scenario,
you only have LUN 0 on each target.

I'm sure there are plenty of other examples, but hopefully this will
help.

-- 
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

      parent reply	other threads:[~2007-10-26 22:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-26 20:07 Questions about proc_scsi_write() in scsi_proc.c Rob Landley
2007-10-26 21:09 ` James Bottomley
2007-10-26 22:29   ` Rob Landley
2007-10-26 22:47     ` James Bottomley
2007-10-27  4:16       ` Rob Landley
2007-10-26 22:58     ` Matthew Wilcox [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071026225819.GU27248@parisc-linux.org \
    --to=matthew@wil.cx \
    --cc=James.Bottomley@steeleye.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=rob@landley.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox