tty, proc, kernfs, random: Use copy_splice_read()
authorDavid Howells <dhowells@redhat.com>
Mon, 22 May 2023 13:49:59 +0000 (14:49 +0100)
committerJens Axboe <axboe@kernel.dk>
Wed, 24 May 2023 14:42:16 +0000 (08:42 -0600)
Use copy_splice_read() for tty, procfs, kernfs and random files rather
than going through generic_file_splice_read() as they just copy the file
into the output buffer and don't splice pages.  This avoids the need for
them to have a ->read_folio() to satisfy filemap_splice_read().

Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: Christoph Hellwig <hch@lst.de>
cc: Jens Axboe <axboe@kernel.dk>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: John Hubbard <jhubbard@nvidia.com>
cc: David Hildenbrand <david@redhat.com>
cc: Matthew Wilcox <willy@infradead.org>
cc: Miklos Szeredi <miklos@szeredi.hu>
cc: Arnd Bergmann <arnd@arndb.de>
cc: linux-block@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
cc: linux-mm@kvack.org
Link: https://lore.kernel.org/r/20230522135018.2742245-13-dhowells@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/char/random.c
drivers/tty/tty_io.c
fs/kernfs/file.c
fs/proc/inode.c
fs/proc/proc_sysctl.c
fs/proc_namespace.c

index 253f2dd..3cb3776 100644 (file)
@@ -1546,7 +1546,7 @@ const struct file_operations random_fops = {
        .compat_ioctl = compat_ptr_ioctl,
        .fasync = random_fasync,
        .llseek = noop_llseek,
-       .splice_read = generic_file_splice_read,
+       .splice_read = copy_splice_read,
        .splice_write = iter_file_splice_write,
 };
 
@@ -1557,7 +1557,7 @@ const struct file_operations urandom_fops = {
        .compat_ioctl = compat_ptr_ioctl,
        .fasync = random_fasync,
        .llseek = noop_llseek,
-       .splice_read = generic_file_splice_read,
+       .splice_read = copy_splice_read,
        .splice_write = iter_file_splice_write,
 };
 
index c84be40..4737a8f 100644 (file)
@@ -466,7 +466,7 @@ static const struct file_operations tty_fops = {
        .llseek         = no_llseek,
        .read_iter      = tty_read,
        .write_iter     = tty_write,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .splice_write   = iter_file_splice_write,
        .poll           = tty_poll,
        .unlocked_ioctl = tty_ioctl,
@@ -481,7 +481,7 @@ static const struct file_operations console_fops = {
        .llseek         = no_llseek,
        .read_iter      = tty_read,
        .write_iter     = redirected_tty_write,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .splice_write   = iter_file_splice_write,
        .poll           = tty_poll,
        .unlocked_ioctl = tty_ioctl,
index 40c4661..180906c 100644 (file)
@@ -1011,7 +1011,7 @@ const struct file_operations kernfs_file_fops = {
        .release        = kernfs_fop_release,
        .poll           = kernfs_fop_poll,
        .fsync          = noop_fsync,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .splice_write   = iter_file_splice_write,
 };
 
index f495fdb..67b09a1 100644 (file)
@@ -591,7 +591,7 @@ static const struct file_operations proc_iter_file_ops = {
        .llseek         = proc_reg_llseek,
        .read_iter      = proc_reg_read_iter,
        .write          = proc_reg_write,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .poll           = proc_reg_poll,
        .unlocked_ioctl = proc_reg_unlocked_ioctl,
        .mmap           = proc_reg_mmap,
@@ -617,7 +617,7 @@ static const struct file_operations proc_reg_file_ops_compat = {
 static const struct file_operations proc_iter_file_ops_compat = {
        .llseek         = proc_reg_llseek,
        .read_iter      = proc_reg_read_iter,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .write          = proc_reg_write,
        .poll           = proc_reg_poll,
        .unlocked_ioctl = proc_reg_unlocked_ioctl,
index 8038833..ae832e9 100644 (file)
@@ -868,7 +868,7 @@ static const struct file_operations proc_sys_file_operations = {
        .poll           = proc_sys_poll,
        .read_iter      = proc_sys_read,
        .write_iter     = proc_sys_write,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .splice_write   = iter_file_splice_write,
        .llseek         = default_llseek,
 };
index 846f945..250eb5b 100644 (file)
@@ -324,7 +324,7 @@ static int mountstats_open(struct inode *inode, struct file *file)
 const struct file_operations proc_mounts_operations = {
        .open           = mounts_open,
        .read_iter      = seq_read_iter,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .llseek         = seq_lseek,
        .release        = mounts_release,
        .poll           = mounts_poll,
@@ -333,7 +333,7 @@ const struct file_operations proc_mounts_operations = {
 const struct file_operations proc_mountinfo_operations = {
        .open           = mountinfo_open,
        .read_iter      = seq_read_iter,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .llseek         = seq_lseek,
        .release        = mounts_release,
        .poll           = mounts_poll,
@@ -342,7 +342,7 @@ const struct file_operations proc_mountinfo_operations = {
 const struct file_operations proc_mountstats_operations = {
        .open           = mountstats_open,
        .read_iter      = seq_read_iter,
-       .splice_read    = generic_file_splice_read,
+       .splice_read    = copy_splice_read,
        .llseek         = seq_lseek,
        .release        = mounts_release,
 };