[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y8B9bvh3Mjed8EBc@ZenIV>
Date: Thu, 12 Jan 2023 21:36:46 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: David Howells <dhowells@...hat.com>
Cc: Christoph Hellwig <hch@....de>, John Hubbard <jhubbard@...dia.com>,
Matthew Wilcox <willy@...radead.org>,
linux-fsdevel@...r.kernel.org, linux-mm@...ck.org,
Christoph Hellwig <hch@...radead.org>,
Jens Axboe <axboe@...nel.dk>, Jan Kara <jack@...e.cz>,
Jeff Layton <jlayton@...nel.org>,
Logan Gunthorpe <logang@...tatee.com>,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 4/9] iov_iter: Add a function to extract a page list
from an iterator
On Thu, Jan 12, 2023 at 09:15:50PM +0000, Al Viro wrote:
> On Wed, Jan 11, 2023 at 02:28:05PM +0000, David Howells wrote:
>
> > +ssize_t iov_iter_extract_pages(struct iov_iter *i,
> > + struct page ***pages,
> > + size_t maxsize,
> > + unsigned int maxpages,
> > + unsigned int gup_flags,
> > + size_t *offset0,
> > + unsigned int *cleanup_mode)
>
> This cleanup_mode thing is wrong. It's literally a trivial
> function of ->user_backed and ->data_source - we don't
> even need to look at the ->type.
>
> Separate it into an inline helper and be done with that;
> don't carry it all over the place.
>
> It's really "if not user-backed => 0, otherwise it's FOLL_PIN or FOLL_GET,
> depending upon the direction".
Seriously, it would be easier to follow that way; if you really insist upon
keeping these calling conventions, at least put the calculation in one place -
don't make readers to chase down into every sodding helper to check if they
do what you'd expect them to do.
Powered by blists - more mailing lists