On Fri, 14 Dec 2018 17:03:02 +0000 Martin Lau <ka...@fb.com> wrote: > On Thu, Dec 13, 2018 at 10:44:57PM +0100, Andrea Claudi wrote: > > bytes is initialized to end - start at the beginning of this function, > > and is never changed. Remove it making the code a bit more readable. > > > > Suggested-by: Stefano Brivio <sbri...@redhat.com> > > Signed-off-by: Andrea Claudi <acla...@redhat.com> > The change looks correct. > I found the original code more intuitive to read though. > Daniel/John, thoughts?
In detail: the idea behind my suggestion was that: bytes_sg_total = start - offset + bytes; sounds like: start from 'start', move back by 'offset' (where am I now?), add 'bytes' (what is 'bytes'? Oh, it's end - start...). Whereas: bytes_sg_total = end - offset; looked easier to follow: total bytes are the distance between 'end' and 'offset'. -- Stefano