Skip to content

Commit b85930a

Browse files
dhowellsaxboe
authored andcommitted
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 <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Christian Brauner <[email protected]> Reviewed-by: Theodore Ts'o <[email protected]> Reviewed-by: Gao Xiang <[email protected]> cc: Al Viro <[email protected]> cc: Jens Axboe <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent aa3dbde commit b85930a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

fs/splice.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,10 @@ long vfs_splice_read(struct file *in, loff_t *ppos,
908908
if (unlikely(!in->f_op->splice_read))
909909
return warn_unsupported(in, "read");
910910
/*
911-
* O_DIRECT doesn't deal with the pagecache, so we allocate a buffer,
912-
* copy into it and splice that into the pipe.
911+
* O_DIRECT and DAX don't deal with the pagecache, so we allocate a
912+
* buffer, copy into it and splice that into the pipe.
913913
*/
914-
if ((in->f_flags & O_DIRECT))
914+
if ((in->f_flags & O_DIRECT) || IS_DAX(in->f_mapping->host))
915915
return copy_splice_read(in, ppos, pipe, len, flags);
916916
return in->f_op->splice_read(in, ppos, pipe, len, flags);
917917
}

0 commit comments

Comments
 (0)