From 25f97b2788a33efcb0714ad639f8db380b864982 Mon Sep 17 00:00:00 2001 From: Soumya Koduri Date: Tue, 24 Mar 2015 10:30:31 +0530 Subject: Upcall: Added xlator options to enable cache-invalidation Added two xlator options to enable cache-invalidation and set cache-invalidation-timeout. In addition, made few minor changes in the upcall processing code in gfapi. Change-Id: Ie0b32ca8348e34e3fe4f1e7df30cc925fa4aad31 BUG: 1200271 Signed-off-by: Soumya Koduri Reviewed-on: http://review.gluster.org/9975 Reviewed-by: Meghana M Reviewed-by: Kaleb KEITHLEY Tested-by: Gluster Build System --- .../upcall/src/upcall-cache-invalidation.h | 27 +++++++++++++--------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'xlators/features/upcall/src/upcall-cache-invalidation.h') diff --git a/xlators/features/upcall/src/upcall-cache-invalidation.h b/xlators/features/upcall/src/upcall-cache-invalidation.h index 758ddf1dae8..138595cecb6 100644 --- a/xlators/features/upcall/src/upcall-cache-invalidation.h +++ b/xlators/features/upcall/src/upcall-cache-invalidation.h @@ -16,13 +16,9 @@ #include "config.h" #endif -/* TODO: Below macros have to be replaced with - * xlator options - Bug1200271 */ -#define ON_CACHE_INVALIDATION 0 /* disable by default */ - /* The time period for which a client will be notified of cache_invalidation * events post its last access */ -#define CACHE_INVALIDATION_PERIOD 60 +#define CACHE_INVALIDATION_TIMEOUT "60" /* Flags sent for cache_invalidation */ #define UP_NLINK 0x00000001 /* update nlink */ @@ -58,13 +54,19 @@ #define UP_NLINK_FLAGS (UP_NLINK | UP_TIMES) #define CACHE_INVALIDATE(frame, this, client, inode, p_flags) do { \ - if (ON_CACHE_INVALIDATION) { \ - (void)upcall_cache_invalidate (frame, this, client, inode, p_flags); \ - } \ + \ + if (!is_cache_invalidation_enabled(this)) \ + break; \ + \ + (void)upcall_cache_invalidate (frame, this, client, \ + inode, p_flags); \ } while (0) -#define CACHE_INVALIDATE_DIR(frame, this, client, inode_p, p_flags) do { \ - if (ON_CACHE_INVALIDATION) { \ +#define CACHE_INVALIDATE_DIR(frame, this, client, inode_p, p_flags) do {\ + \ + if (!is_cache_invalidation_enabled(this)) \ + break; \ + \ dentry_t *dentry; \ dentry_t *dentry_tmp; \ list_for_each_entry_safe (dentry, dentry_tmp, \ @@ -73,7 +75,10 @@ (void)upcall_cache_invalidate (frame, this, client, \ dentry->inode, p_flags); \ } \ - } \ } while (0) +/* xlator options */ +gf_boolean_t is_cache_invalidation_enabled(xlator_t *this); +int32_t get_cache_invalidation_timeout(xlator_t *this); + #endif /* __UPCALL_CACHE_INVALIDATION_H__ */ -- cgit