All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: James.Bottomley@hansenpartnership.com
Cc: linux-scsi@vger.kernel.org
Subject: [PATCH 1/3] libsas: sas_queuecommand doesnt need host_lock
Date: Mon, 11 Jul 2011 14:49:23 -0400	[thread overview]
Message-ID: <20110711185045.179355504@bombadil.infradead.org> (raw)
In-Reply-To: 20110711184922.859239377@bombadil.infradead.org

[-- Attachment #1: libsas-unlocked-queuecommand --]
[-- Type: text/plain, Size: 2221 bytes --]


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/drivers/scsi/libsas/sas_scsi_host.c
===================================================================
--- linux-2.6.orig/drivers/scsi/libsas/sas_scsi_host.c	2011-07-02 13:40:58.777796133 +0200
+++ linux-2.6/drivers/scsi/libsas/sas_scsi_host.c	2011-07-02 13:42:22.504461759 +0200
@@ -182,27 +182,12 @@ int sas_queue_up(struct sas_task *task)
 	return 0;
 }
 
-/**
- * sas_queuecommand -- Enqueue a command for processing
- * @parameters: See SCSI Core documentation
- *
- * Note: XXX: Remove the host unlock/lock pair when SCSI Core can
- * call us without holding an IRQ spinlock...
- */
-static int sas_queuecommand_lck(struct scsi_cmnd *cmd,
-		     void (*scsi_done)(struct scsi_cmnd *))
-	__releases(host->host_lock)
-	__acquires(dev->sata_dev.ap->lock)
-	__releases(dev->sata_dev.ap->lock)
-	__acquires(host->host_lock)
+int sas_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 {
 	int res = 0;
 	struct domain_device *dev = cmd_to_domain_dev(cmd);
-	struct Scsi_Host *host = cmd->device->host;
 	struct sas_internal *i = to_sas_internal(host->transportt);
 
-	spin_unlock_irq(host->host_lock);
-
 	{
 		struct sas_ha_struct *sas_ha = dev->port->ha;
 		struct sas_task *task;
@@ -210,7 +195,7 @@ static int sas_queuecommand_lck(struct s
 		/* If the device fell off, no sense in issuing commands */
 		if (dev->gone) {
 			cmd->result = DID_BAD_TARGET << 16;
-			scsi_done(cmd);
+			cmd->scsi_done(cmd);
 			goto out;
 		}
 
@@ -228,7 +213,6 @@ static int sas_queuecommand_lck(struct s
 		if (!task)
 			goto out;
 
-		cmd->scsi_done = scsi_done;
 		/* Queue up, Direct Mode or Task Collector Mode. */
 		if (sas_ha->lldd_max_execute_num < 2)
 			res = i->dft->lldd_execute_task(task, 1, GFP_ATOMIC);
@@ -243,18 +227,15 @@ static int sas_queuecommand_lck(struct s
 			if (res == -SAS_QUEUE_FULL) {
 				cmd->result = DID_SOFT_ERROR << 16; /* retry */
 				res = 0;
-				scsi_done(cmd);
+				cmd->scsi_done(cmd);
 			}
 			goto out;
 		}
 	}
 out:
-	spin_lock_irq(host->host_lock);
 	return res;
 }
 
-DEF_SCSI_QCMD(sas_queuecommand)
-
 static void sas_eh_finish_cmd(struct scsi_cmnd *cmd)
 {
 	struct sas_task *task = TO_SAS_TASK(cmd);


  reply	other threads:[~2011-07-11 18:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-11 18:49 [PATCH 0/3] RFC: libsas queuecommand fixups Christoph Hellwig
2011-07-11 18:49 ` Christoph Hellwig [this message]
2011-07-18 23:40   ` [PATCH 1/3] libsas: sas_queuecommand doesnt need host_lock Dan Williams
2011-07-18 23:42     ` Jiang, Dave
2011-07-19  8:56     ` Jack Wang
2011-07-23  2:05       ` 'Christoph Hellwig'
2011-07-11 18:49 ` [PATCH 2/3] libsas: reindent sas_queuecommand Christoph Hellwig
2011-07-11 18:49 ` [PATCH 3/3] libsas: fix sas_queuecommand return values Christoph Hellwig
2011-07-12  1:16   ` Jack Wang
2011-07-16 19:00   ` [PATCH 3/3 v2] " Christoph Hellwig
2011-07-12 22:10 ` [PATCH 0/3] RFC: libsas queuecommand fixups ersatz splatt
2011-08-22 14:45 ` Christoph Hellwig
2011-08-23 13:57   ` James Bottomley
2011-08-24  1:16     ` ersatz splatt

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=20110711185045.179355504@bombadil.infradead.org \
    --to=hch@infradead.org \
    --cc=James.Bottomley@hansenpartnership.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 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.