Re: [PATCH] Make SCSI Status CONDITION MET equivalent to GOOD

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

 



On Wed, 2018-02-21 at 20:48 -0500, Douglas Gilbert wrote:
> +	if (result) {
> +		if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
> +			/* if ATA PASS-THROUGH INFORMATION AVAILABLE skip
> +			 * print since caller wants ATA registers. Only occurs
> +			 * on SCSI ATA PASS_THROUGH commands when CK_COND=1
> +			 */
> +			if ((sshdr.asc == 0x0) && (sshdr.ascq == 0x1d))
> +				;
> +			else if (!(req->rq_flags & RQF_QUIET))
> +				scsi_print_sense(cmd);
> +			result = 0;
> +			/* for passthrough error may be set */
> +			error = BLK_STS_OK;
> +	/*
> +	 * Another corner case: the SCSI status byte is non-zero but 'good'.
> +	 * Example: PRE-FETCH command returns SAM_STAT_CONDITION_MET when
> +	 * it is able to fit nominated LBs in its cache (and SAM_STAT_GOOD
> +	 * if it can't fit). Treat SAM_STAT_CONDITION_MET and the related
> +	 * intermediate statuses (both obsolete in SAM-4) as good.
> +	 */
> +		} else if (status_byte(result) &&
> +			   scsi_status_is_good(result)) {
> +			result = 0;
> +			/* for passthrough error may be set */
> +			error = BLK_STS_OK;
> +		}
>  	}

Please move the new comment block under "} else if" and indent it further to
the right such that neither gcc with W=1 nor smatch complain about incorrect
indentation.

Please also change the branching logic as follows to keep the indentation level
low:

	if (sense_valid && (sshdr.sense_key == RECOVERED_ERROR)) {
		[ ... ]
	} else if (status_byte(result) && scsi_status_is_good(result)) {
		[ ... ]
	}

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