From: Takahiro Yasui <tyasui@redhat.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org, mchristi@redhat.com,
mbarrow@redhat.com
Subject: Re: [RFC][PATCH] limit state change to SDEV_BLOCK devices in scsi_internal_device_unblock
Date: Mon, 27 Apr 2009 23:27:59 -0400 [thread overview]
Message-ID: <49F677BF.9020106@redhat.com> (raw)
In-Reply-To: <49F66F1F.2050803@redhat.com>
Takahiro Yasui wrote:
> Matthew Wilcox wrote:
>> On Mon, Apr 27, 2009 at 07:52:57PM -0400, Takahiro Yasui wrote:
>>> James Bottomley wrote:
>>>>> + if (sdev->sdev_state != SDEV_BLOCK)
>>>> This isn't quite correct. There are two blocked states in the model
>>>> currently: SDEV_BLOCK and SDEV_CREATED_BLOCK ... you'd need to check
>>>> for both of them
>>>>
>>>>> + return 0;
>>>> Traditionally the return for an attempted invalid state transition is
>>>> -EINVAL.
>>>>
>>>> I suppose for lower down, if you check the state, now we know we go
>>>>
>>>> SDEV_CREATED_BLOCK -> SDEV_CREATED
>>>>
>>>> or
>>>>
>>>> SDEV_BLOCK -> SDEV_RUNNING
>>>>
>>>> so there's no need for the dual scsi_device_set_state.
>>> Thank you for the comments. If I understand your comments correctly,
>>> the state transition is better to be defined in scsi_device_set_state(),
>>> and both transitions, "SDEV_CREATED_BLOCK -> SDEV_CREATED" and
>>> "SDEV_BLOCK -> SDEV_RUNNING" need to be covered. I updated the patch
>>> so that the transition of "SDEV_OFFLINE -> SDEV_RUNNING" is prohibited.
>> I don't think that's what he meant. I think he meant something more like:
I have one question about the order of comparisons. The original code
tries to change to SDEV_BLOCK first and retries to SDEV_CREATED.
If they are transformed just that order, I think that comparisons will
be as follows.
if (sdev->sdev_state == SDEV_BLOCK)
sdev->sdev_state = SDEV_RUNNING;
else if (sdev->sdev_state == SDEV_CREATED_BLOCK)
sdev->sdev_state = SDEV_CREATED;
else
return -EINVAL;
Is this wrong order?
Regards,
---
Takahiro Yasui
Hitachi Computer Products (America), Inc.
prev parent reply other threads:[~2009-04-28 3:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-27 17:09 [RFC][PATCH] limit state change to SDEV_BLOCK devices in scsi_internal_device_unblock Takahiro Yasui
2009-04-27 18:03 ` Matthew Wilcox
2009-04-27 19:43 ` Takahiro Yasui
2009-04-27 20:08 ` James Bottomley
2009-04-27 23:52 ` Takahiro Yasui
2009-04-28 2:31 ` Matthew Wilcox
2009-04-28 2:51 ` Takahiro Yasui
2009-04-28 3:27 ` Takahiro Yasui [this message]
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=49F677BF.9020106@redhat.com \
--to=tyasui@redhat.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=linux-scsi@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mbarrow@redhat.com \
--cc=mchristi@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).