From: David Howells Date: Mon, 22 May 2023 13:49:55 +0000 (+0100) Subject: splice: Make splice from a DAX file use copy_splice_read() X-Git-Tag: for-6.5/splice-2023-06-23~23 X-Git-Url: https://git.kernel.dk/?p=linux-block.git;a=commitdiff_plain;h=b85930a07738a95047a51dc5bc06b18fd91a9799 splice: Make splice from a DAX file use copy_splice_read() Make a read splice from a DAX file go directly to copy_splice_read() to do the reading as filemap_splice_read() is unlikely to find any pagecache to splice. I think this affects only erofs, Ext2, Ext4, fuse and XFS. Signed-off-by: David Howells Reviewed-by: Christoph Hellwig Reviewed-by: Christian Brauner Reviewed-by: Theodore Ts'o Reviewed-by: Gao Xiang cc: Al Viro cc: Jens Axboe cc: linux-erofs@lists.ozlabs.org cc: linux-ext4@vger.kernel.org cc: linux-xfs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org Link: https://lore.kernel.org/r/20230522135018.2742245-9-dhowells@redhat.com Signed-off-by: Jens Axboe --- diff --git a/fs/splice.c b/fs/splice.c index 76126b1aafcb..8268248df3a9 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -908,10 +908,10 @@ long vfs_splice_read(struct file *in, loff_t *ppos, if (unlikely(!in->f_op->splice_read)) return warn_unsupported(in, "read"); /* - * O_DIRECT doesn't deal with the pagecache, so we allocate a buffer, - * copy into it and splice that into the pipe. + * O_DIRECT and DAX don't deal with the pagecache, so we allocate a + * buffer, copy into it and splice that into the pipe. */ - if ((in->f_flags & O_DIRECT)) + if ((in->f_flags & O_DIRECT) || IS_DAX(in->f_mapping->host)) return copy_splice_read(in, ppos, pipe, len, flags); return in->f_op->splice_read(in, ppos, pipe, len, flags); }