Skip to content

Commit e9b57aa

Browse files
lostjeffledhowells
authored andcommitted
fscache: export fscache_end_operation()
Export fscache_end_operation() to avoid code duplication. Besides, considering the paired fscache_begin_read_operation() is already exported, it shall make sense to also export fscache_end_operation(). Signed-off-by: Jeffle Xu <jefflexu@linux.alibaba.com> Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Jeff Layton <jlayton@kernel.org> cc: linux-cachefs@redhat.com Link: https://lore.kernel.org/r/20220302125134.131039-2-jefflexu@linux.alibaba.com/ # Jeffle's v4 Link: https://lore.kernel.org/r/164622971432.3564931.12184135678781328146.stgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/164678190346.1200972.7453733431978569479.stgit@warthog.procyon.org.uk/ # v2 Link: https://lore.kernel.org/r/164692888334.2099075.5166283293894267365.stgit@warthog.procyon.org.uk/ # v3 Link: https://lore.kernel.org/r/20220316131723.111553-2-jefflexu@linux.alibaba.com/ # v5
1 parent ad5255c commit e9b57aa

4 files changed

Lines changed: 14 additions & 27 deletions

File tree

fs/cifs/fscache.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,6 @@ void cifs_fscache_release_inode_cookie(struct inode *inode)
134134
}
135135
}
136136

137-
static inline void fscache_end_operation(struct netfs_cache_resources *cres)
138-
{
139-
const struct netfs_cache_ops *ops = fscache_operation_valid(cres);
140-
141-
if (ops)
142-
ops->end_operation(cres);
143-
}
144-
145137
/*
146138
* Fallback page reading interface.
147139
*/

fs/fscache/internal.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ static inline void fscache_see_cookie(struct fscache_cookie *cookie,
7070
where);
7171
}
7272

73-
/*
74-
* io.c
75-
*/
76-
static inline void fscache_end_operation(struct netfs_cache_resources *cres)
77-
{
78-
const struct netfs_cache_ops *ops = fscache_operation_valid(cres);
79-
80-
if (ops)
81-
ops->end_operation(cres);
82-
}
83-
8473
/*
8574
* main.c
8675
*/

fs/nfs/fscache.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,6 @@ void nfs_fscache_release_file(struct inode *inode, struct file *filp)
249249
}
250250
}
251251

252-
static inline void fscache_end_operation(struct netfs_cache_resources *cres)
253-
{
254-
const struct netfs_cache_ops *ops = fscache_operation_valid(cres);
255-
256-
if (ops)
257-
ops->end_operation(cres);
258-
}
259-
260252
/*
261253
* Fallback page reading interface.
262254
*/

include/linux/fscache.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,20 @@ int fscache_begin_read_operation(struct netfs_cache_resources *cres,
456456
return -ENOBUFS;
457457
}
458458

459+
/**
460+
* fscache_end_operation - End the read operation for the netfs lib
461+
* @cres: The cache resources for the read operation
462+
*
463+
* Clean up the resources at the end of the read request.
464+
*/
465+
static inline void fscache_end_operation(struct netfs_cache_resources *cres)
466+
{
467+
const struct netfs_cache_ops *ops = fscache_operation_valid(cres);
468+
469+
if (ops)
470+
ops->end_operation(cres);
471+
}
472+
459473
/**
460474
* fscache_read - Start a read from the cache.
461475
* @cres: The cache resources to use

0 commit comments

Comments
 (0)