Skip to contentSkip to conversation

sunrpc: New helper cache_force_expire for cache cleanup

PATCH In review Kinglong Mee 1 participant 1 message Jun 6, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 4/5 sunrpc: New helper cache_force_expire for cache cleanup

Using expiry_time force cleanup a cache.

v4, same v1.

---
 include/linux/sunrpc/cache.h | 11 +++++++++++
 1 file changed, 11 insertions(+)
include/linux/sunrpc/cache.h +11 -0
index 437ddb6..ce75e9c 100644
@@ -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);
Signature · 6 lines
2.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html