Re: [v5 2/4] mpt3sas: Fix Sync cache command failure during driver unload

From: Andy Shevchenko
Date: Thu Oct 18 2018 - 03:23:34 EST


On Thu, Oct 18, 2018 at 10:11 AM Suganath Prabu Subramani
<suganath-prabu.subramani@xxxxxxxxxxxx> wrote:
>
>
>
> On Wed, Oct 17, 2018 at 2:02 PM Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
>>
>> On Wed, Oct 17, 2018 at 8:59 AM Suganath Prabu
>> <suganath-prabu.subramani@xxxxxxxxxxxx> wrote:
>> >
>> > This is to fix Sync cache and start stop command
>> > failures with DID_NO_CONNECT during driver unload.
>> >
>> > 1) Release drives first from SML, then remove internally
>> > in driver.
>> > 2) And allow sync cache and Start stop commands to firmware,
>> > even when remove_host flag is set.
>>
>> > + if (ioc->hba_mpi_version_belonged == MPI2_VERSION) {
>> > + if (ioc->remove_host)
>> > + return false;
>> > +
>> > + return true;
>> > + }
>> > +
>> > + if (ioc->remove_host) {
>> > +
>> > + switch (scmd->cmnd[0]) {
>> > + case SYNCHRONIZE_CACHE:
>> > + case START_STOP:
>> > + return true;
>> > + default:
>> > + return false;
>> > + }
>> > + }
>> > +
>> > + return true;
>>
>> Wouldn't be the same as

>> Yes it is same, but i feel original code is more readable.

OK (I didn't compare assembly, but I assume this is slow path).

>> if (!ioc->remove_host || ioc->hba_mpi_version_belonged == MPI2_VERSION)
>> return !ioc->remove_host;
>>
>> switch (scmd->cmnd[0]) {
>> case SYNCHRONIZE_CACHE:
>> case START_STOP:
>> return true;
>> default:
>> return false;
>> }
>>
>> ?
>>
>> --
>> With Best Regards,
>> Andy Shevchenko



--
With Best Regards,
Andy Shevchenko