linux-erofs.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read()
       [not found] <20230519074047.1739879-1-dhowells@redhat.com>
@ 2023-05-19  7:40 ` David Howells
  2023-05-19  8:10   ` Christoph Hellwig
  2023-05-19  8:48   ` David Howells
  0 siblings, 2 replies; 3+ messages in thread
From: David Howells @ 2023-05-19  7:40 UTC (permalink / raw)
  To: Jens Axboe, Al Viro, Christoph Hellwig
  Cc: linux-erofs, linux-block, Hillf Danton, Jan Kara, linux-xfs,
	David Hildenbrand, Linus Torvalds, Jeff Layton,
	Christian Brauner, Matthew Wilcox, linux-kernel, David Howells,
	linux-mm, Jason Gunthorpe, linux-fsdevel, linux-ext4,
	Logan Gunthorpe, Christoph Hellwig

Make a read splice from a DAX file go directly to direct_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>
cc: Christoph Hellwig <hch@lst.de>
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-fsdevel@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
---
 fs/splice.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/splice.c b/fs/splice.c
index 1e0b7c7038b5..7b818b5b18d4 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -421,6 +421,11 @@ ssize_t generic_file_splice_read(struct file *in, loff_t *ppos,
 	struct kiocb kiocb;
 	int ret;
 
+#ifdef CONFIG_FS_DAX
+	if (IS_DAX(in->f_mapping->host))
+		return direct_splice_read(in, ppos, pipe, len, flags);
+#endif
+
 	iov_iter_pipe(&to, ITER_DEST, pipe, len);
 	init_sync_kiocb(&kiocb, in);
 	kiocb.ki_pos = *ppos;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read()
  2023-05-19  7:40 ` [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read() David Howells
@ 2023-05-19  8:10   ` Christoph Hellwig
  2023-05-19  8:48   ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-05-19  8:10 UTC (permalink / raw)
  To: David Howells
  Cc: Jens Axboe, linux-block, Hillf Danton, Jan Kara, linux-xfs,
	David Hildenbrand, linux-erofs, Linus Torvalds, Jeff Layton,
	Christian Brauner, Matthew Wilcox, linux-kernel,
	Christoph Hellwig, linux-mm, Al Viro, Jason Gunthorpe,
	linux-fsdevel, linux-ext4, Logan Gunthorpe, Christoph Hellwig

On Fri, May 19, 2023 at 08:40:20AM +0100, David Howells wrote:
> +#ifdef CONFIG_FS_DAX
> +	if (IS_DAX(in->f_mapping->host))

No need for the ifdef.  IS_DAX is compile-time false if CONFIG_FS_DAX
is not set.

A comment on why we're doing this in the code would probably be useful
as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read()
  2023-05-19  7:40 ` [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read() David Howells
  2023-05-19  8:10   ` Christoph Hellwig
@ 2023-05-19  8:48   ` David Howells
  1 sibling, 0 replies; 3+ messages in thread
From: David Howells @ 2023-05-19  8:48 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jens Axboe, linux-block, Hillf Danton, Jan Kara, linux-xfs,
	David Hildenbrand, linux-erofs, Linus Torvalds, Jeff Layton,
	Christian Brauner, Matthew Wilcox, linux-kernel, dhowells,
	linux-mm, Al Viro, Jason Gunthorpe, linux-fsdevel, linux-ext4,
	Logan Gunthorpe, Christoph Hellwig

Christoph Hellwig <hch@infradead.org> wrote:

> On Fri, May 19, 2023 at 08:40:20AM +0100, David Howells wrote:
> > +#ifdef CONFIG_FS_DAX
> > +	if (IS_DAX(in->f_mapping->host))
> 
> No need for the ifdef.  IS_DAX is compile-time false if CONFIG_FS_DAX
> is not set.

Ah - it's not that IS_DAX() is conditionalised, it's that S_DAX is.  There's a
bunch of places that use CONFIG_FS_DAX blocks, but I guess that's because they
include calls to functions that are conditionalised out.

I wonder if the dax_iomap_rw() declaration in the header can have a non-DAX
fallback that returns an error and then we can get rid of some of the other
conditionalisation.

David


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-19  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230519074047.1739879-1-dhowells@redhat.com>
2023-05-19  7:40 ` [PATCH v20 05/32] splice: Make splice from a DAX file use direct_splice_read() David Howells
2023-05-19  8:10   ` Christoph Hellwig
2023-05-19  8:48   ` David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).