From 2ddb1d33245c23c4cafe64fb917323bdf567c81f Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Fri, 15 Sep 2023 13:23:19 +0200 Subject: [PATCH] LU-17015 obdclass: new primitives for upcall cache This patch adds 2 new primitives to the upcall cache mechanism: - upcall_cache_get_entry_raw: get a ref on an existing entry; - upcall_cache_update_entry: modify expiry time and state of an entry. Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: I4825f09ae807abb52ebe0e24719dcd915e8c8aef Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52389 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/include/upcall_cache.h | 4 ++++ lustre/obdclass/upcall_cache.c | 20 ++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lustre/include/upcall_cache.h b/lustre/include/upcall_cache.h index 6933862..d411249 100644 --- a/lustre/include/upcall_cache.h +++ b/lustre/include/upcall_cache.h @@ -127,6 +127,10 @@ struct upcall_cache { struct upcall_cache_entry *upcall_cache_get_entry(struct upcall_cache *cache, __u64 key, void *args); +void upcall_cache_get_entry_raw(struct upcall_cache_entry *entry); +void upcall_cache_update_entry(struct upcall_cache *cache, + struct upcall_cache_entry *entry, + time64_t expire, int state); void upcall_cache_put_entry(struct upcall_cache *cache, struct upcall_cache_entry *entry); int upcall_cache_downcall(struct upcall_cache *cache, __u32 err, __u64 key, diff --git a/lustre/obdclass/upcall_cache.c b/lustre/obdclass/upcall_cache.c index 8c2eec4..014d9ae 100644 --- a/lustre/obdclass/upcall_cache.c +++ b/lustre/obdclass/upcall_cache.c @@ -277,6 +277,26 @@ out: } EXPORT_SYMBOL(upcall_cache_get_entry); +void upcall_cache_get_entry_raw(struct upcall_cache_entry *entry) +{ + get_entry(entry); +} +EXPORT_SYMBOL(upcall_cache_get_entry_raw); + +void upcall_cache_update_entry(struct upcall_cache *cache, + struct upcall_cache_entry *entry, + time64_t expire, int state) +{ + spin_lock(&cache->uc_lock); + entry->ue_expire = expire; + if (!state) + UC_CACHE_SET_VALID(entry); + else + entry->ue_flags |= state; + spin_unlock(&cache->uc_lock); +} +EXPORT_SYMBOL(upcall_cache_update_entry); + void upcall_cache_put_entry(struct upcall_cache *cache, struct upcall_cache_entry *entry) { -- 1.8.3.1