Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

David Howells and committed by
Jens Axboe
ab825131 5bd4990f

+4 -23
+4 -4
fs/cifs/cifsfs.c
··· 1376 1376 .fsync = cifs_fsync, 1377 1377 .flush = cifs_flush, 1378 1378 .mmap = cifs_file_mmap, 1379 - .splice_read = cifs_splice_read, 1379 + .splice_read = filemap_splice_read, 1380 1380 .splice_write = iter_file_splice_write, 1381 1381 .llseek = cifs_llseek, 1382 1382 .unlocked_ioctl = cifs_ioctl, ··· 1396 1396 .fsync = cifs_strict_fsync, 1397 1397 .flush = cifs_flush, 1398 1398 .mmap = cifs_file_strict_mmap, 1399 - .splice_read = cifs_splice_read, 1399 + .splice_read = filemap_splice_read, 1400 1400 .splice_write = iter_file_splice_write, 1401 1401 .llseek = cifs_llseek, 1402 1402 .unlocked_ioctl = cifs_ioctl, ··· 1434 1434 .fsync = cifs_fsync, 1435 1435 .flush = cifs_flush, 1436 1436 .mmap = cifs_file_mmap, 1437 - .splice_read = cifs_splice_read, 1437 + .splice_read = filemap_splice_read, 1438 1438 .splice_write = iter_file_splice_write, 1439 1439 .llseek = cifs_llseek, 1440 1440 .unlocked_ioctl = cifs_ioctl, ··· 1452 1452 .fsync = cifs_strict_fsync, 1453 1453 .flush = cifs_flush, 1454 1454 .mmap = cifs_file_strict_mmap, 1455 - .splice_read = cifs_splice_read, 1455 + .splice_read = filemap_splice_read, 1456 1456 .splice_write = iter_file_splice_write, 1457 1457 .llseek = cifs_llseek, 1458 1458 .unlocked_ioctl = cifs_ioctl,
-3
fs/cifs/cifsfs.h
··· 100 100 extern ssize_t cifs_user_writev(struct kiocb *iocb, struct iov_iter *from); 101 101 extern ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from); 102 102 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); 106 103 extern int cifs_flock(struct file *pfile, int cmd, struct file_lock *plock); 107 104 extern int cifs_lock(struct file *, int, struct file_lock *); 108 105 extern int cifs_fsync(struct file *, loff_t, loff_t, int);
-16
fs/cifs/file.c
··· 5078 5078 .launder_folio = cifs_launder_folio, 5079 5079 .migrate_folio = filemap_migrate_folio, 5080 5080 }; 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 - }