tty, proc, kernfs, random: Use copy_splice_read()
JIRA: https://issues.redhat.com/browse/RHEL-27742 This patch is a backport of the following upstream commit: commit b0072734ffaa3f5fec64058d0d3333765d789bc0 Author: David Howells <dhowells@redhat.com> Date: Mon May 22 14:49:59 2023 +0100 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 <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> Signed-off-by: Rafael Aquini <raquini@redhat.com>
This commit is contained in:
parent
0a98879655
commit
800fb8128b
|
@ -1646,7 +1646,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,
|
||||
};
|
||||
|
||||
|
@ -1658,7 +1658,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,
|
||||
};
|
||||
|
||||
|
|
|
@ -465,7 +465,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,
|
||||
|
@ -480,7 +480,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,
|
||||
|
|
|
@ -1012,7 +1012,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,
|
||||
};
|
||||
|
||||
|
|
|
@ -586,7 +586,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,
|
||||
|
@ -612,7 +612,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,
|
||||
|
|
|
@ -869,7 +869,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,
|
||||
};
|
||||
|
|
|
@ -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,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue