mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
splice: implement default splice_read method
If f_op->splice_read() is not implemented, fall back to a plain read. Use vfs_readv() to read into previously allocated pages. This will allow splice and functions using splice, such as the loop device, to work on all filesystems. This includes "direct_io" files in fuse which bypass the page cache. Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
This commit is contained in:
parent
7c77f0b3f9
commit
6818173bd6
7 changed files with 140 additions and 24 deletions
|
|
@ -709,10 +709,6 @@ static int loop_change_fd(struct loop_device *lo, struct block_device *bdev,
|
|||
if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
|
||||
goto out_putf;
|
||||
|
||||
/* new backing store needs to support loop (eg splice_read) */
|
||||
if (!inode->i_fop->splice_read)
|
||||
goto out_putf;
|
||||
|
||||
/* size of the new backing store needs to be the same */
|
||||
if (get_loop_size(lo, file) != get_loop_size(lo, old_file))
|
||||
goto out_putf;
|
||||
|
|
@ -788,12 +784,7 @@ static int loop_set_fd(struct loop_device *lo, fmode_t mode,
|
|||
error = -EINVAL;
|
||||
if (S_ISREG(inode->i_mode) || S_ISBLK(inode->i_mode)) {
|
||||
const struct address_space_operations *aops = mapping->a_ops;
|
||||
/*
|
||||
* If we can't read - sorry. If we only can't write - well,
|
||||
* it's going to be read-only.
|
||||
*/
|
||||
if (!file->f_op->splice_read)
|
||||
goto out_putf;
|
||||
|
||||
if (aops->write_begin)
|
||||
lo_flags |= LO_FLAGS_USE_AOPS;
|
||||
if (!(lo_flags & LO_FLAGS_USE_AOPS) && !file->f_op->write)
|
||||
|
|
|
|||
Loading…
Reference in a new issue