* [PATCH] helper for device list traversal
@ 2003-09-20 13:24 Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2003-09-20 13:24 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
This patch adds shost_for_each_device(). It's used to abstract out
scsi_host.my_devices traversal. The next step will be to replace
the current simple implementation with one that's fully locked down
an reference counted.
--- 1.34/drivers/scsi/dpt_i2o.c Tue Aug 26 18:25:41 2003
+++ edited/drivers/scsi/dpt_i2o.c Sat Sep 20 14:04:56 2003
@@ -2483,7 +2483,7 @@
Scsi_Cmnd* cmd = NULL;
Scsi_Device* d = NULL;
- list_for_each_entry(d, &pHba->host->my_devices, siblings) {
+ shost_for_each_device(d, pHba->host) {
unsigned long flags;
spin_lock_irqsave(&d->list_lock, flags);
list_for_each_entry(cmd, &d->cmd_list, list) {
--- 1.12/drivers/scsi/fcal.c Fri May 2 21:29:48 2003
+++ edited/drivers/scsi/fcal.c Sat Sep 20 14:06:41 2003
@@ -245,7 +245,7 @@
alpa, u1[0], u1[1], u2[0], u2[1]);
} else {
Scsi_Device *scd;
- list_for_each_entry (scd, &host->my_devices, siblings)
+ shost_for_each_device(scd, host)
if (scd->id == target) {
SPRINTF (" [AL-PA: %02x, Id: %02d, Port WWN: %08x%08x, Node WWN: %08x%08x] ",
alpa, target, u1[0], u1[1], u2[0], u2[1]);
--- 1.22/drivers/scsi/g_NCR5380.c Thu Aug 21 10:36:23 2003
+++ edited/drivers/scsi/g_NCR5380.c Sat Sep 20 14:07:14 2003
@@ -825,7 +825,7 @@
PRINTP(" %d pending writes" ANDP hostdata->pendingw);
if (hostdata->pendingr || hostdata->pendingw)
PRINTP("\n");
- list_for_each_entry (dev, &scsi_ptr->my_devices, siblings) {
+ shost_for_each_device(dev, scsi_ptr) {
unsigned long br = hostdata->bytes_read[dev->id];
unsigned long bw = hostdata->bytes_write[dev->id];
long tr = hostdata->time_read[dev->id] / HZ;
--- 1.63/drivers/scsi/scsi_error.c Sat Sep 20 11:11:42 2003
+++ edited/drivers/scsi/scsi_error.c Sat Sep 20 13:53:02 2003
@@ -211,8 +211,7 @@
int cmd_cancel = 0;
int devices_failed = 0;
-
- list_for_each_entry(sdev, &shost->my_devices, siblings) {
+ shost_for_each_device(sdev, shost) {
list_for_each_entry(scmd, work_q, eh_entry) {
if (scmd->device == sdev) {
++total_failures;
@@ -850,7 +849,7 @@
struct scsi_device *sdev;
int rtn;
- list_for_each_entry(sdev, &shost->my_devices, siblings) {
+ shost_for_each_device(sdev, shost) {
bdr_scmd = NULL;
list_for_each_entry(scmd, work_q, eh_entry)
if (scmd->device == sdev) {
@@ -1363,9 +1362,10 @@
* onto the head of the SCSI request queue for the device. There
* is no point trying to lock the door of an off-line device.
*/
- list_for_each_entry(sdev, &shost->my_devices, siblings)
+ shost_for_each_device(sdev, shost) {
if (sdev->online && sdev->locked)
scsi_eh_lock_door(sdev);
+ }
/*
* next free up anything directly waiting upon the host. this
@@ -1621,7 +1621,7 @@
{
struct scsi_device *sdev;
- list_for_each_entry(sdev, &shost->my_devices, siblings) {
+ shost_for_each_device(sdev, shost) {
if (channel == sdev->channel) {
sdev->was_reset = 1;
sdev->expecting_cc_ua = 1;
@@ -1655,7 +1655,7 @@
{
struct scsi_device *sdev;
- list_for_each_entry(sdev, &shost->my_devices, siblings) {
+ shost_for_each_device(sdev, shost) {
if (channel == sdev->channel &&
target == sdev->id) {
sdev->was_reset = 1;
--- 1.112/drivers/scsi/scsi_lib.c Sat Sep 20 11:11:42 2003
+++ edited/drivers/scsi/scsi_lib.c Sat Sep 20 13:53:02 2003
@@ -462,7 +462,7 @@
{
struct scsi_device *sdev;
- list_for_each_entry(sdev, &shost->my_devices, siblings)
+ shost_for_each_device(sdev, shost)
scsi_run_queue(sdev->request_queue);
}
--- 1.25/drivers/scsi/arm/fas216.c Mon Aug 25 15:37:34 2003
+++ edited/drivers/scsi/arm/fas216.c Sat Sep 20 14:08:01 2003
@@ -2592,7 +2592,7 @@
* all command structures. Leave the running
* command in place.
*/
- list_for_each_entry(SDpnt, &info->host->my_devices, siblings) {
+ shost_for_each_device(SDpnt, info->host) {
int i;
if (SDpnt->soft_reset)
@@ -3007,7 +3007,7 @@
p += sprintf(p, "Device/Lun TaggedQ Parity Sync\n");
- list_for_each_entry(scd, &info->host->my_devices, siblings) {
+ shost_for_each_device(scd, info->host) {
dev = &info->device[scd->id];
p += sprintf(p, " %d/%d ", scd->id, scd->lun);
if (scd->tagged_supported)
--- 1.6/include/scsi/scsi_device.h Mon Aug 25 15:37:34 2003
+++ edited/include/scsi/scsi_device.h Sat Sep 20 14:10:27 2003
@@ -111,6 +111,9 @@
extern int scsi_device_get(struct scsi_device *);
extern void scsi_device_put(struct scsi_device *);
+#define shost_for_each_device(sdev, shost) \
+ list_for_each_entry((sdev), &((shost)->my_devices), siblings)
+
extern void scsi_adjust_queue_depth(struct scsi_device *, int, int);
extern int scsi_track_queue_full(struct scsi_device *, int);
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] helper for device list traversal
[not found] <200309270508.h8R58tHE015032@hera.kernel.org>
@ 2003-09-27 11:34 ` Geert Uytterhoeven
2003-09-27 11:39 ` Christoph Hellwig
2003-09-27 12:15 ` Christoph Hellwig
0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2003-09-27 11:34 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Linux Kernel Development
On Thu, 25 Sep 2003, Linux Kernel Mailing List wrote:
> ChangeSet 1.1217.10.16, 2003/09/25 12:10:17-05:00, hch@lst.de
>
> [PATCH] helper for device list traversal
>
> This patch adds shost_for_each_device(). It's used to abstract out
> scsi_host.my_devices traversal. The next step will be to replace
> the current simple implementation with one that's fully locked down
> an reference counted.
Is this what we should use to fix the currently broken list traversal[*] in
drivers/scsi/{a2091,gvp11,53c7xx}.c?
Currently ut uses
struct Scsi_Host *instance;
for (instance = first_instance; instance &&
instance->hostt == xxx_template; instance = instance->next)
bust Scsi_Host.next was removed a while ago...
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] helper for device list traversal
2003-09-27 11:34 ` Geert Uytterhoeven
@ 2003-09-27 11:39 ` Christoph Hellwig
2003-09-27 12:15 ` Geert Uytterhoeven
2003-09-27 12:15 ` Christoph Hellwig
1 sibling, 1 reply; 6+ messages in thread
From: Christoph Hellwig @ 2003-09-27 11:39 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Christoph Hellwig, Linux Kernel Development
On Sat, Sep 27, 2003 at 01:34:15PM +0200, Geert Uytterhoeven wrote:
> Is this what we should use to fix the currently broken list traversal[*] in
> drivers/scsi/{a2091,gvp11,53c7xx}.c?
where does that [*] refere to?
> Currently ut uses
>
> struct Scsi_Host *instance;
> for (instance = first_instance; instance &&
> instance->hostt == xxx_template; instance = instance->next)
>
> bust Scsi_Host.next was removed a while ago...
Most users of that construct want to use scsi_lookup_host (if they
looked for a specific host struct).
Above patch is for scsi_device list traversal, not Scsi_Host.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] helper for device list traversal
2003-09-27 11:39 ` Christoph Hellwig
@ 2003-09-27 12:15 ` Geert Uytterhoeven
2003-09-27 12:18 ` Christoph Hellwig
0 siblings, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 2003-09-27 12:15 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Linux Kernel Development
On Sat, 27 Sep 2003, Christoph Hellwig wrote:
> On Sat, Sep 27, 2003 at 01:34:15PM +0200, Geert Uytterhoeven wrote:
> > Is this what we should use to fix the currently broken list traversal[*] in
> > drivers/scsi/{a2091,gvp11,53c7xx}.c?
>
> where does that [*] refere to?
To the part below. Sorry, I changed the structure of the mail but forgot to
remove the [*].
> > Currently ut uses
> >
> > struct Scsi_Host *instance;
> > for (instance = first_instance; instance &&
> > instance->hostt == xxx_template; instance = instance->next)
> >
> > bust Scsi_Host.next was removed a while ago...
>
> Most users of that construct want to use scsi_lookup_host (if they
> looked for a specific host struct).
The A2091 and GVP-II drivers want to traverse the list of SCSI host adapters in
their interrupt handler, to find their Scsi_Host instances and check whether
the (shared) interrupt was meant for one of them.
An alternative would be to register the interrupt handler multiple times and
use the Scsi_Host instance pointer as the interrupt handler data pointer.
For 53c7xx it's a bit more complex, I don't know anything about its internals.
In all 3 cases, I don't have the hardware...
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] helper for device list traversal
2003-09-27 11:34 ` Geert Uytterhoeven
2003-09-27 11:39 ` Christoph Hellwig
@ 2003-09-27 12:15 ` Christoph Hellwig
1 sibling, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2003-09-27 12:15 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Christoph Hellwig, Linux Kernel Development
On Sat, Sep 27, 2003 at 01:34:15PM +0200, Geert Uytterhoeven wrote:
> On Thu, 25 Sep 2003, Linux Kernel Mailing List wrote:
> > ChangeSet 1.1217.10.16, 2003/09/25 12:10:17-05:00, hch@lst.de
> >
> > [PATCH] helper for device list traversal
> >
> > This patch adds shost_for_each_device(). It's used to abstract out
> > scsi_host.my_devices traversal. The next step will be to replace
> > the current simple implementation with one that's fully locked down
> > an reference counted.
>
> Is this what we should use to fix the currently broken list traversal[*] in
> drivers/scsi/{a2091,gvp11,53c7xx}.c?
>
> Currently ut uses
>
> struct Scsi_Host *instance;
> for (instance = first_instance; instance &&
> instance->hostt == xxx_template; instance = instance->next)
>
> bust Scsi_Host.next was removed a while ago...
Urgg. This is totally hosed. The drivers should be fixed up to
pass the right host to request_irq and the only handle the right
one in the isr instead of walking a lits of all hosts of that template..
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] helper for device list traversal
2003-09-27 12:15 ` Geert Uytterhoeven
@ 2003-09-27 12:18 ` Christoph Hellwig
0 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2003-09-27 12:18 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Christoph Hellwig, Linux Kernel Development
On Sat, Sep 27, 2003 at 02:15:56PM +0200, Geert Uytterhoeven wrote:
> The A2091 and GVP-II drivers want to traverse the list of SCSI host adapters in
> their interrupt handler, to find their Scsi_Host instances and check whether
> the (shared) interrupt was meant for one of them.
>
> An alternative would be to register the interrupt handler multiple times and
> use the Scsi_Host instance pointer as the interrupt handler data pointer.
Yes, they should do that.
> For 53c7xx it's a bit more complex, I don't know anything about its internals.
The occurance in #if 0 code should probably use scsi_lookup_host.
process_issue_queue needs to be rewritten to be per-host.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-09-27 12:18 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-20 13:24 [PATCH] helper for device list traversal Christoph Hellwig
[not found] <200309270508.h8R58tHE015032@hera.kernel.org>
2003-09-27 11:34 ` Geert Uytterhoeven
2003-09-27 11:39 ` Christoph Hellwig
2003-09-27 12:15 ` Geert Uytterhoeven
2003-09-27 12:18 ` Christoph Hellwig
2003-09-27 12:15 ` Christoph Hellwig
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.