From 407167f4d18522fb47821030e3b171cbdb7158a0 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Tue, 5 Sep 2023 11:08:16 +0200 Subject: [PATCH] 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. Test-Parameters: trivial Signed-off-by: Sebastien Buisson Change-Id: Iee0dea66943ab6747d85a378861ae98c29faa11a Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52271 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Aurelien Degremont Reviewed-by: Andreas Dilger --- lustre/include/upcall_cache.h | 4 +++- lustre/mdt/mdt_handler.c | 2 ++ lustre/obdclass/upcall_cache.c | 8 +++++--- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lustre/include/upcall_cache.h b/lustre/include/upcall_cache.h index 42e6b7f..6933862 100644 --- a/lustre/include/upcall_cache.h +++ b/lustre/include/upcall_cache.h @@ -145,7 +145,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 2027012..293420f 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -6338,6 +6338,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 0a332c8..8c2eec4 100644 --- a/lustre/obdclass/upcall_cache.c +++ b/lustre/obdclass/upcall_cache.c @@ -425,7 +425,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; @@ -447,8 +449,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); -- 1.8.3.1