Note that fscache_operation_valid() may return NULL, but we do not care about it, that is to say the validity checking is needless. Actually, there's a call to fscache_begin_operation() beforehand, which will make sure the resources are usable for the subsequent operations. And we have already called ops->prepare_write() before fscache_write(). Signed-off-by: Yue Hu <huyue2@xxxxxxxxxxx> --- include/linux/fscache.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/include/linux/fscache.h b/include/linux/fscache.h index 72585c9729a2..8045497c6515 100644 --- a/include/linux/fscache.h +++ b/include/linux/fscache.h @@ -510,9 +510,8 @@ int fscache_read(struct netfs_cache_resources *cres, netfs_io_terminated_t term_func, void *term_func_priv) { - const struct netfs_cache_ops *ops = fscache_operation_valid(cres); - return ops->read(cres, start_pos, iter, read_hole, - term_func, term_func_priv); + return cres->ops->read(cres, start_pos, iter, read_hole, term_func, + term_func_priv); } /** @@ -568,8 +567,8 @@ int fscache_write(struct netfs_cache_resources *cres, netfs_io_terminated_t term_func, void *term_func_priv) { - const struct netfs_cache_ops *ops = fscache_operation_valid(cres); - return ops->write(cres, start_pos, iter, term_func, term_func_priv); + return cres->ops->write(cres, start_pos, iter, term_func, + term_func_priv); } /** -- 2.17.1 -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/linux-cachefs