From: Brian King <brking@us.ibm.com>
To: brking@us.ibm.com
Cc: linux-ide@vger.kernel.org
Subject: [RFC 1/2] libata: configurable host_set lock
Date: Mon, 03 Oct 2005 16:58:09 -0500 [thread overview]
Message-ID: <4341A971.6090404@us.ibm.com> (raw)
In-Reply-To: <4341A91A.3020000@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: libata_lock_change.patch --]
[-- Type: text/plain, Size: 5949 bytes --]
Allow the spinlock used by libata to be overridden.
Signed-off-by: Brian King <brking@us.ibm.com>
---
linux-2.6-bjking1/drivers/scsi/libata-core.c | 41 +++++++++++++--------------
linux-2.6-bjking1/include/linux/libata.h | 8 ++++-
2 files changed, 28 insertions(+), 21 deletions(-)
diff -puN include/linux/libata.h~libata_lock_change include/linux/libata.h
--- linux-2.6/include/linux/libata.h~libata_lock_change 2005-09-26 14:22:57.000000000 -0500
+++ linux-2.6-bjking1/include/linux/libata.h 2005-09-26 14:22:57.000000000 -0500
@@ -214,7 +214,8 @@ struct ata_probe_ent {
};
struct ata_host_set {
- spinlock_t lock;
+ spinlock_t *lock;
+ spinlock_t default_lock;
struct device *dev;
unsigned long irq;
void __iomem *mmio_base;
@@ -669,4 +670,9 @@ static inline int ata_try_flush_cache(st
ata_id_has_flush_ext(dev->id);
}
+static inline void ata_assign_lock(struct ata_host_set *host_set, spinlock_t *lock)
+{
+ host_set->lock = lock;
+}
+
#endif /* __LINUX_LIBATA_H__ */
diff -puN drivers/scsi/libata-core.c~libata_lock_change drivers/scsi/libata-core.c
--- linux-2.6/drivers/scsi/libata-core.c~libata_lock_change 2005-09-26 14:22:57.000000000 -0500
+++ linux-2.6-bjking1/drivers/scsi/libata-core.c 2005-09-26 14:22:57.000000000 -0500
@@ -308,9 +308,9 @@ static inline void ata_exec(struct ata_p
unsigned long flags;
DPRINTK("ata%u: cmd 0x%X\n", ap->id, tf->command);
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
ap->ops->exec_command(ap, tf);
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
}
/**
@@ -1179,9 +1179,9 @@ retry:
qc->waiting = &wait;
qc->complete_fn = ata_qc_complete_noop;
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
rc = ata_qc_issue(qc);
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
if (rc)
goto err_out;
@@ -2131,9 +2131,9 @@ static void ata_dev_set_xfermode(struct
qc->waiting = &wait;
qc->complete_fn = ata_qc_complete_noop;
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
rc = ata_qc_issue(qc);
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
if (rc)
ata_port_disable(ap);
@@ -2404,11 +2404,11 @@ void ata_poll_qc_complete(struct ata_que
struct ata_port *ap = qc->ap;
unsigned long flags;
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
ap->flags &= ~ATA_FLAG_NOINTR;
ata_irq_on(ap);
ata_qc_complete(qc, drv_stat);
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
}
/**
@@ -2962,9 +2962,9 @@ static void atapi_request_sense(struct a
qc->waiting = &wait;
qc->complete_fn = ata_qc_complete_noop;
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
rc = ata_qc_issue(qc);
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
if (rc)
ata_port_disable(ap);
@@ -3010,9 +3010,9 @@ static void ata_qc_timeout(struct ata_qu
if (!(cmd->eh_eflags & SCSI_EH_CANCEL_CMD)) {
/* finish completing original command */
- spin_lock_irqsave(&host_set->lock, flags);
+ spin_lock_irqsave(host_set->lock, flags);
__ata_qc_complete(qc);
- spin_unlock_irqrestore(&host_set->lock, flags);
+ spin_unlock_irqrestore(host_set->lock, flags);
atapi_request_sense(ap, dev, cmd);
@@ -3023,7 +3023,7 @@ static void ata_qc_timeout(struct ata_qu
}
}
- spin_lock_irqsave(&host_set->lock, flags);
+ spin_lock_irqsave(host_set->lock, flags);
/* hack alert! We cannot use the supplied completion
* function from inside the ->eh_strategy_handler() thread.
@@ -3059,7 +3059,7 @@ static void ata_qc_timeout(struct ata_qu
break;
}
- spin_unlock_irqrestore(&host_set->lock, flags);
+ spin_unlock_irqrestore(host_set->lock, flags);
out:
DPRINTK("EXIT\n");
@@ -3726,7 +3726,7 @@ irqreturn_t ata_interrupt (int irq, void
unsigned long flags;
/* TODO: make _irqsave conditional on x86 PCI IDE legacy mode */
- spin_lock_irqsave(&host_set->lock, flags);
+ spin_lock_irqsave(host_set->lock, flags);
for (i = 0; i < host_set->n_ports; i++) {
struct ata_port *ap;
@@ -3743,7 +3743,7 @@ irqreturn_t ata_interrupt (int irq, void
}
}
- spin_unlock_irqrestore(&host_set->lock, flags);
+ spin_unlock_irqrestore(host_set->lock, flags);
return IRQ_RETVAL(handled);
}
@@ -3796,12 +3796,12 @@ static void atapi_packet_task(void *_dat
* interrupt handler shouldn't be invoked before we're
* finished. Hence, the following locking.
*/
- spin_lock_irqsave(&ap->host_set->lock, flags);
+ spin_lock_irqsave(ap->host_set->lock, flags);
ap->flags &= ~ATA_FLAG_NOINTR;
ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
if (qc->tf.protocol == ATA_PROT_ATAPI_DMA)
ap->ops->bmdma_start(qc); /* initiate bmdma */
- spin_unlock_irqrestore(&ap->host_set->lock, flags);
+ spin_unlock_irqrestore(ap->host_set->lock, flags);
} else {
ata_data_xfer(ap, qc->cdb, ap->cdb_len, 1);
@@ -3916,7 +3916,7 @@ static void ata_host_init(struct ata_por
host->unique_id = ata_unique_id++;
host->max_cmd_len = 12;
- scsi_assign_lock(host, &host_set->lock);
+ scsi_assign_lock(host, host_set->lock);
ap->flags = ATA_FLAG_PORT_DISABLED;
ap->id = host->unique_id;
@@ -4026,7 +4026,8 @@ int ata_device_add(struct ata_probe_ent
if (!host_set)
return 0;
memset(host_set, 0, sizeof(struct ata_host_set) + (ent->n_ports * sizeof(void *)));
- spin_lock_init(&host_set->lock);
+ spin_lock_init(&host_set->default_lock);
+ ata_assign_lock(host_set, &host_set->default_lock);
host_set->dev = dev;
host_set->n_ports = ent->n_ports;
_
next prev parent reply other threads:[~2005-10-03 21:58 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-03 21:56 [RFC 0/2] libata: support SATA devices on SAS HBAs Brian King
2005-10-03 21:58 ` Brian King [this message]
2005-10-03 21:58 ` [RFC 2/2] " Brian King
2005-10-04 9:56 ` [RFC 0/2] " Jeff Garzik
2005-10-04 10:22 ` Bartlomiej Zolnierkiewicz
2005-10-04 20:56 ` Bartlomiej Zolnierkiewicz
2005-10-05 20:59 ` Jeff Garzik
2005-10-24 22:17 ` [PATCH " Brian King
2005-10-24 22:19 ` [PATCH 1/2] libata: Remove dependence on host_set->dev for SAS Brian King
2005-10-25 17:53 ` Jeff Garzik
2005-10-25 19:30 ` Brian King
2005-10-25 19:43 ` Jeff Garzik
2005-10-25 22:48 ` Luben Tuikov
2005-10-27 16:05 ` Brian King
2005-10-27 20:15 ` Luben Tuikov
2005-11-24 0:53 ` Douglas Gilbert
2005-11-24 1:07 ` Jeff Garzik
2005-11-24 8:12 ` Bartlomiej Zolnierkiewicz
2005-12-02 2:05 ` Jeff Garzik
2005-12-02 8:07 ` Bartlomiej Zolnierkiewicz
2005-12-02 10:28 ` Douglas Gilbert
2005-12-02 10:48 ` Jeff Garzik
2005-11-29 22:13 ` Brian King
2005-10-24 22:20 ` [PATCH 2/2] libata: Add support for SATA attachment to SAS adapters Brian King
2005-10-25 17:58 ` Jeff Garzik
2005-10-25 12:59 ` [PATCH 0/2] libata: support SATA devices on SAS HBAs Luben Tuikov
2005-10-25 13:39 ` Brian King
2005-10-25 13:40 ` Luben Tuikov
2005-10-25 13:53 ` Brian King
2005-10-25 14:08 ` Luben Tuikov
2005-10-25 14:27 ` Brian King
2005-10-25 17:51 ` Jeff Garzik
2005-10-25 17:57 ` [RFC " Brian King
2005-10-25 18:07 ` Jeff Garzik
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=4341A971.6090404@us.ibm.com \
--to=brking@us.ibm.com \
--cc=linux-ide@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.