public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh@panasas.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: James Bottomley <James.Bottomley@suse.de>,
	Mike Christie <michaelc@cs.wisc.edu>,
	Hannes Reinecke <hare@suse.de>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Matthew Wilcox <matthew@wil.cx>
Subject: Re: [PATCH 3/3 version 2] scsi_lib: Collapse scsi_end_request into only user
Date: Tue, 05 Jan 2010 09:27:46 +0200	[thread overview]
Message-ID: <4B42E9F2.2050109@panasas.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1001041315230.3180-100000@iolanthe.rowland.org>

On 01/04/2010 08:23 PM, Alan Stern wrote:
> On Mon, 4 Jan 2010, Boaz Harrosh wrote:
> 
>> Embedding scsi_end_request() into scsi_io_completion actually simplifies the
>> code and makes it clearer what's going on.
>>
>> There is absolutely no functional and/or side effects changes after this patch.
>>
>> Patch was inspired by Alan Stern. (version 2 comments by Matthew Wilcox)
> 
>> -	/*
>> -	 * A number of bytes were successfully read.  If there
>> -	 * are leftovers and there is some kind of error
>> -	 * (result != 0), retry the rest.
>> -	 */
>> -	if (scsi_end_request(cmd, error, good_bytes, result == 0) == NULL)
>> -		return;
>> -
>> -	error = -EIO;
>> -
>> -	if (host_byte(result) == DID_RESET) {
>> +	if (likely(!blk_end_request(req, error, good_bytes))) {
>> +		cmd->request = NULL;
>> +		action = ACTION_NEXT_CMND;
>> +	} else if (error && scsi_noretry_cmd(cmd)) {
>> +		/* kill remainder if no retrys */
>> +		blk_end_request_all(req, error);
>> +		cmd->request = NULL;
>> +		action = ACTION_NEXT_CMND;
>> +	} else if (result == 0) {
>> +		action = ACTION_REPREP;
>> +	} else if (host_byte(result) == DID_RESET) {
> 
> A few comments in these new "if" cases would help readers to understand
> the logic here.
> 
> My personal preference is to reverse the order of the "if (error && 
> scsi_noretry_cmd(cmd))" and the "if (result == 0)" sections.  It would 
> make more sense; that way we'd have:
> 
> 	If the request is finished [blk_end_request() == 0]
> 		...
> 	else if the request was successful but has more work to do
> 			(result == 0)
> 		...
> 	else if there was an error and retries are disallowed
> 		...
> 	else ... [other error handling]
> 
> Interchanging the order wouldn't make any functional difference, 
> because the code above this point guarantees that we can never have 
> result == 0 and error != 0.
> 
> Apart from these small issues, it looks perfect.
> 
> Alan Stern
> 

Thanks Alan.

I agree with your comments and will send a new version.

Boaz

  reply	other threads:[~2010-01-05  7:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 12:11 [PATCHSET 0/3] little bit of love to scsi_io_completion Boaz Harrosh
2010-01-04 12:13 ` [PATCH 1/3] scsi_lib: request_queue is only needed inside scsi_requeue_command Boaz Harrosh
2010-01-04 12:15 ` [PATCH 2/3] scsi_lib: Remove that __scsi_release_buffers contraption Boaz Harrosh
2010-01-04 12:17 ` [PATCH 3/3] scsi_lib: Collapse scsi_end_request into only user Boaz Harrosh
2010-01-04 13:23   ` Matthew Wilcox
2010-01-04 13:56     ` Boaz Harrosh
2010-01-04 14:07   ` [PATCH 3/3 version 2] " Boaz Harrosh
2010-01-04 14:12     ` Boaz Harrosh
2010-01-04 18:23     ` Alan Stern
2010-01-05  7:27       ` Boaz Harrosh [this message]
2010-01-05  7:53     ` [PATCH 3/3 version 3] " Boaz Harrosh
2010-01-05  8:49       ` Boaz Harrosh
2010-01-05  9:07   ` [PATCH 3/3 version 4] " Boaz Harrosh
2010-01-05 15:20     ` Alan Stern
2010-01-05 16:23       ` Boaz Harrosh
2010-01-05 16:33         ` Alan Stern

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=4B42E9F2.2050109@panasas.com \
    --to=bharrosh@panasas.com \
    --cc=James.Bottomley@suse.de \
    --cc=hare@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=michaelc@cs.wisc.edu \
    --cc=stern@rowland.harvard.edu \
    /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