Skip to content

Commit b007273

Browse files
dhowellsaxboe
authored andcommitted
tty, proc, kernfs, random: Use copy_splice_read()
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 <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> cc: Christoph Hellwig <[email protected]> cc: Jens Axboe <[email protected]> cc: Al Viro <[email protected]> cc: John Hubbard <[email protected]> cc: David Hildenbrand <[email protected]> cc: Matthew Wilcox <[email protected]> cc: Miklos Szeredi <[email protected]> cc: Arnd Bergmann <[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 a1be293 commit b007273

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

drivers/char/random.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1546,7 +1546,7 @@ const struct file_operations random_fops = {
15461546
.compat_ioctl = compat_ptr_ioctl,
15471547
.fasync = random_fasync,
15481548
.llseek = noop_llseek,
1549-
.splice_read = generic_file_splice_read,
1549+
.splice_read = copy_splice_read,
15501550
.splice_write = iter_file_splice_write,
15511551
};
15521552

@@ -1557,7 +1557,7 @@ const struct file_operations urandom_fops = {
15571557
.compat_ioctl = compat_ptr_ioctl,
15581558
.fasync = random_fasync,
15591559
.llseek = noop_llseek,
1560-
.splice_read = generic_file_splice_read,
1560+
.splice_read = copy_splice_read,
15611561
.splice_write = iter_file_splice_write,
15621562
};
15631563

drivers/tty/tty_io.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ static const struct file_operations tty_fops = {
466466
.llseek = no_llseek,
467467
.read_iter = tty_read,
468468
.write_iter = tty_write,
469-
.splice_read = generic_file_splice_read,
469+
.splice_read = copy_splice_read,
470470
.splice_write = iter_file_splice_write,
471471
.poll = tty_poll,
472472
.unlocked_ioctl = tty_ioctl,
@@ -481,7 +481,7 @@ static const struct file_operations console_fops = {
481481
.llseek = no_llseek,
482482
.read_iter = tty_read,
483483
.write_iter = redirected_tty_write,
484-
.splice_read = generic_file_splice_read,
484+
.splice_read = copy_splice_read,
485485
.splice_write = iter_file_splice_write,
486486
.poll = tty_poll,
487487
.unlocked_ioctl = tty_ioctl,

fs/kernfs/file.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,7 @@ const struct file_operations kernfs_file_fops = {
10111011
.release = kernfs_fop_release,
10121012
.poll = kernfs_fop_poll,
10131013
.fsync = noop_fsync,
1014-
.splice_read = generic_file_splice_read,
1014+
.splice_read = copy_splice_read,
10151015
.splice_write = iter_file_splice_write,
10161016
};
10171017

fs/proc/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static const struct file_operations proc_iter_file_ops = {
591591
.llseek = proc_reg_llseek,
592592
.read_iter = proc_reg_read_iter,
593593
.write = proc_reg_write,
594-
.splice_read = generic_file_splice_read,
594+
.splice_read = copy_splice_read,
595595
.poll = proc_reg_poll,
596596
.unlocked_ioctl = proc_reg_unlocked_ioctl,
597597
.mmap = proc_reg_mmap,
@@ -617,7 +617,7 @@ static const struct file_operations proc_reg_file_ops_compat = {
617617
static const struct file_operations proc_iter_file_ops_compat = {
618618
.llseek = proc_reg_llseek,
619619
.read_iter = proc_reg_read_iter,
620-
.splice_read = generic_file_splice_read,
620+
.splice_read = copy_splice_read,
621621
.write = proc_reg_write,
622622
.poll = proc_reg_poll,
623623
.unlocked_ioctl = proc_reg_unlocked_ioctl,

fs/proc/proc_sysctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ static const struct file_operations proc_sys_file_operations = {
868868
.poll = proc_sys_poll,
869869
.read_iter = proc_sys_read,
870870
.write_iter = proc_sys_write,
871-
.splice_read = generic_file_splice_read,
871+
.splice_read = copy_splice_read,
872872
.splice_write = iter_file_splice_write,
873873
.llseek = default_llseek,
874874
};

fs/proc_namespace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ static int mountstats_open(struct inode *inode, struct file *file)
324324
const struct file_operations proc_mounts_operations = {
325325
.open = mounts_open,
326326
.read_iter = seq_read_iter,
327-
.splice_read = generic_file_splice_read,
327+
.splice_read = copy_splice_read,
328328
.llseek = seq_lseek,
329329
.release = mounts_release,
330330
.poll = mounts_poll,
@@ -333,7 +333,7 @@ const struct file_operations proc_mounts_operations = {
333333
const struct file_operations proc_mountinfo_operations = {
334334
.open = mountinfo_open,
335335
.read_iter = seq_read_iter,
336-
.splice_read = generic_file_splice_read,
336+
.splice_read = copy_splice_read,
337337
.llseek = seq_lseek,
338338
.release = mounts_release,
339339
.poll = mounts_poll,
@@ -342,7 +342,7 @@ const struct file_operations proc_mountinfo_operations = {
342342
const struct file_operations proc_mountstats_operations = {
343343
.open = mountstats_open,
344344
.read_iter = seq_read_iter,
345-
.splice_read = generic_file_splice_read,
345+
.splice_read = copy_splice_read,
346346
.llseek = seq_lseek,
347347
.release = mounts_release,
348348
};

0 commit comments

Comments
 (0)