public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Vasquez <andrew.vasquez@qlogic.com>
To: James Bottomley <James.Bottomley@SteelEye.com>
Cc: Joe Scsi <joe.scsi@gmail.com>,
	SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [RFC] target code updates to support scanned targets
Date: Tue, 15 Feb 2005 16:53:25 -0800	[thread overview]
Message-ID: <20050216005325.GC6859@plap.qlogic.org> (raw)
In-Reply-To: <1108513997.5539.76.camel@mulgrave>

On Tue, 15 Feb 2005, James Bottomley wrote:

> On Tue, 2005-02-15 at 15:29 -0800, Joe Scsi wrote:
> > I see the internal changes to scsi_scan.c that this refers to, but
> > I'm not totally clear on what a driver should do to allocate a target
> > and scan it when it finds out about a new target port.
> 
> A driver doesn't allocate a target.  In this code, a target device is
> purely a LUN container and is managed by the mid-layer.  The driver
> requests the scan of a target by parent device, channel and id.  This
> request for a scan creates and parents the target object, but reaps it
> again if no actual LUNs are discovered.
> 

Yes, but the parent needs to know if the starget is actually created.
With the fc_rports snapshot I've been working with, I've coded up the
following:

+	scsi_scan_target(&rport->dev, rport->channel, rport->scsi_target_id,
+	    SCAN_WILD_CARD, 0);
+
+	dev = container_of(rport->dev.children.next, struct device, node);
+	rport->starget = to_scsi_target(dev);
+	if (unlikely(!rport->starget))
		dev_printk(KERN_ERR, &rport->dev, TGT_ALLOC_FAILURE_MSG,
				__FUNCTION__, shost->host_no);

so when the rport gets dropped (i.e. fc_remote_port_delete()), a
scsi_remove_target() call can be issued.  I'm not entirely thrilled
with the structure-member poking (any other suggestions on how to get
the child, welcomed), but it does work.

Also, the patch neglected to add scsi_scan_target() to an appropriate
header file.  Attached patch will cure -- I've added it to
scsi_host.h, may wish to add to scsi_device.h.

--
AV

diff -Nurdp -X ../8.x/dontdiff-bk scsi-rport-orig/include/scsi/scsi_host.h scsi-rport/include/scsi/scsi_host.h
--- scsi-rport-orig/include/scsi/scsi_host.h	2005-02-15 17:10:42.000000000 -0800
+++ scsi-rport/include/scsi/scsi_host.h	2005-02-15 15:45:21.000000000 -0800
@@ -575,6 +575,8 @@ extern void scsi_remove_host(struct Scsi
 extern struct Scsi_Host *scsi_host_get(struct Scsi_Host *);
 extern void scsi_host_put(struct Scsi_Host *t);
 extern struct Scsi_Host *scsi_host_lookup(unsigned short);
+extern void scsi_scan_target(struct device *, unsigned int, unsigned int,
+	unsigned int, int);
 
 extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
 

  reply	other threads:[~2005-02-16  0:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-15 23:29 [RFC] target code updates to support scanned targets Joe Scsi
2005-02-16  0:33 ` James Bottomley
2005-02-16  0:53   ` Andrew Vasquez [this message]
2005-02-16  1:46     ` James Bottomley
2005-02-16 17:54       ` Andrew Vasquez
2005-02-17 19:32         ` Andrew Vasquez
2005-02-16  0:54   ` Joe Scsi
2005-02-16  1:49     ` James Bottomley
  -- strict thread matches above, loose matches on Subject: below --
2005-02-15 22:38 James Bottomley

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=20050216005325.GC6859@plap.qlogic.org \
    --to=andrew.vasquez@qlogic.com \
    --cc=James.Bottomley@SteelEye.com \
    --cc=joe.scsi@gmail.com \
    --cc=linux-scsi@vger.kernel.org \
    /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