From: Sebastien Buisson Date: Tue, 5 Sep 2023 09:08:16 +0000 (+0200) Subject: LU-17015 obdclass: set cache entry/acquire expiry at init X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=a41f1756e5d4787a135c823ca557ce861d02e08d;p=fs%2Flustre-release.git LU-17015 obdclass: set cache entry/acquire expiry at init 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 Change-Id: Iee0dea66943ab6747d85a378861ae98c29faa11a Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/52370 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- diff --git a/lustre/include/upcall_cache.h b/lustre/include/upcall_cache.h index abc3032..6fe4396 100644 --- a/lustre/include/upcall_cache.h +++ b/lustre/include/upcall_cache.h @@ -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 */ diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index ded9a24..4a8d2c1 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -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); diff --git a/lustre/obdclass/upcall_cache.c b/lustre/obdclass/upcall_cache.c index 4ea1aba..5b9265e 100644 --- a/lustre/obdclass/upcall_cache.c +++ b/lustre/obdclass/upcall_cache.c @@ -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);