lkml.org 
[lkml]   [2021]   [Jan]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC v2] nvfs: a filesystem for persistent memory
On Mon, Jan 11, 2021 at 11:57:08AM +0000, David Laight wrote:
> > > > size = copy_to_iter(to, ptr, size);
> > > > if (unlikely(!size)) {
> > > > r = -EFAULT;
> > > > goto ret_r;
> > > > }
> > > >
> > > > pos += size;
> > > > total += size;
> > > > } while (iov_iter_count(to));
> > >
> > > That isn't the best formed loop!
> > >
> > > David
> >
> > I removed the second "while" statement and fixed the arguments to
> > copy_to_iter - other than that, Al's function works.
>
> The extra while is easy to write and can be difficult to spot.
> I've found them looking as the object code before now!

That extra while comes from editing cut'n'pasted piece of
source while writing a reply. Hint: original had been a do-while.

> Oh - the error return for copy_to_iter() is wrong.
> It should (probably) return 'total' if it is nonzero.

copy_to_iter() call there has an obvious problem
(arguments in the wrong order), but return value is handled
correctly. It does not do a blind return -EFAULT. RTFS...

\
 
 \ /
  Last update: 2021-01-11 15:47    [W:0.074 / U:0.972 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site