From nobody Thu Sep 19 21:42:08 2024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D80A5C05027 for ; Thu, 9 Feb 2023 10:32:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjBIKcT (ORCPT ); Thu, 9 Feb 2023 05:32:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229971AbjBIKbg (ORCPT ); Thu, 9 Feb 2023 05:31:36 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2ECF1A948 for ; Thu, 9 Feb 2023 02:30:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675938624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qwz2q+yLr2zGFFawjjmWjHNoqop7eGuYZKEvUt7Y67M=; b=UxKgOcn6/MUPpJtamd3v+S5Jp+h599ecZnPDcIb0fOkkgQaAdpskaCbxXrBv0cDCkhAeA4 eJskidwDVkGDivRX0wBAvn1yoqYjBx7YnCBHky3aRfL7d4bFBJTb1iy2qaUFe1Gmh//6Ba 0h+A+fJNFw8eX3Tfu7/5b6fsvKFxik0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-155-cPu1SGShOLWHoyJH53fjYQ-1; Thu, 09 Feb 2023 05:30:19 -0500 X-MC-Unique: cPu1SGShOLWHoyJH53fjYQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A13A080590E; Thu, 9 Feb 2023 10:30:09 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.24]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DFBE403D0CE; Thu, 9 Feb 2023 10:30:07 +0000 (UTC) From: David Howells To: Jens Axboe , Al Viro , Christoph Hellwig Cc: David Howells , Matthew Wilcox , Jan Kara , Jeff Layton , David Hildenbrand , Jason Gunthorpe , Logan Gunthorpe , Hillf Danton , linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Christoph Hellwig , John Hubbard Subject: [PATCH v13 04/12] iov_iter: Kill ITER_PIPE Date: Thu, 9 Feb 2023 10:29:46 +0000 Message-Id: <20230209102954.528942-5-dhowells@redhat.com> In-Reply-To: <20230209102954.528942-1-dhowells@redhat.com> References: <20230209102954.528942-1-dhowells@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The ITER_PIPE-type iterator was only used for generic_file_splice_read(), but that has now been switched to either pull pages directly from the pagecache for buffered file splice-reads or to use ITER_BVEC instead for O_DIRECT file splice-reads. This leaves ITER_PIPE unused - so remove it. Signed-off-by: David Howells cc: Jens Axboe cc: Christoph Hellwig cc: Al Viro cc: David Hildenbrand cc: John Hubbard cc: linux-mm@kvack.org cc: linux-block@vger.kernel.org cc: linux-fsdevel@vger.kernel.org Reviewed-by: Christoph Hellwig --- fs/cifs/file.c | 8 +- include/linux/uio.h | 14 -- lib/iov_iter.c | 435 +------------------------------------------- mm/filemap.c | 3 +- 4 files changed, 5 insertions(+), 455 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 22dfc1f8b4f1..57ca4eea69dd 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3806,13 +3806,7 @@ cifs_readdata_to_iov(struct cifs_readdata *rdata, st= ruct iov_iter *iter) size_t copy =3D min_t(size_t, remaining, PAGE_SIZE); size_t written; =20 - if (unlikely(iov_iter_is_pipe(iter))) { - void *addr =3D kmap_atomic(page); - - written =3D copy_to_iter(addr, copy, iter); - kunmap_atomic(addr); - } else - written =3D copy_page_to_iter(page, 0, copy, iter); + written =3D copy_page_to_iter(page, 0, copy, iter); remaining -=3D written; if (written < copy && iov_iter_count(iter) > 0) break; diff --git a/include/linux/uio.h b/include/linux/uio.h index 9f158238edba..dcc0ca5ef491 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -11,7 +11,6 @@ #include =20 struct page; -struct pipe_inode_info; =20 struct kvec { void *iov_base; /* and that should *never* hold a userland pointer */ @@ -23,7 +22,6 @@ enum iter_type { ITER_IOVEC, ITER_KVEC, ITER_BVEC, - ITER_PIPE, ITER_XARRAY, ITER_DISCARD, ITER_UBUF, @@ -53,15 +51,10 @@ struct iov_iter { const struct kvec *kvec; const struct bio_vec *bvec; struct xarray *xarray; - struct pipe_inode_info *pipe; void __user *ubuf; }; union { unsigned long nr_segs; - struct { - unsigned int head; - unsigned int start_head; - }; loff_t xarray_start; }; }; @@ -99,11 +92,6 @@ static inline bool iov_iter_is_bvec(const struct iov_ite= r *i) return iov_iter_type(i) =3D=3D ITER_BVEC; } =20 -static inline bool iov_iter_is_pipe(const struct iov_iter *i) -{ - return iov_iter_type(i) =3D=3D ITER_PIPE; -} - static inline bool iov_iter_is_discard(const struct iov_iter *i) { return iov_iter_type(i) =3D=3D ITER_DISCARD; @@ -245,8 +233,6 @@ void iov_iter_kvec(struct iov_iter *i, unsigned int dir= ection, const struct kvec unsigned long nr_segs, size_t count); void iov_iter_bvec(struct iov_iter *i, unsigned int direction, const struc= t bio_vec *bvec, unsigned long nr_segs, size_t count); -void iov_iter_pipe(struct iov_iter *i, unsigned int direction, struct pipe= _inode_info *pipe, - size_t count); void iov_iter_discard(struct iov_iter *i, unsigned int direction, size_t c= ount); void iov_iter_xarray(struct iov_iter *i, unsigned int direction, struct xa= rray *xarray, loff_t start, size_t count); diff --git a/lib/iov_iter.c b/lib/iov_iter.c index f9a3ff37ecd1..adc5e8aa8ae8 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -14,8 +14,6 @@ #include #include =20 -#define PIPE_PARANOIA /* for now */ - /* covers ubuf and kbuf alike */ #define iterate_buf(i, n, base, len, off, __p, STEP) { \ size_t __maybe_unused off =3D 0; \ @@ -186,156 +184,6 @@ static int copyin(void *to, const void __user *from, = size_t n) return res; } =20 -static inline struct pipe_buffer *pipe_buf(const struct pipe_inode_info *p= ipe, - unsigned int slot) -{ - return &pipe->bufs[slot & (pipe->ring_size - 1)]; -} - -#ifdef PIPE_PARANOIA -static bool sanity(const struct iov_iter *i) -{ - struct pipe_inode_info *pipe =3D i->pipe; - unsigned int p_head =3D pipe->head; - unsigned int p_tail =3D pipe->tail; - unsigned int p_occupancy =3D pipe_occupancy(p_head, p_tail); - unsigned int i_head =3D i->head; - unsigned int idx; - - if (i->last_offset) { - struct pipe_buffer *p; - if (unlikely(p_occupancy =3D=3D 0)) - goto Bad; // pipe must be non-empty - if (unlikely(i_head !=3D p_head - 1)) - goto Bad; // must be at the last buffer... - - p =3D pipe_buf(pipe, i_head); - if (unlikely(p->offset + p->len !=3D abs(i->last_offset))) - goto Bad; // ... at the end of segment - } else { - if (i_head !=3D p_head) - goto Bad; // must be right after the last buffer - } - return true; -Bad: - printk(KERN_ERR "idx =3D %d, offset =3D %d\n", i_head, i->last_offset); - printk(KERN_ERR "head =3D %d, tail =3D %d, buffers =3D %d\n", - p_head, p_tail, pipe->ring_size); - for (idx =3D 0; idx < pipe->ring_size; idx++) - printk(KERN_ERR "[%p %p %d %d]\n", - pipe->bufs[idx].ops, - pipe->bufs[idx].page, - pipe->bufs[idx].offset, - pipe->bufs[idx].len); - WARN_ON(1); - return false; -} -#else -#define sanity(i) true -#endif - -static struct page *push_anon(struct pipe_inode_info *pipe, unsigned size) -{ - struct page *page =3D alloc_page(GFP_USER); - if (page) { - struct pipe_buffer *buf =3D pipe_buf(pipe, pipe->head++); - *buf =3D (struct pipe_buffer) { - .ops =3D &default_pipe_buf_ops, - .page =3D page, - .offset =3D 0, - .len =3D size - }; - } - return page; -} - -static void push_page(struct pipe_inode_info *pipe, struct page *page, - unsigned int offset, unsigned int size) -{ - struct pipe_buffer *buf =3D pipe_buf(pipe, pipe->head++); - *buf =3D (struct pipe_buffer) { - .ops =3D &page_cache_pipe_buf_ops, - .page =3D page, - .offset =3D offset, - .len =3D size - }; - get_page(page); -} - -static inline int last_offset(const struct pipe_buffer *buf) -{ - if (buf->ops =3D=3D &default_pipe_buf_ops) - return buf->len; // buf->offset is 0 for those - else - return -(buf->offset + buf->len); -} - -static struct page *append_pipe(struct iov_iter *i, size_t size, - unsigned int *off) -{ - struct pipe_inode_info *pipe =3D i->pipe; - int offset =3D i->last_offset; - struct pipe_buffer *buf; - struct page *page; - - if (offset > 0 && offset < PAGE_SIZE) { - // some space in the last buffer; add to it - buf =3D pipe_buf(pipe, pipe->head - 1); - size =3D min_t(size_t, size, PAGE_SIZE - offset); - buf->len +=3D size; - i->last_offset +=3D size; - i->count -=3D size; - *off =3D offset; - return buf->page; - } - // OK, we need a new buffer - *off =3D 0; - size =3D min_t(size_t, size, PAGE_SIZE); - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) - return NULL; - page =3D push_anon(pipe, size); - if (!page) - return NULL; - i->head =3D pipe->head - 1; - i->last_offset =3D size; - i->count -=3D size; - return page; -} - -static size_t copy_page_to_iter_pipe(struct page *page, size_t offset, siz= e_t bytes, - struct iov_iter *i) -{ - struct pipe_inode_info *pipe =3D i->pipe; - unsigned int head =3D pipe->head; - - if (unlikely(bytes > i->count)) - bytes =3D i->count; - - if (unlikely(!bytes)) - return 0; - - if (!sanity(i)) - return 0; - - if (offset && i->last_offset =3D=3D -offset) { // could we merge it? - struct pipe_buffer *buf =3D pipe_buf(pipe, head - 1); - if (buf->page =3D=3D page) { - buf->len +=3D bytes; - i->last_offset -=3D bytes; - i->count -=3D bytes; - return bytes; - } - } - if (pipe_full(pipe->head, pipe->tail, pipe->max_usage)) - return 0; - - push_page(pipe, page, offset, bytes); - i->last_offset =3D -(offset + bytes); - i->head =3D head; - i->count -=3D bytes; - return bytes; -} - /* * fault_in_iov_iter_readable - fault in iov iterator for reading * @i: iterator @@ -439,46 +287,6 @@ void iov_iter_init(struct iov_iter *i, unsigned int di= rection, } EXPORT_SYMBOL(iov_iter_init); =20 -// returns the offset in partial buffer (if any) -static inline unsigned int pipe_npages(const struct iov_iter *i, int *npag= es) -{ - struct pipe_inode_info *pipe =3D i->pipe; - int used =3D pipe->head - pipe->tail; - int off =3D i->last_offset; - - *npages =3D max((int)pipe->max_usage - used, 0); - - if (off > 0 && off < PAGE_SIZE) { // anon and not full - (*npages)++; - return off; - } - return 0; -} - -static size_t copy_pipe_to_iter(const void *addr, size_t bytes, - struct iov_iter *i) -{ - unsigned int off, chunk; - - if (unlikely(bytes > i->count)) - bytes =3D i->count; - if (unlikely(!bytes)) - return 0; - - if (!sanity(i)) - return 0; - - for (size_t n =3D bytes; n; n -=3D chunk) { - struct page *page =3D append_pipe(i, n, &off); - chunk =3D min_t(size_t, n, PAGE_SIZE - off); - if (!page) - return bytes - n; - memcpy_to_page(page, off, addr, chunk); - addr +=3D chunk; - } - return bytes; -} - static __wsum csum_and_memcpy(void *to, const void *from, size_t len, __wsum sum, size_t off) { @@ -486,44 +294,10 @@ static __wsum csum_and_memcpy(void *to, const void *f= rom, size_t len, return csum_block_add(sum, next, off); } =20 -static size_t csum_and_copy_to_pipe_iter(const void *addr, size_t bytes, - struct iov_iter *i, __wsum *sump) -{ - __wsum sum =3D *sump; - size_t off =3D 0; - unsigned int chunk, r; - - if (unlikely(bytes > i->count)) - bytes =3D i->count; - if (unlikely(!bytes)) - return 0; - - if (!sanity(i)) - return 0; - - while (bytes) { - struct page *page =3D append_pipe(i, bytes, &r); - char *p; - - if (!page) - break; - chunk =3D min_t(size_t, bytes, PAGE_SIZE - r); - p =3D kmap_local_page(page); - sum =3D csum_and_memcpy(p + r, addr + off, chunk, sum, off); - kunmap_local(p); - off +=3D chunk; - bytes -=3D chunk; - } - *sump =3D sum; - return off; -} - size_t _copy_to_iter(const void *addr, size_t bytes, struct iov_iter *i) { if (WARN_ON_ONCE(i->data_source)) return 0; - if (unlikely(iov_iter_is_pipe(i))) - return copy_pipe_to_iter(addr, bytes, i); if (user_backed_iter(i)) might_fault(); iterate_and_advance(i, bytes, base, len, off, @@ -545,42 +319,6 @@ static int copyout_mc(void __user *to, const void *fro= m, size_t n) return n; } =20 -static size_t copy_mc_pipe_to_iter(const void *addr, size_t bytes, - struct iov_iter *i) -{ - size_t xfer =3D 0; - unsigned int off, chunk; - - if (unlikely(bytes > i->count)) - bytes =3D i->count; - if (unlikely(!bytes)) - return 0; - - if (!sanity(i)) - return 0; - - while (bytes) { - struct page *page =3D append_pipe(i, bytes, &off); - unsigned long rem; - char *p; - - if (!page) - break; - chunk =3D min_t(size_t, bytes, PAGE_SIZE - off); - p =3D kmap_local_page(page); - rem =3D copy_mc_to_kernel(p + off, addr + xfer, chunk); - chunk -=3D rem; - kunmap_local(p); - xfer +=3D chunk; - bytes -=3D chunk; - if (rem) { - iov_iter_revert(i, rem); - break; - } - } - return xfer; -} - /** * _copy_mc_to_iter - copy to iter with source memory error exception hand= ling * @addr: source kernel address @@ -600,9 +338,8 @@ static size_t copy_mc_pipe_to_iter(const void *addr, si= ze_t bytes, * alignment and poison alignment assumptions to avoid re-triggering * hardware exceptions. * - * * ITER_KVEC, ITER_PIPE, and ITER_BVEC can return short copies. - * Compare to copy_to_iter() where only ITER_IOVEC attempts might return - * a short copy. + * * ITER_KVEC and ITER_BVEC can return short copies. Compare to + * copy_to_iter() where only ITER_IOVEC attempts might return a short co= py. * * Return: number of bytes copied (may be %0) */ @@ -610,8 +347,6 @@ size_t _copy_mc_to_iter(const void *addr, size_t bytes,= struct iov_iter *i) { if (WARN_ON_ONCE(i->data_source)) return 0; - if (unlikely(iov_iter_is_pipe(i))) - return copy_mc_pipe_to_iter(addr, bytes, i); if (user_backed_iter(i)) might_fault(); __iterate_and_advance(i, bytes, base, len, off, @@ -717,8 +452,6 @@ size_t copy_page_to_iter(struct page *page, size_t offs= et, size_t bytes, return 0; if (WARN_ON_ONCE(i->data_source)) return 0; - if (unlikely(iov_iter_is_pipe(i))) - return copy_page_to_iter_pipe(page, offset, bytes, i); page +=3D offset / PAGE_SIZE; // first subpage offset %=3D PAGE_SIZE; while (1) { @@ -767,36 +500,8 @@ size_t copy_page_from_iter(struct page *page, size_t o= ffset, size_t bytes, } EXPORT_SYMBOL(copy_page_from_iter); =20 -static size_t pipe_zero(size_t bytes, struct iov_iter *i) -{ - unsigned int chunk, off; - - if (unlikely(bytes > i->count)) - bytes =3D i->count; - if (unlikely(!bytes)) - return 0; - - if (!sanity(i)) - return 0; - - for (size_t n =3D bytes; n; n -=3D chunk) { - struct page *page =3D append_pipe(i, n, &off); - char *p; - - if (!page) - return bytes - n; - chunk =3D min_t(size_t, n, PAGE_SIZE - off); - p =3D kmap_local_page(page); - memset(p + off, 0, chunk); - kunmap_local(p); - } - return bytes; -} - size_t iov_iter_zero(size_t bytes, struct iov_iter *i) { - if (unlikely(iov_iter_is_pipe(i))) - return pipe_zero(bytes, i); iterate_and_advance(i, bytes, base, len, count, clear_user(base, len), memset(base, 0, len) @@ -827,32 +532,6 @@ size_t copy_page_from_iter_atomic(struct page *page, u= nsigned offset, size_t byt } EXPORT_SYMBOL(copy_page_from_iter_atomic); =20 -static void pipe_advance(struct iov_iter *i, size_t size) -{ - struct pipe_inode_info *pipe =3D i->pipe; - int off =3D i->last_offset; - - if (!off && !size) { - pipe_discard_from(pipe, i->start_head); // discard everything - return; - } - i->count -=3D size; - while (1) { - struct pipe_buffer *buf =3D pipe_buf(pipe, i->head); - if (off) /* make it relative to the beginning of buffer */ - size +=3D abs(off) - buf->offset; - if (size <=3D buf->len) { - buf->len =3D size; - i->last_offset =3D last_offset(buf); - break; - } - size -=3D buf->len; - i->head++; - off =3D 0; - } - pipe_discard_from(pipe, i->head + 1); // discard everything past this one -} - static void iov_iter_bvec_advance(struct iov_iter *i, size_t size) { const struct bio_vec *bvec, *end; @@ -904,8 +583,6 @@ void iov_iter_advance(struct iov_iter *i, size_t size) iov_iter_iovec_advance(i, size); } else if (iov_iter_is_bvec(i)) { iov_iter_bvec_advance(i, size); - } else if (iov_iter_is_pipe(i)) { - pipe_advance(i, size); } else if (iov_iter_is_discard(i)) { i->count -=3D size; } @@ -919,26 +596,6 @@ void iov_iter_revert(struct iov_iter *i, size_t unroll) if (WARN_ON(unroll > MAX_RW_COUNT)) return; i->count +=3D unroll; - if (unlikely(iov_iter_is_pipe(i))) { - struct pipe_inode_info *pipe =3D i->pipe; - unsigned int head =3D pipe->head; - - while (head > i->start_head) { - struct pipe_buffer *b =3D pipe_buf(pipe, --head); - if (unroll < b->len) { - b->len -=3D unroll; - i->last_offset =3D last_offset(b); - i->head =3D head; - return; - } - unroll -=3D b->len; - pipe_buf_release(pipe, b); - pipe->head--; - } - i->last_offset =3D 0; - i->head =3D head; - return; - } if (unlikely(iov_iter_is_discard(i))) return; if (unroll <=3D i->iov_offset) { @@ -1026,24 +683,6 @@ void iov_iter_bvec(struct iov_iter *i, unsigned int d= irection, } EXPORT_SYMBOL(iov_iter_bvec); =20 -void iov_iter_pipe(struct iov_iter *i, unsigned int direction, - struct pipe_inode_info *pipe, - size_t count) -{ - BUG_ON(direction !=3D READ); - WARN_ON(pipe_full(pipe->head, pipe->tail, pipe->ring_size)); - *i =3D (struct iov_iter){ - .iter_type =3D ITER_PIPE, - .data_source =3D false, - .pipe =3D pipe, - .head =3D pipe->head, - .start_head =3D pipe->head, - .last_offset =3D 0, - .count =3D count - }; -} -EXPORT_SYMBOL(iov_iter_pipe); - /** * iov_iter_xarray - Initialise an I/O iterator to use the pages in an xar= ray * @i: The iterator to initialise. @@ -1168,19 +807,6 @@ bool iov_iter_is_aligned(const struct iov_iter *i, un= signed addr_mask, if (iov_iter_is_bvec(i)) return iov_iter_aligned_bvec(i, addr_mask, len_mask); =20 - if (iov_iter_is_pipe(i)) { - size_t size =3D i->count; - - if (size & len_mask) - return false; - if (size && i->last_offset > 0) { - if (i->last_offset & addr_mask) - return false; - } - - return true; - } - if (iov_iter_is_xarray(i)) { if (i->count & len_mask) return false; @@ -1250,14 +876,6 @@ unsigned long iov_iter_alignment(const struct iov_ite= r *i) if (iov_iter_is_bvec(i)) return iov_iter_alignment_bvec(i); =20 - if (iov_iter_is_pipe(i)) { - size_t size =3D i->count; - - if (size && i->last_offset > 0) - return size | i->last_offset; - return size; - } - if (iov_iter_is_xarray(i)) return (i->xarray_start + i->iov_offset) | i->count; =20 @@ -1309,36 +927,6 @@ static int want_pages_array(struct page ***res, size_= t size, return count; } =20 -static ssize_t pipe_get_pages(struct iov_iter *i, - struct page ***pages, size_t maxsize, unsigned maxpages, - size_t *start) -{ - unsigned int npages, count, off, chunk; - struct page **p; - size_t left; - - if (!sanity(i)) - return -EFAULT; - - *start =3D off =3D pipe_npages(i, &npages); - if (!npages) - return -EFAULT; - count =3D want_pages_array(pages, maxsize, off, min(npages, maxpages)); - if (!count) - return -ENOMEM; - p =3D *pages; - for (npages =3D 0, left =3D maxsize ; npages < count; npages++, left -=3D= chunk) { - struct page *page =3D append_pipe(i, left, &off); - if (!page) - break; - chunk =3D min_t(size_t, left, PAGE_SIZE - off); - get_page(*p++ =3D page); - } - if (!npages) - return -EFAULT; - return maxsize - left; -} - static ssize_t iter_xarray_populate_pages(struct page **pages, struct xarr= ay *xa, pgoff_t index, unsigned int nr_pages) { @@ -1486,8 +1074,6 @@ static ssize_t __iov_iter_get_pages_alloc(struct iov_= iter *i, } return maxsize; } - if (iov_iter_is_pipe(i)) - return pipe_get_pages(i, pages, maxsize, maxpages, start); if (iov_iter_is_xarray(i)) return iter_xarray_get_pages(i, pages, maxsize, maxpages, start); return -EFAULT; @@ -1577,9 +1163,7 @@ size_t csum_and_copy_to_iter(const void *addr, size_t= bytes, void *_csstate, } =20 sum =3D csum_shift(csstate->csum, csstate->off); - if (unlikely(iov_iter_is_pipe(i))) - bytes =3D csum_and_copy_to_pipe_iter(addr, bytes, i, &sum); - else iterate_and_advance(i, bytes, base, len, off, ({ + iterate_and_advance(i, bytes, base, len, off, ({ next =3D csum_and_copy_to_user(addr + off, base, len); sum =3D csum_block_add(sum, next, off); next ? 0 : len; @@ -1664,15 +1248,6 @@ int iov_iter_npages(const struct iov_iter *i, int ma= xpages) return iov_npages(i, maxpages); if (iov_iter_is_bvec(i)) return bvec_npages(i, maxpages); - if (iov_iter_is_pipe(i)) { - int npages; - - if (!sanity(i)) - return 0; - - pipe_npages(i, &npages); - return min(npages, maxpages); - } if (iov_iter_is_xarray(i)) { unsigned offset =3D (i->xarray_start + i->iov_offset) % PAGE_SIZE; int npages =3D DIV_ROUND_UP(offset + i->count, PAGE_SIZE); @@ -1685,10 +1260,6 @@ EXPORT_SYMBOL(iov_iter_npages); const void *dup_iter(struct iov_iter *new, struct iov_iter *old, gfp_t fla= gs) { *new =3D *old; - if (unlikely(iov_iter_is_pipe(new))) { - WARN_ON(1); - return NULL; - } if (iov_iter_is_bvec(new)) return new->bvec =3D kmemdup(new->bvec, new->nr_segs * sizeof(struct bio_vec), diff --git a/mm/filemap.c b/mm/filemap.c index b31168a9bafd..6970be64a3e0 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -2695,8 +2695,7 @@ ssize_t filemap_read(struct kiocb *iocb, struct iov_i= ter *iter, if (unlikely(iocb->ki_pos >=3D i_size_read(inode))) break; =20 - error =3D filemap_get_pages(iocb, iter->count, &fbatch, - iov_iter_is_pipe(iter)); + error =3D filemap_get_pages(iocb, iter->count, &fbatch, false); if (error < 0) break;