All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4/5 v3] sunrpc: New helper cache_force_expire for cache cleanup
@ 2015-06-02  1:26 ` Kinglong Mee
  0 siblings, 0 replies; 2+ messages in thread
From: Kinglong Mee @ 2015-06-02  1:26 UTC (permalink / raw)
  To: J. Bruce Fields, linux-fsdevel, linux-nfs@vger.kernel.org,
	Al Viro
  Cc: Trond Myklebust, NeilBrown, kinglongmee

Using expiry_time force cleanup a cache.

v3: same as v1.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
---
 include/linux/sunrpc/cache.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h
index 437ddb6..ce75e9c 100644
--- a/include/linux/sunrpc/cache.h
+++ b/include/linux/sunrpc/cache.h
@@ -210,6 +210,17 @@ extern int cache_check(struct cache_detail *detail,
 		       struct cache_head *h, struct cache_req *rqstp);
 extern void cache_flush(void);
 extern void cache_purge(struct cache_detail *detail);
+
+static inline void cache_force_expire(struct cache_detail *detail, struct cache_head *h)
+{
+	write_lock(&detail->hash_lock);
+	h->expiry_time = seconds_since_boot() - 1;
+	detail->nextcheck = seconds_since_boot();
+	write_unlock(&detail->hash_lock);
+
+	cache_flush();
+}
+
 #define NEVER (0x7FFFFFFF)
 extern void __init cache_initialize(void);
 extern int cache_register_net(struct cache_detail *cd, struct net *net);
-- 
2.4.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-02  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-02  1:26 [PATCH 4/5 v3] sunrpc: New helper cache_force_expire for cache cleanup Kinglong Mee
2015-06-02  1:26 ` Kinglong Mee

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.