From: Luben Tuikov <tluben@rogers.com>
To: Mike Anderson <andmike@us.ibm.com>
Cc: Alan Stern <stern@rowland.harvard.edu>, linux-scsi@vger.kernel.org
Subject: Re: Patch: change the serial_number for error-handler commands
Date: Wed, 21 May 2003 15:18:58 -0400 [thread overview]
Message-ID: <3ECBD122.3090702@rogers.com> (raw)
In-Reply-To: <20030521180308.GD1116@beaverton.ibm.com>
Mike Anderson wrote:
>
> DESC
> This patch is against scsi-misc-2.5 but also applies against 2.5.69.
>
> Move scsi command serial number to per scsi host serial number. We also
> only increment the serial number under a lock now so the race on the value
> is removed. A new serial number is also acquired in the scsi_error handler
> on new commands.
> EDESC
>
>
> drivers/scsi/hosts.h | 7 +++++++
> drivers/scsi/scsi.c | 7 ++-----
> drivers/scsi/scsi_error.c | 1 +
> 3 files changed, 10 insertions(+), 5 deletions(-)
>
> diff -puN drivers/scsi/hosts.h~scsi_serial_number drivers/scsi/hosts.h
> --- sysfs-scsi-misc-2.5/drivers/scsi/hosts.h~scsi_serial_number Wed May 21 08:41:49 2003
> +++ sysfs-scsi-misc-2.5-andmike/drivers/scsi/hosts.h Wed May 21 08:41:49 2003
> @@ -487,6 +487,8 @@ struct Scsi_Host
> struct device host_gendev;
> struct class_device class_dev;
>
> + unsigned long serial_number;
> +
> /*
> * We should ensure that this is aligned, both for better performance
> * and also because some compilers (m68k) don't automatically force
> @@ -532,6 +534,11 @@ static inline struct device *scsi_get_de
> return shost->host_gendev.parent;
> }
>
> +static inline unsigned long scsi_get_next_serial(struct Scsi_Host *shost)
> +{
> + return (++shost->serial_number) ? shost->serial_number : 1;
> +}
> +
scsi_get_next_serial()??? Do _you_ Mike like this name?
scsi_get_cmdsn() will be a lot more appropriate. It doesn't
reveal implementation (``next''), and tells that it's a serial
number for a command, ``sn'' stands for serial number pretty
universally in our society.
How about something like this:
static inline unsigned long scsi_get_cmdsn(struct Scsi_Host, *shost)
{
static const typeof(shost->serial_number) MAX_SN =
~((typeof(shost->serial_number) 0);
return shost->serial_number++ == MAX_SN ?
++shost->serial_number : shost->serial_number;
}
BTW, are you relying on memset(..., 0, sizeof(struct Scsi_Host),
to set the serial number to 0?
--
Luben
next prev parent reply other threads:[~2003-05-21 19:05 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20030516190414.GD11884@iucha.net>
2003-05-16 21:23 ` [linux-usb-devel] USB Storage oops in 2.5.69-bk8 Alan Stern
2003-05-16 21:44 ` Florin Iucha
2003-05-16 22:29 ` Mike Anderson
2003-05-17 15:29 ` Alan Stern
2003-05-17 16:33 ` David Brownell
2003-05-18 18:31 ` Alan Stern
2003-05-18 23:46 ` David Brownell
2003-05-21 15:19 ` Bug in hot-unplugging for SCSI CD-ROM Alan Stern
2003-05-17 18:38 ` [linux-usb-devel] USB Storage oops in 2.5.69-bk8 Patrick Mansfield
2003-05-31 14:35 ` Florin Iucha
2003-05-20 14:11 ` Patch: change the serial_number for error-handler commands Alan Stern
2003-05-20 21:25 ` Luben Tuikov
2003-05-21 1:19 ` Alan Stern
2003-05-21 18:03 ` Mike Anderson
2003-05-21 18:50 ` Luben Tuikov
2003-05-21 19:18 ` Luben Tuikov [this message]
2003-05-21 20:28 ` Mike Anderson
2003-05-21 21:11 ` Luben Tuikov
2003-05-21 23:15 ` Patrick Mansfield
2003-05-22 5:47 ` Luben Tuikov
2003-05-21 19:57 ` Alan Stern
2003-05-21 20:42 ` Luben Tuikov
2003-05-21 21:05 ` Alan Stern
2003-05-21 21:19 ` James Bottomley
2003-05-21 22:53 ` Mike Anderson
2003-06-11 17:41 ` PATCH: (as33) Remove /proc/scsi directory in scsi_remove_host() Alan Stern
2003-06-11 18:23 ` Mike Anderson
2003-06-12 6:04 ` Christoph Hellwig
2003-06-12 6:51 ` Mike Anderson
2003-06-12 21:00 ` PATCH: (as33b) " Alan Stern
2003-06-12 21:58 ` Mike Anderson
2003-06-13 14:38 ` Alan Stern
2003-06-15 13:01 ` Christoph Hellwig
2003-05-21 19:24 ` Patch: change the serial_number for error-handler commands Luben Tuikov
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=3ECBD122.3090702@rogers.com \
--to=tluben@rogers.com \
--cc=andmike@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.edu \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox