Re: [PATCH v16 03/13] overlayfs: Implement splice-read

David Howells
2023-03-08T15:57:48Z

Miklos Szeredi <miklos@szeredi.hu> wrote:

> > + ret = -EINVAL;
> > + if (!real.file->f_op->splice_read)
> > + goto out_fdput;
> > +
> > + ret = rw_verify_area(READ, real.file, ppos, len);
> > + if (unlikely(ret < 0))
> > + goto out_fdput;
> > +
> > + old_cred = ovl_override_creds(file_inode(in)->i_sb);
> > + ret = real.file->f_op->splice_read(real.file, ppos, pipe, len, flags);
>
> I don't think you replied to my suggestion of using a helper here.
> E.g. it could be as simple as exporting do_splice_to(), or renaming it
> to vfs_splice_read() to be more readable. It would remove the
> boilerplate and be more robust if any changes are done to the splice
> reading code.

Using do_splice_to() as a helper is probably a good idea, though both Willy
and Christoph seem to dislike it.

The pipe occupancy check has already been done, so I'm not sure if it should
be repeated - though it probably wouldn't hurt.

David