RE: [PATCH 4/9 next] fs/io_uring Don't use the return value from import_iovec().

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

 



From: Christoph Hellwig
> Sent: 21 September 2020 15:15
> 
> On Tue, Sep 15, 2020 at 02:55:20PM +0000, David Laight wrote:
> >
> > This is the only code that relies on import_iovec() returning
> > iter.count on success.
> > This allows a better interface to import_iovec().
> 
> This looks generall sane, but a comment below:
> 
> > @@ -3123,7 +3123,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
> >  	if (ret < 0)
> >  		return ret;
> >  	iov_count = iov_iter_count(iter);
> > -	io_size = ret;
> > +	io_size = iov_count;
> >  	req->result = io_size;
> >  	ret = 0;
> >
> > @@ -3246,7 +3246,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock,
> >  	if (ret < 0)
> >  		return ret;
> >  	iov_count = iov_iter_count(iter);
> > -	io_size = ret;
> > +	io_size = iov_count;
> >  	req->result = io_size;
> 
> I tink the local iov_count variable can go away in both functions,
> as io_size only changes after the last use of iov_count (io_read) or
> not at all (io_write).

Yes, the compiler will probably make that optimisation.
I did a minimal change because my head hurts whenever I look at io_uring.c.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux