From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kinglong Mee Subject: [PATCH 3/4] sunrpc: New helper cache_force_expire for cache cleanup Date: Wed, 06 May 2015 21:20:41 +0800 Message-ID: <554A1529.4050100@gmail.com> References: <554A149B.5060102@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Al Viro , NeilBrown , Trond Myklebust , kinglongmee-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org To: "J. Bruce Fields" , linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, "linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" Return-path: In-Reply-To: <554A149B.5060102-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-nfs-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-fsdevel.vger.kernel.org Using expiry_time force cleanup a cache. Signed-off-by: Kinglong Mee --- 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.0 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html