Commit ab825131 authored by David Howells's avatar David Howells Committed by Jens Axboe

cifs: Use filemap_splice_read()

Make cifs use filemap_splice_read() rather than doing its own version of
generic_file_splice_read().
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarPaulo Alcantara (SUSE) <pc@manguebit.com>
cc: Jens Axboe <axboe@kernel.dk>
cc: Steve French <smfrench@gmail.com>
cc: Al Viro <viro@zeniv.linux.org.uk>
cc: David Hildenbrand <david@redhat.com>
cc: John Hubbard <jhubbard@nvidia.com>
cc: linux-mm@kvack.org
cc: linux-block@vger.kernel.org
cc: linux-cifs@vger.kernel.org
cc: linux-fsdevel@vger.kernel.org
Link: https://lore.kernel.org/r/20230522135018.2742245-28-dhowells@redhat.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 5bd4990f
...@@ -1376,7 +1376,7 @@ const struct file_operations cifs_file_ops = { ...@@ -1376,7 +1376,7 @@ const struct file_operations cifs_file_ops = {
.fsync = cifs_fsync, .fsync = cifs_fsync,
.flush = cifs_flush, .flush = cifs_flush,
.mmap = cifs_file_mmap, .mmap = cifs_file_mmap,
.splice_read = cifs_splice_read, .splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.llseek = cifs_llseek, .llseek = cifs_llseek,
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
...@@ -1396,7 +1396,7 @@ const struct file_operations cifs_file_strict_ops = { ...@@ -1396,7 +1396,7 @@ const struct file_operations cifs_file_strict_ops = {
.fsync = cifs_strict_fsync, .fsync = cifs_strict_fsync,
.flush = cifs_flush, .flush = cifs_flush,
.mmap = cifs_file_strict_mmap, .mmap = cifs_file_strict_mmap,
.splice_read = cifs_splice_read, .splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.llseek = cifs_llseek, .llseek = cifs_llseek,
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
...@@ -1434,7 +1434,7 @@ const struct file_operations cifs_file_nobrl_ops = { ...@@ -1434,7 +1434,7 @@ const struct file_operations cifs_file_nobrl_ops = {
.fsync = cifs_fsync, .fsync = cifs_fsync,
.flush = cifs_flush, .flush = cifs_flush,
.mmap = cifs_file_mmap, .mmap = cifs_file_mmap,
.splice_read = cifs_splice_read, .splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.llseek = cifs_llseek, .llseek = cifs_llseek,
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
...@@ -1452,7 +1452,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = { ...@@ -1452,7 +1452,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
.fsync = cifs_strict_fsync, .fsync = cifs_strict_fsync,
.flush = cifs_flush, .flush = cifs_flush,
.mmap = cifs_file_strict_mmap, .mmap = cifs_file_strict_mmap,
.splice_read = cifs_splice_read, .splice_read = filemap_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.llseek = cifs_llseek, .llseek = cifs_llseek,
.unlocked_ioctl = cifs_ioctl, .unlocked_ioctl = cifs_ioctl,
......
...@@ -100,9 +100,6 @@ extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to); ...@@ -100,9 +100,6 @@ extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to);
extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from);
extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from);
extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from); extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from);
extern ssize_t cifs_splice_read(struct file *in, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags);
extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock);
extern int cifs_lock(struct file *, int, struct file_lock *); extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, loff_t, loff_t, int); extern int cifs_fsync(struct file *, loff_t, loff_t, int);
......
...@@ -5078,19 +5078,3 @@ const struct address_space_operations cifs_addr_ops_smallbuf = { ...@@ -5078,19 +5078,3 @@ const struct address_space_operations cifs_addr_ops_smallbuf = {
.launder_folio = cifs_launder_folio, .launder_folio = cifs_launder_folio,
.migrate_folio = filemap_migrate_folio, .migrate_folio = filemap_migrate_folio,
}; };
/*
* Splice data from a file into a pipe.
*/
ssize_t cifs_splice_read(struct file *in, loff_t *ppos,
struct pipe_inode_info *pipe, size_t len,
unsigned int flags)
{
if (unlikely(*ppos >= file_inode(in)->i_sb->s_maxbytes))
return 0;
if (unlikely(!len))
return 0;
if (in->f_flags & O_DIRECT)
return copy_splice_read(in, ppos, pipe, len, flags);
return filemap_splice_read(in, ppos, pipe, len, flags);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment