Re: [PATCH 4/4] scsi: scsi_dh_alua: do not print target port group state if it remains unavailable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2017-04-10 at 22:18 -0300, Mauricio Faria de Oliveira wrote:
>  /*
> + * alua_state_remains - Whether a RTPG state remains the same across 2 values.
> + * @state: the state value to check for.
> + * @old_state: the old state value.
> + * @new_state: the new state value.
> + */
> +static bool alua_state_remains(int state, int old_state, int new_state)
> +{
> +	return ((old_state == state) && (new_state == state));
> +}

Hello Mauricio,

All parentheses in the return statement are superfluous. Please consider
removing these.

> +/*
> -	alua_rtpg_print(sdev, pg, &valid_states);
> +
> +	/* Print RTPG information (except if state remains 'unavailable'). */
> +	if (likely(!alua_state_remains(SCSI_ACCESS_STATE_UNAVAILABLE,
> +					orig_state, pg->state)))
> +		alua_rtpg_print(sdev, pg, &valid_states);

Using "likely()" may prevent the CPU branch predictor to do it's work so in
kernel code usually likely() is only used in code that is in the hot path.

Thanks,

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux