mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
afs: Provide a splice-read wrapper
Provide a splice_read wrapper for AFS to call afs_validate() before going into generic_file_splice_read() so that we're likely to have a callback promise from the server. Signed-off-by: David Howells <dhowells@redhat.com> cc: Christoph Hellwig <hch@lst.de> cc: Al Viro <viro@zeniv.linux.org.uk> cc: Jens Axboe <axboe@kernel.dk> cc: Marc Dionne <marc.dionne@auristor.com> cc: linux-afs@lists.infradead.org cc: linux-fsdevel@vger.kernel.org cc: linux-block@vger.kernel.org cc: linux-mm@kvack.org Link: https://lore.kernel.org/r/20230522135018.2742245-16-dhowells@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
c829d0bd33
commit
d96d96eebb
@ -25,6 +25,9 @@ static void afs_invalidate_folio(struct folio *folio, size_t offset,
|
||||
static bool afs_release_folio(struct folio *folio, gfp_t gfp_flags);
|
||||
|
||||
static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter);
|
||||
static ssize_t afs_file_splice_read(struct file *in, loff_t *ppos,
|
||||
struct pipe_inode_info *pipe,
|
||||
size_t len, unsigned int flags);
|
||||
static void afs_vm_open(struct vm_area_struct *area);
|
||||
static void afs_vm_close(struct vm_area_struct *area);
|
||||
static vm_fault_t afs_vm_map_pages(struct vm_fault *vmf, pgoff_t start_pgoff, pgoff_t end_pgoff);
|
||||
@ -36,7 +39,7 @@ const struct file_operations afs_file_operations = {
|
||||
.read_iter = afs_file_read_iter,
|
||||
.write_iter = afs_file_write,
|
||||
.mmap = afs_file_mmap,
|
||||
.splice_read = generic_file_splice_read,
|
||||
.splice_read = afs_file_splice_read,
|
||||
.splice_write = iter_file_splice_write,
|
||||
.fsync = afs_fsync,
|
||||
.lock = afs_lock,
|
||||
@ -587,3 +590,18 @@ static ssize_t afs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter)
|
||||
|
||||
return generic_file_read_iter(iocb, iter);
|
||||
}
|
||||
|
||||
static ssize_t afs_file_splice_read(struct file *in, loff_t *ppos,
|
||||
struct pipe_inode_info *pipe,
|
||||
size_t len, unsigned int flags)
|
||||
{
|
||||
struct afs_vnode *vnode = AFS_FS_I(file_inode(in));
|
||||
struct afs_file *af = in->private_data;
|
||||
int ret;
|
||||
|
||||
ret = afs_validate(vnode, af->key);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return generic_file_splice_read(in, ppos, pipe, len, flags);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user