• David Howells's avatar
    shmem: Implement splice-read · bd194b18
    David Howells authored
    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: default avatarDavid 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/ [1]
    Link: https://lore.kernel.org/r/20230522135018.2742245-10-dhowells@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
    bd194b18
shmem.c 117 KB