Re: [PATCH v2 1/3] blktrace: introduce 'blk_trace_{start,stop}' helper

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

 



> +static int blk_trace_start(struct blk_trace *bt)
> +{
> +	/*
> +	 * For starting a trace, we can transition from a setup or stopped
> +	 * trace.
> +	 */

That's pretty obvious from the check, isn't it?

> +	if (bt->trace_state == Blktrace_setup ||
> +	    bt->trace_state == Blktrace_stopped) {

I'd invert the check and return early from the function for the error
case so that the real starting code is in the main path.

> +static int blk_trace_stop(struct blk_trace *bt)
> +{
> +	/*
> +	 * For stopping a trace, the state must be running
> +	 */
> +	if (bt->trace_state == Blktrace_running) {

The same two comments apply here as well.



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux