shmem: Implement splice-read
authorDavid Howells <dhowells@redhat.com>
Wed, 15 Mar 2023 16:35:37 +0000 (16:35 +0000)
committerJens Axboe <axboe@kernel.dk>
Wed, 15 Mar 2023 17:46:47 +0000 (11:46 -0600)
commitb81d7b89beccbeebe347c21c004665ffe07e36bb
treefb99594ba0fcc4f24016013a7c01d1b933c20326
parent6dc39c2949ee71ee9996d6190d374512ecf44982
shmem: Implement splice-read

The new filemap_splice_read() has an implicit expectation via
filemap_get_pages() that ->read_folio() exists if ->readahead() doesn't
fully populate the pagecache of the file it is reading from[1], potentially
leading to a jump to NULL if this doesn't exist.  shmem, however, (and by
extension, tmpfs, ramfs and rootfs), doesn't have ->read_folio(),

Work around this by equipping shmem with its own splice-read
implementation, based on filemap_splice_read(), but able to paste in
zero_page when there's a page missing.

Signed-off-by: David Howells <dhowells@redhat.com>
cc: Daniel Golle <daniel@makrotopia.org>
cc: Guenter Roeck <groeck7@gmail.com>
cc: Christoph Hellwig <hch@lst.de>
cc: Jens Axboe <axboe@kernel.dk>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: John Hubbard <jhubbard@nvidia.com>
cc: David Hildenbrand <david@redhat.com>
cc: Matthew Wilcox <willy@infradead.org>
cc: Hugh Dickins <hughd@google.com>
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/Y+pdHFFTk1TTEBsO@makrotopia.org/
Link: https://lore.kernel.org/r/20230315163549.295454-2-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
mm/shmem.c