Whamcloud - gitweb
LU-17015 obdclass: new primitives for upcall cache 89/52389/2
authorSebastien Buisson <sbuisson@ddn.com>
Fri, 15 Sep 2023 11:23:19 +0000 (13:23 +0200)
committerOleg Drokin <green@whamcloud.com>
Sat, 23 Sep 2023 06:04:40 +0000 (06:04 +0000)
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 <sbuisson@ddn.com>
Change-Id: I4825f09ae807abb52ebe0e24719dcd915e8c8aef
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52389
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/include/upcall_cache.h
lustre/obdclass/upcall_cache.c

index 6933862..d411249 100644 (file)
@@ -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,
index 8c2eec4..014d9ae 100644 (file)
@@ -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)
 {