diff options
author | Soumya Koduri <skoduri@redhat.com> | 2015-04-22 15:48:52 +0530 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-05-04 16:27:41 -0700 |
commit | 86fb4828f5566e455a12ac2207999120275b61a7 (patch) | |
tree | 8d5806d43b1f16024dc38f31847a76b2c07a879c /xlators/features/upcall/src/upcall.h | |
parent | f8bb9ac26aad8c0068bcc45a34ecb4a73cc06e7a (diff) |
Upcall: Cleanup expired client entries
To cleanup expired client entries (with access_time > 2*CACHE_INVALIDATION_TIMEOUT),
have
* defined a global list to contain all the upcall_inode_ctx allocated
* Every time a upcall_inode_ctx is allocated, it is added to the global list
* during inode_forget, that upcall_inode_ctx is marked for destroy
* created a reaper thread which scans through that list
* cleans up expired client entries
* frees the inode_ctx with destroy_mode set.
Note: This reaper thread is initialized only when features.cache_invalidation option
is enabled.
Change-Id: Iea2a63eb31b8e08d5709e7e090cf26fd13d01265
BUG: 1200267
Signed-off-by: Soumya Koduri <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/10342
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators/features/upcall/src/upcall.h')
-rw-r--r-- | xlators/features/upcall/src/upcall.h | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h index 7e15f6c97cd..41895786382 100644 --- a/xlators/features/upcall/src/upcall.h +++ b/xlators/features/upcall/src/upcall.h @@ -56,6 +56,11 @@ struct _upcall_private_t { gf_boolean_t cache_invalidation_enabled; int32_t cache_invalidation_timeout; + struct list_head inode_ctx_list; + gf_lock_t inode_ctx_lk; + int32_t reaper_init_done; + pthread_t reaper_thr; + int32_t fini; }; typedef struct _upcall_private_t upcall_private_t; @@ -71,9 +76,11 @@ typedef struct _upcall_client_t upcall_client_t; /* Upcall entries are maintained in inode_ctx */ struct _upcall_inode_ctx_t { + struct list_head inode_ctx_list; struct list_head client_list; pthread_mutex_t client_list_lock; /* mutex for clients list - of this upcall entry */ + of this upcall entry */ + int destroy; }; typedef struct _upcall_inode_ctx_t upcall_inode_ctx_t; @@ -113,6 +120,8 @@ upcall_client_t *__get_upcall_client (call_frame_t *frame, uuid_t gfid, client_t *client, upcall_inode_ctx_t *up_inode_ctx); int __upcall_cleanup_client_entry (upcall_client_t *up_client); +int upcall_cleanup_expired_clients (xlator_t *this, + upcall_inode_ctx_t *up_inode_ctx); int __upcall_inode_ctx_set (inode_t *inode, xlator_t *this); upcall_inode_ctx_t *__upcall_inode_ctx_get (inode_t *inode, xlator_t *this); @@ -121,6 +130,9 @@ int upcall_cleanup_inode_ctx (xlator_t *this, inode_t *inode); void upcall_cache_forget (xlator_t *this, inode_t *inode, upcall_inode_ctx_t *up_inode_ctx); +void *upcall_reaper_thread (void *data); +int upcall_reaper_thread_init (xlator_t *this); + /* Xlator options */ gf_boolean_t is_upcall_enabled(xlator_t *this); |