[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YxbtjijmfGaKIbIV@infradead.org>
Date: Mon, 5 Sep 2022 23:49:50 -0700
From: Christoph Hellwig <hch@...radead.org>
To: John Hubbard <jhubbard@...dia.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Jens Axboe <axboe@...nel.dk>,
Alexander Viro <viro@...iv.linux.org.uk>,
Miklos Szeredi <miklos@...redi.hu>,
Christoph Hellwig <hch@...radead.org>,
"Darrick J . Wong" <djwong@...nel.org>,
Trond Myklebust <trond.myklebust@...merspace.com>,
Anna Schumaker <anna@...nel.org>, Jan Kara <jack@...e.cz>,
David Hildenbrand <david@...hat.com>,
Logan Gunthorpe <logang@...tatee.com>,
linux-block@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-xfs@...r.kernel.org, linux-nfs@...r.kernel.org,
linux-mm@...ck.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 6/7] NFS: direct-io: convert to FOLL_PIN pages
On Tue, Aug 30, 2022 at 09:18:42PM -0700, John Hubbard wrote:
static void nfs_direct_release_pages(struct iov_iter *iter, struct page **pages,
unsigned int npages)
> {
> - unsigned int i;
> - for (i = 0; i < npages; i++)
> - put_page(pages[i]);
> + if (user_backed_iter(iter) || iov_iter_is_bvec(iter))
> + dio_w_unpin_user_pages(pages, npages);
> + else
> + release_pages(pages, npages);
Instead of having this magic in all kinds of places, we need a helper
that takes the page array, npages and iter->type and does the right
thing.
Powered by blists - more mailing lists