mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 12:28:41 +08:00
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 <dhowells@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christian Brauner <brauner@kernel.org> Reviewed-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com> cc: Al Viro <viro@zeniv.linux.org.uk> cc: Jens Axboe <axboe@kernel.dk> 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 <axboe@kernel.dk>
This commit is contained in:
parent
aa3dbde878
commit
b85930a077
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user