From: Matthew Wilcox <matthew@wil.cx>
To: Hannes Reinecke <hare@suse.de>
Cc: SCSI Mailing List <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH] Restart scsi_device_lookup_by_target
Date: Tue, 13 Jan 2009 07:11:41 -0700 [thread overview]
Message-ID: <20090113141141.GF29283@parisc-linux.org> (raw)
In-Reply-To: <496C9EF3.2090409@suse.de>
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.
> 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.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
next prev parent reply other threads:[~2009-01-13 14:11 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 [this message]
2009-01-13 14:17 ` Hannes Reinecke
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=20090113141141.GF29283@parisc-linux.org \
--to=matthew@wil.cx \
--cc=hare@suse.de \
--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.