Re: [PATCH 1/3] Vectorize aio_read/aio_write methods

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

 



On Tue, 2006-05-09 at 12:01 -0700, Andrew Morton wrote:
> Badari Pulavarty <[email protected]> wrote:
> >
> >  static ssize_t ep_aio_read_retry(struct kiocb *iocb)
> >  {
> >  	struct kiocb_priv	*priv = iocb->private;
> > -	ssize_t			status = priv->actual;
> > +	ssize_t			len, total;
> >  
> >  	/* we "retry" to get the right mm context for this: */
> > -	status = copy_to_user(priv->ubuf, priv->buf, priv->actual);
> > -	if (unlikely(0 != status))
> > -		status = -EFAULT;
> > -	else
> > -		status = priv->actual;
> > +
> > +	/* copy stuff into user buffers */
> > +	total = priv->actual;
> > +	len = 0;
> > +	for (i=0; i < priv->count; i++) {
> 
> 	for (i = 0
> 
> > +		ssize_t this = min(priv->iv[i].iov_len, (size_t)total);
> 
> min_t().
> 
> Strange mixture of size_t and ssize_t there.

Borrowed it from somewhere :( 
I will clean it up.

> 
> > +		if (copy_to_user(priv->iv[i].iov_buf, priv->buf, this))
> > +			break;
> > +
> > +		total -= this;
> > +		len += this;
> > +		if (total <= 0)
> > +			break;
> > +	}
> > +
> > +	if (unlikely(len != 0))
> > +		len = -EFAULT;
> 
> This looks wrong.  I think you meant (total != 0).

Yes. It should be "total".

Thanks,
Badari



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux