From: David Howells <dhowells@redhat.com>
To: John Hubbard <jhubbard@nvidia.com>
Cc: dhowells@redhat.com, Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Jens Axboe <axboe@kernel.dk>, "Jan Kara" <jack@suse.cz>,
Jeff Layton <jlayton@kernel.org>,
David Hildenbrand <david@redhat.com>,
Jason Gunthorpe <jgg@nvidia.com>,
Logan Gunthorpe <logang@deltatee.com>,
linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
linux-kernel@vger.kernel.org, "Christoph Hellwig" <hch@lst.de>,
linux-mm@kvack.org
Subject: Re: [PATCH v9 2/8] iov_iter: Add a function to extract a page list from an iterator
Date: Tue, 24 Jan 2023 21:10:31 +0000 [thread overview]
Message-ID: <1353067.1674594631@warthog.procyon.org.uk> (raw)
In-Reply-To: <4be974aa-2beb-9ae5-3f48-7dde6241b0c7@nvidia.com>
John Hubbard <jhubbard@nvidia.com> wrote:
> > + for (;;) {
> > + if (i->nr_segs == 0)
> > + return 0;
> > + maxsize = min(maxsize, i->bvec->bv_len - skip);
> > + if (maxsize)
> > + break;
> > + i->iov_offset = 0;
> > + i->nr_segs--;
> > + i->kvec++;
> > + skip = 0;
> > + }
> > +
> > + skip += i->bvec->bv_offset;
> > + page = i->bvec->bv_page + skip / PAGE_SIZE;
> > + offset = skip % PAGE_SIZE;
> > + *offset0 = offset;
> > +
> > + maxpages = want_pages_array(pages, maxsize, offset, maxpages);
> > + if (!maxpages)
> > + return -ENOMEM;
>
> Is it OK that the iov_iter position has been advanced, and left that way,
> in the case of an early -ENOMEM return here?
I think it should be okay. The for-loop at the top just skips over empty
segments, so it doesn't really advance things. There is an error there,
though: it should be i->bvec++, not i->kvec++ in the loop.
David
prev parent reply other threads:[~2023-01-24 21:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230124170108.1070389-1-dhowells@redhat.com>
2023-01-24 17:01 ` David Howells
2023-01-24 19:00 ` Christoph Hellwig
2023-01-24 20:50 ` John Hubbard
2023-01-24 21:10 ` David Howells [this message]
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=1353067.1674594631@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=axboe@kernel.dk \
--cc=david@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=jgg@nvidia.com \
--cc=jhubbard@nvidia.com \
--cc=jlayton@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=logang@deltatee.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/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