Whamcloud - gitweb
LU-17015 obdclass: set cache entry/acquire expiry at init
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 5 Sep 2023 09:08:16 +0000 (11:08 +0200)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 18 Sep 2023 06:28:44 +0000 (06:28 +0000)
Give the ability to define values for cache entry expire and acquire
expire directly at upcall cache init.

Lustre-change: https://review.whamcloud.com/52271
Lustre-commit: TBD (from 2d24c820f32699d66b56024ae99a7b27944f6130)

Test-Parameters: trivial
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: Iee0dea66943ab6747d85a378861ae98c29faa11a
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52370
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/include/upcall_cache.h
lustre/mdt/mdt_handler.c
lustre/obdclass/upcall_cache.c

index abc3032..6fe4396 100644 (file)
@@ -146,7 +146,9 @@ static inline void upcall_cache_flush_all(struct upcall_cache *cache)
 
 void upcall_cache_flush_one(struct upcall_cache *cache, __u64 key, void *args);
 struct upcall_cache *upcall_cache_init(const char *name, const char *upcall,
-                                     int hashsz, struct upcall_cache_ops *ops);
+                                      int hashsz, time64_t entry_expire,
+                                      time64_t acquire_expire,
+                                      struct upcall_cache_ops *ops);
 void upcall_cache_cleanup(struct upcall_cache *cache);
 
 /** @} ucache */
index ded9a24..4a8d2c1 100644 (file)
@@ -6186,6 +6186,8 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
        m->mdt_identity_cache = upcall_cache_init(mdt_obd_name(m),
                                                identity_upcall,
                                                UC_IDCACHE_HASH_SIZE,
+                                               1200, /* entry expire: 20 mn */
+                                               30, /* acquire expire: 30 s */
                                                &mdt_identity_upcall_cache_ops);
        if (IS_ERR(m->mdt_identity_cache)) {
                rc = PTR_ERR(m->mdt_identity_cache);
index 4ea1aba..5b9265e 100644 (file)
@@ -544,7 +544,9 @@ void upcall_cache_flush_one(struct upcall_cache *cache, __u64 key, void *args)
 EXPORT_SYMBOL(upcall_cache_flush_one);
 
 struct upcall_cache *upcall_cache_init(const char *name, const char *upcall,
-                                      int hashsz, struct upcall_cache_ops *ops)
+                                      int hashsz, time64_t entry_expire,
+                                      time64_t acquire_expire,
+                                      struct upcall_cache_ops *ops)
 {
        struct upcall_cache *cache;
        int i;
@@ -566,8 +568,8 @@ struct upcall_cache *upcall_cache_init(const char *name, const char *upcall,
        strlcpy(cache->uc_name, name, sizeof(cache->uc_name));
        /* upcall pathname proc tunable */
        strlcpy(cache->uc_upcall, upcall, sizeof(cache->uc_upcall));
-       cache->uc_entry_expire = 20 * 60;
-       cache->uc_acquire_expire = 30;
+       cache->uc_entry_expire = entry_expire;
+       cache->uc_acquire_expire = acquire_expire;
        cache->uc_ops = ops;
 
        RETURN(cache);