public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Ching Huang <ching2048@areca.com.tw>
To: Tomas Henzl <thenzl@redhat.com>
Cc: hch@infradead.org, jbottomley@parallels.com,
	dan.carpenter@oracle.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 1/2] arcmsr: simplify ioctl data read/write
Date: Thu, 25 Sep 2014 17:56:33 +0800	[thread overview]
Message-ID: <1411638993.8266.46.camel@Centos6.3-64> (raw)
In-Reply-To: <5422E7BB.6090108@redhat.com>

On Wed, 2014-09-24 at 17:48 +0200, Tomas Henzl wrote:
> On 09/24/2014 11:33 AM, Ching Huang wrote:
> > From: Ching Huang <ching2048@areca.com.tw>
> >
> > This patch is relative to:
> > http://git.infradead.org/users/hch/scsi-queue.git/tree/drivers-for-3.18:/drivers/scsi/arcmsr
> >
> > change in v5:
> > 1. rename firstindex to getIndex, lastindex to putIndex for readability
> > 2. define ARCMSR_API_DATA_BUFLEN as 1032
> > 3. simplify ioctl data read by marcro CIRC_CNT_TO_END and CIRC_CNT
> >
> > Signed-off-by: Ching Huang <ching 2048@areca.com.tw>
> > ---
> >
> ...
> > +		pQbuffer = &acb->wqbuffer[acb->wqbuf_putIndex];
> > +		cnt2end = ARCMSR_MAX_QBUFFER - acb->wqbuf_putIndex;
> > +		if (user_len > cnt2end) {
> > +			memcpy(pQbuffer, ptmpuserbuffer, cnt2end);
> > +			ptmpuserbuffer += cnt2end;
> > +			user_len -= cnt2end;
> > +			acb->wqbuf_putIndex = 0;
> > +			pQbuffer = acb->wqbuffer;
> >  		}
> > +		memcpy(pQbuffer, ptmpuserbuffer, user_len);
> > +		acb->wqbuf_putIndex += user_len;
> > +		acb->wqbuf_putIndex %= ARCMSR_MAX_QBUFFER;
> > +		if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_CLEARED) {
> This test^ is most likely useless, it looks like you set the
> ACB_F_MESSAGE_WQBUFFER_CLEARED every time you have added some data to the buffer
> and clear it when the buffer gets empty. I think you could get rid of
> the ACB_F_MESSAGE_WQBUFFER_CLEARED completely. Also the ACB_F_MESSAGE_RQBUFFER_CLEARED doesn't
> seems to be ever evaluated.
> I'm not sure with the ACB_F_MESSAGE_WQBUFFER_READED, but that one probably is also
> a candidate for removal.
You are right. ACB_F_MESSAGE_WQBUFFER_CLEARED, ACB_F_MESSAGE_RQBUFFER_CLEARED, ACB_F_MESSAGE_WQBUFFER_READED
are seem useless.
> ...
> > @@ -678,15 +679,15 @@ struct AdapterControlBlock
> >  	unsigned int				uncache_size;
> >  	uint8_t				rqbuffer[ARCMSR_MAX_QBUFFER];
> >  	/* data collection buffer for read from 80331 */
> > -	int32_t				rqbuf_firstindex;
> > +	int32_t				rqbuf_getIndex;
> What is the reason for using an exact size int32 (instead of a plain int) here?
There is not special reason have to int32, int is OK.
> >  	/* first of read buffer  */
> > -	int32_t				rqbuf_lastindex;
> > +	int32_t				rqbuf_putIndex;
> >  	/* last of read buffer   */
> >  	uint8_t				wqbuffer[ARCMSR_MAX_QBUFFER];
> >  	/* data collection buffer for write to 80331  */
> > -	int32_t				wqbuf_firstindex;
> > +	int32_t				wqbuf_getIndex;
> >  	/* first of write buffer */
> > -	int32_t				wqbuf_lastindex;
> > +	int32_t				wqbuf_putIndex;
> >  	/* last of write buffer  */
> >  	uint8_t				devstate[ARCMSR_MAX_TARGETID][ARCMSR_MAX_TARGETLUN];
> >  	/* id0 ..... id15, lun0...lun7 */
> 
> The comments I've added are not directly related to this patch,
> but you may still address them in a new patch
> so -
> Reviewed-by: Tomas Henzl <thenzl@redhat.com>
> 
> 
> 

  reply	other threads:[~2014-09-25  9:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-24  9:33 [PATCH v5 1/2] arcmsr: simplify ioctl data read/write Ching Huang
2014-09-24 15:48 ` Tomas Henzl
2014-09-25  9:56   ` Ching Huang [this message]
2014-09-25 17:01 ` Christoph Hellwig
2014-09-26  3:43   ` Ching Huang

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=1411638993.8266.46.camel@Centos6.3-64 \
    --to=ching2048@areca.com.tw \
    --cc=dan.carpenter@oracle.com \
    --cc=hch@infradead.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=thenzl@redhat.com \
    /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