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 <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>
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)