From: Hannes Reinecke <hare@suse.de>
To: Matthew Wilcox <matthew@wil.cx>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>,
James Bottomley <James.Bottomley@HansenPartnership.com>
Subject: Re: [PATCH] Restart scsi_device_lookup_by_target
Date: Tue, 13 Jan 2009 15:17:46 +0100 [thread overview]
Message-ID: <496CA28A.9050600@suse.de> (raw)
In-Reply-To: <20090113141141.GF29283@parisc-linux.org>
Hi Matthew,
Matthew Wilcox wrote:
> On Tue, Jan 13, 2009 at 03:02:27PM +0100, Hannes Reinecke wrote:
>> Matthew Wilcox wrote:
>>> Backwards jumps are generally disapproved of. How about:
>>>
>>> spin_lock_irqsave(shost->host_lock, flags);
>>> for (;;) {
>>> sdev = __scsi_device_lookup_by_target(starget, sdev, lun);
>>> if (!sdev || !scsi_device_get(sdev))
>>> break;
>>> }
>>> spin_unlock_irqrestore(shost->host_lock, flags);
>
>> I must say I don't really like the for(;;) construct.
>
> I'd be fine with:
>
> do {
> sdev = __scsi_device_lookup_by_target(starget, sdev, lun);
> } while (sdev && scsi_device_get(sdev));
>
> though I find that slightly less clear than the for (;;) construct.
>
Opinons differ.
Something for the maintainer to decide. James?
>> And it's really confusing as we want to find an sdev, so breaking
>> if it's _not_ found is ... weird.
>
> Those are the two conditions when we want to stop trying -- if there's
> no device or if the device we've found is bad. I can definitely see an
> argument for splitting the two conditions to make that more obvious. I
> can also see an argument for not returning an sdev in the _DEL state
> from __scsi_device_lookup_by_target in the first place.
>
Not sure if that would work with esp_scsi.c (the other user of
__scsi_device_lookup_by_target()).
And don't have a device to try it with.
But modifying __scsi_device_lookup_by_target() would alter the behaviour,
whereas this patch does not.
Cheers,
Hannes
--
Dr. Hannes Reinecke zSeries & Storage
hare@suse.de +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-01-13 14:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-13 13:50 [PATCH] Restart scsi_device_lookup_by_target Hannes Reinecke
2009-01-13 13:58 ` Matthew Wilcox
2009-01-13 14:02 ` Hannes Reinecke
2009-01-13 14:05 ` Hannes Reinecke
2009-01-13 14:11 ` Matthew Wilcox
2009-01-13 14:17 ` Hannes Reinecke [this message]
2009-01-13 15:22 ` James Bottomley
2009-01-13 15:28 ` Hannes Reinecke
2009-01-13 15:32 ` James Bottomley
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=496CA28A.9050600@suse.de \
--to=hare@suse.de \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
/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