Skip to content

Commit ab82513

Browse files
dhowellsaxboe
authored andcommitted
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: David Howells <dhowells@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Paulo 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.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 5bd4990 commit ab82513

File tree

3 files changed

+4
-23
lines changed

3 files changed

+4
-23
lines changed

fs/cifs/cifsfs.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,7 +1376,7 @@ const struct file_operations cifs_file_ops = {
13761376
.fsync = cifs_fsync,
13771377
.flush = cifs_flush,
13781378
.mmap = cifs_file_mmap,
1379-
.splice_read = cifs_splice_read,
1379+
.splice_read = filemap_splice_read,
13801380
.splice_write = iter_file_splice_write,
13811381
.llseek = cifs_llseek,
13821382
.unlocked_ioctl = cifs_ioctl,
@@ -1396,7 +1396,7 @@ const struct file_operations cifs_file_strict_ops = {
13961396
.fsync = cifs_strict_fsync,
13971397
.flush = cifs_flush,
13981398
.mmap = cifs_file_strict_mmap,
1399-
.splice_read = cifs_splice_read,
1399+
.splice_read = filemap_splice_read,
14001400
.splice_write = iter_file_splice_write,
14011401
.llseek = cifs_llseek,
14021402
.unlocked_ioctl = cifs_ioctl,
@@ -1434,7 +1434,7 @@ const struct file_operations cifs_file_nobrl_ops = {
14341434
.fsync = cifs_fsync,
14351435
.flush = cifs_flush,
14361436
.mmap = cifs_file_mmap,
1437-
.splice_read = cifs_splice_read,
1437+
.splice_read = filemap_splice_read,
14381438
.splice_write = iter_file_splice_write,
14391439
.llseek = cifs_llseek,
14401440
.unlocked_ioctl = cifs_ioctl,
@@ -1452,7 +1452,7 @@ const struct file_operations cifs_file_strict_nobrl_ops = {
14521452
.fsync = cifs_strict_fsync,
14531453
.flush = cifs_flush,
14541454
.mmap = cifs_file_strict_mmap,
1455-
.splice_read = cifs_splice_read,
1455+
.splice_read = filemap_splice_read,
14561456
.splice_write = iter_file_splice_write,
14571457
.llseek = cifs_llseek,
14581458
.unlocked_ioctl = cifs_ioctl,

fs/cifs/cifsfs.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ extern ssize_t cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to);
100100
extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from);
101101
extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from);
102102
extern ssize_t cifs_strict_writev(struct kiocb *iocb, struct iov_iter *from);
103-
extern ssize_t cifs_splice_read(struct file *in, loff_t *ppos,
104-
struct pipe_inode_info *pipe, size_t len,
105-
unsigned int flags);
106103
extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock);
107104
extern int cifs_lock(struct file *, int, struct file_lock *);
108105
extern int cifs_fsync(struct file *, loff_t, loff_t, int);

fs/cifs/file.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5078,19 +5078,3 @@ const struct address_space_operations cifs_addr_ops_smallbuf = {
50785078
.launder_folio = cifs_launder_folio,
50795079
.migrate_folio = filemap_migrate_folio,
50805080
};
5081-
5082-
/*
5083-
* Splice data from a file into a pipe.
5084-
*/
5085-
ssize_t cifs_splice_read(struct file *in, loff_t *ppos,
5086-
struct pipe_inode_info *pipe, size_t len,
5087-
unsigned int flags)
5088-
{
5089-
if (unlikely(*ppos >= file_inode(in)->i_sb->s_maxbytes))
5090-
return 0;
5091-
if (unlikely(!len))
5092-
return 0;
5093-
if (in->f_flags & O_DIRECT)
5094-
return copy_splice_read(in, ppos, pipe, len, flags);
5095-
return filemap_splice_read(in, ppos, pipe, len, flags);
5096-
}

0 commit comments

Comments
 (0)