All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/4 ver 3] SCSI: make starget->reap_ref count the number of underlying devices
@ 2009-10-28 19:09 Alan Stern
  0 siblings, 0 replies; only message in thread
From: Alan Stern @ 2009-10-28 19:09 UTC (permalink / raw)
  To: James Bottomley; +Cc: SCSI development list

This patch (as1248c) changes the meaning of starget->reap_ref.  Now it
serves to count the number of underlying devices beneath the target,
plus one when we want to prevent an empty target from being removed 
from visibility.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

---

Index: usb-2.6/drivers/scsi/scsi_scan.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_scan.c
+++ usb-2.6/drivers/scsi/scsi_scan.c
@@ -303,6 +303,7 @@ static struct scsi_device *scsi_alloc_sd
 	transport_setup_device(&sdev->sdev_gendev);
 
 	spin_lock_irqsave(shost->host_lock, flags);
+	starget->reap_ref++;
 	list_add_tail(&sdev->same_target_siblings, &starget->devices);
 	list_add_tail(&sdev->siblings, &shost->__devices);
 	spin_unlock_irqrestore(shost->host_lock, flags);
@@ -501,8 +502,7 @@ void scsi_target_reap(struct scsi_target
 
 	spin_lock_irqsave(shost->host_lock, flags);
 	state = starget->state;
-	empty = --starget->reap_ref == 0 &&
-		list_empty(&starget->devices) ? 1 : 0;
+	empty = --starget->reap_ref == 0;
 	spin_unlock_irqrestore(shost->host_lock, flags);
 
 	if (!empty)
Index: usb-2.6/drivers/scsi/scsi_sysfs.c
===================================================================
--- usb-2.6.orig/drivers/scsi/scsi_sysfs.c
+++ usb-2.6/drivers/scsi/scsi_sysfs.c
@@ -302,7 +302,6 @@ static void scsi_device_dev_release_user
 	starget = to_scsi_target(parent);
 
 	spin_lock_irqsave(sdev->host->host_lock, flags);
-	starget->reap_ref++;
 	list_del(&sdev->siblings);
 	list_del(&sdev->same_target_siblings);
 	list_del(&sdev->starved_entry);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-10-28 19:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-28 19:09 [PATCH 4/4 ver 3] SCSI: make starget->reap_ref count the number of underlying devices Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.