From 0f8e41985f8680bc75b2b50be247ffb8f25c1fbf 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. Lustre-change: https://review.whamcloud.com/52389 Lustre-commit: 2ddb1d33245c23c4cafe64fb917323bdf567c81f Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: I4825f09ae807abb52ebe0e24719dcd915e8c8aef Reviewed-by: Andreas Dilger Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52497 Tested-by: jenkins Tested-by: Maloo --- 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 6fe4396..4f553d9 100644 --- a/lustre/include/upcall_cache.h +++ b/lustre/include/upcall_cache.h @@ -128,6 +128,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 5b9265e..af0d7f2 100644 --- a/lustre/obdclass/upcall_cache.c +++ b/lustre/obdclass/upcall_cache.c @@ -396,6 +396,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