public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add back single_lun support
@ 2003-02-05 22:51 Patrick Mansfield
  2003-02-05 23:14 ` James Bottomley
  0 siblings, 1 reply; 4+ messages in thread
From: Patrick Mansfield @ 2003-02-05 22:51 UTC (permalink / raw)
  To: linux-scsi, James Bottomley

This patch against the current scsi-misc-2.5 adds back the check for the
single_lun case.

I compiled and booted with this applied but don't have any devices (i.e.
CD ROM changer) for testing.

--- 1.66/drivers/scsi/scsi_lib.c	Wed Feb  5 08:33:15 2003
+++ edited/drivers/scsi/scsi_lib.c	Tue Feb 11 14:27:08 2003
@@ -787,6 +787,22 @@
 	return ret;
 }
 
+/*
+ * The target associated with myself can only handle one active command at
+ * a time. Scan through all of the luns on the same target as myself,
+ * return 1 if any are active.
+ */
+static int check_all_luns(struct scsi_device *myself)
+{
+	struct scsi_device *sdev;
+
+	list_for_each_entry(sdev, &myself->same_target_siblings,
+			    same_target_siblings)
+		if (atomic_read(&sdev->device_active))
+			return 1;
+	return 0;
+}
+
 int scsi_prep_fn(struct request_queue *q, struct request *req)
 {
 	struct Scsi_Device_Template *STpnt;
@@ -948,6 +964,9 @@
 		req = elv_next_request(q);
 
 		if (SDpnt->device_busy >= SDpnt->queue_depth)
+			break;
+
+		if (SDpnt->single_lun && check_all_luns(SDpnt))
 			break;
 
 		if(SHpnt->host_busy == 0 && SHpnt->host_blocked) {


-- Patrick Mansfield

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

end of thread, other threads:[~2003-02-06 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-02-05 22:51 [PATCH] add back single_lun support Patrick Mansfield
2003-02-05 23:14 ` James Bottomley
2003-02-06  1:16   ` Patrick Mansfield
2003-02-06 14:27   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox