diff options
author | Soumya Koduri <skoduri@redhat.com> | 2015-03-24 10:30:31 +0530 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2015-03-31 11:16:26 -0700 |
commit | 25f97b2788a33efcb0714ad639f8db380b864982 (patch) | |
tree | 9720bdd09e04239dcd75bdb88ddc97623ec6fb44 | |
parent | e6f5ace08ad0a068cb49d3ca1274a27aa031992b (diff) |
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 <skoduri@redhat.com>
Reviewed-on: http://review.gluster.org/9975
Reviewed-by: Meghana M <mmadhusu@redhat.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | api/src/glfs-handleops.c | 23 | ||||
-rw-r--r-- | api/src/glfs-handles.h | 11 | ||||
-rw-r--r-- | tests/basic/gfapi/upcall-cache-invalidate.c | 4 | ||||
-rwxr-xr-x | tests/basic/gfapi/upcall-cache-invalidate.sh | 3 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall-cache-invalidation.h | 27 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall-internal.c | 68 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall.c | 88 | ||||
-rw-r--r-- | xlators/features/upcall/src/upcall.h | 31 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-set.c | 10 |
9 files changed, 192 insertions, 73 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index e60bb8e1317..d42e0354268 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -1618,15 +1618,14 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_rename, 3.4.2); * This API is used to poll for upcall events stored in the * upcall list. Current users of this API is NFS-Ganesha. * Incase of any event received, it will be mapped appropriately - * into 'callback_arg' along with the handle to be passed to - * NFS-Ganesha. + * into 'callback_arg' along with the handle object to be passed + * to NFS-Ganesha. * - * Application is responsible for allocating and passing the - * references of all the pointers except for "glhandle". - * After processing the event, it needs to free "glhandle" + * On success, applications need to check for 'object' to decide + * if any upcall event is received. * - * TODO: there should be a glfs api to destroy these handles, - * maybe "glfs_destroy_object" to free the object. + * After processing the event, they need to free "object" + * using glfs_h_close(..). * * Also similar to I/Os, the application should ideally stop polling * before calling glfs_fini(..). Hence making an assumption that @@ -1635,7 +1634,7 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_rename, 3.4.2); int pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) { - struct glfs_object *handle = NULL; + struct glfs_object *object = NULL; uuid_t gfid; upcall_entry *u_list = NULL; upcall_entry *tmp = NULL; @@ -1660,7 +1659,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) goto err; } - up_arg->handle = NULL; + up_arg->object = NULL; /* Ideally applications should stop polling before calling * 'glfs_fini'. Yet cross check if cleanup has started @@ -1692,11 +1691,11 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) pthread_mutex_unlock (&fs->upcall_list_mutex); if (found) { - handle = glfs_h_create_from_handle (fs, gfid, + object = glfs_h_create_from_handle (fs, gfid, GFAPI_HANDLE_LENGTH, &up_arg->buf); - if (!handle) { + if (!object) { errno = ENOMEM; goto out; } @@ -1718,7 +1717,7 @@ pub_glfs_h_poll_upcall (struct glfs *fs, struct callback_arg *up_arg) break; } - up_arg->handle = handle; + up_arg->object = object; up_arg->reason = reason; up_arg->flags = u_list->flags; up_arg->expire_time_attr = u_list->expire_time_attr; diff --git a/api/src/glfs-handles.h b/api/src/glfs-handles.h index a939aa0df54..5ab0799423d 100644 --- a/api/src/glfs-handles.h +++ b/api/src/glfs-handles.h @@ -102,17 +102,16 @@ typedef struct glfs_object glfs_object_t; * Applications (currently NFS-Ganesha) can make use of this * structure to read upcall notifications sent by server. * - * They are responsible for allocating and passing the references - * of all the pointers except for "handle". + * On success, applications need to check for 'object' to decide + * if any upcall event is received. * - * After processing the event, they need to free "handle" - * TODO: there should be a glfs api to destroy these handles, - * maybe "glfs_destroy_object" to free the object. + * After processing the event, they need to free "object" + * using glfs_h_close(..). */ struct callback_arg { struct glfs *fs; /* glfs object */ int reason; /* Upcall event type */ - struct glfs_object *handle; /* Handle which need to be acted upon */ + struct glfs_object *object; /* Object which need to be acted upon */ int flags; /* Cache UPDATE/INVALIDATE flags */ struct stat buf; /* Latest stat of this entry */ unsigned int expire_time_attr; /* the amount of time for which diff --git a/tests/basic/gfapi/upcall-cache-invalidate.c b/tests/basic/gfapi/upcall-cache-invalidate.c index e91d05d4058..64811f3274a 100644 --- a/tests/basic/gfapi/upcall-cache-invalidate.c +++ b/tests/basic/gfapi/upcall-cache-invalidate.c @@ -42,7 +42,7 @@ main (int argc, char *argv[]) char *logfile = NULL; char *volname = NULL; - cbk.handle = NULL; + cbk.object = NULL; if (argc != 3) { fprintf (stderr, "Invalid argument\n"); @@ -147,7 +147,7 @@ main (int argc, char *argv[]) if (cnt > 2) { ret = glfs_h_poll_upcall(fs_tmp, &cbk); LOG_ERR ("glfs_h_poll_upcall", ret); - if (cbk.handle) { + if (cbk.object) { fprintf (stderr, " upcall event type - %d," " flags - %d, expire_time_attr - %d\n" , cbk.reason, cbk.flags, cbk.expire_time_attr); diff --git a/tests/basic/gfapi/upcall-cache-invalidate.sh b/tests/basic/gfapi/upcall-cache-invalidate.sh index 20aeb1ec27a..f6f59bea752 100755 --- a/tests/basic/gfapi/upcall-cache-invalidate.sh +++ b/tests/basic/gfapi/upcall-cache-invalidate.sh @@ -22,6 +22,9 @@ EXPECT 'Started' volinfo_field $V0 'Status'; logdir=`gluster --print-logdir` +## Enable Upcall cache-invalidation feature +TEST $CLI volume set $V0 features.cache-invalidation on; + build_tester $(dirname $0)/upcall-cache-invalidate.c -lgfapi -o $(dirname $0)/upcall-cache-invalidate TEST ./$(dirname $0)/upcall-cache-invalidate $V0 $logdir/upcall-cache-invalidate.log 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__ */ diff --git a/xlators/features/upcall/src/upcall-internal.c b/xlators/features/upcall/src/upcall-internal.c index 26473e2a7bd..ef7743c9083 100644 --- a/xlators/features/upcall/src/upcall-internal.c +++ b/xlators/features/upcall/src/upcall-internal.c @@ -34,6 +34,62 @@ #include "defaults.h" /* + * Check if any of the upcall options are enabled: + * - cache_invalidation + * - XXX: lease_lk + */ +gf_boolean_t +is_upcall_enabled(xlator_t *this) { + upcall_private_t *priv = NULL; + gf_boolean_t is_enabled = _gf_false; + + if (this->private) { + priv = (upcall_private_t *)this->private; + + if (priv->cache_invalidation_enabled) { + is_enabled = _gf_true; + } + } + + return is_enabled; +} + +/* + * Check if any of cache_invalidation is enabled + */ +gf_boolean_t +is_cache_invalidation_enabled(xlator_t *this) { + upcall_private_t *priv = NULL; + gf_boolean_t is_enabled = _gf_false; + + if (this->private) { + priv = (upcall_private_t *)this->private; + + if (priv->cache_invalidation_enabled) { + is_enabled = _gf_true; + } + } + + return is_enabled; +} + +/* + * Get the cache_invalidation_timeout + */ +int32_t +get_cache_invalidation_timeout(xlator_t *this) { + upcall_private_t *priv = NULL; + int32_t timeout = 0; + + if (this->private) { + priv = (upcall_private_t *)this->private; + timeout = priv->cache_invalidation_timeout; + } + + return timeout; +} + +/* * Allocate and add a new client entry to the given upcall entry */ upcall_client_t* @@ -73,7 +129,8 @@ __add_upcall_client (call_frame_t *frame, uuid_t gfid, INIT_LIST_HEAD (&up_client_entry->client_list); up_client_entry->client_uid = gf_strdup(client->client_uid); up_client_entry->access_time = time(NULL); - up_client_entry->expire_time_attr = CACHE_INVALIDATION_PERIOD; + up_client_entry->expire_time_attr = + get_cache_invalidation_timeout(frame->this); list_add_tail (&up_client_entry->client_list, &up_inode_ctx->client_list); @@ -349,7 +406,7 @@ upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, client_t *client, /* * If the upcall_client_t has recently accessed the file (i.e, within - * CACHE_INVALIDATION_PERIOD), send a upcall notification. + * priv->cache_invalidation_timeout), send a upcall notification. */ void upcall_client_cache_invalidate (xlator_t *this, uuid_t gfid, @@ -357,9 +414,12 @@ upcall_client_cache_invalidate (xlator_t *this, uuid_t gfid, uint32_t flags) { notify_event_data_t n_event_data; + time_t timeout = 0; time_t t_expired = time(NULL) - up_client_entry->access_time; - if (t_expired < CACHE_INVALIDATION_PERIOD) { + timeout = get_cache_invalidation_timeout(this); + + if (t_expired < timeout) { /* Send notify call */ uuid_copy(n_event_data.gfid, gfid); n_event_data.client_entry = up_client_entry; @@ -374,7 +434,7 @@ upcall_client_cache_invalidate (xlator_t *this, uuid_t gfid, up_client_entry->client_uid); } else { - if (t_expired > (2*CACHE_INVALIDATION_PERIOD)) { + if (t_expired > (2*timeout)) { /* Cleanup the entry */ __upcall_cleanup_client_entry (up_client_entry); } diff --git a/xlators/features/upcall/src/upcall.c b/xlators/features/upcall/src/upcall.c index b7f2e975bba..45114b5f29f 100644 --- a/xlators/features/upcall/src/upcall.c +++ b/xlators/features/upcall/src/upcall.c @@ -42,7 +42,7 @@ up_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -67,7 +67,7 @@ up_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, fd->inode); if (!local) { @@ -123,7 +123,7 @@ up_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, fd->inode); if (!local) { @@ -157,7 +157,7 @@ up_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -183,7 +183,7 @@ up_readv (call_frame_t *frame, xlator_t *this, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, fd->inode); if (!local) { @@ -215,7 +215,7 @@ up_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -239,7 +239,7 @@ up_lk (call_frame_t *frame, xlator_t *this, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, fd->inode); if (!local) { @@ -269,7 +269,7 @@ up_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -294,7 +294,7 @@ up_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); if (!local) { @@ -325,7 +325,7 @@ up_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -355,7 +355,7 @@ up_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); if (!local) { @@ -389,7 +389,7 @@ up_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -423,7 +423,7 @@ up_rename (call_frame_t *frame, xlator_t *this, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, oldloc->inode); if (!local) { @@ -455,7 +455,7 @@ up_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -484,7 +484,7 @@ up_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); if (!local) { @@ -515,7 +515,7 @@ up_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -541,7 +541,7 @@ up_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, oldloc->inode); if (!local) { @@ -573,7 +573,7 @@ up_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -602,7 +602,7 @@ up_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); if (!local) { @@ -634,7 +634,7 @@ up_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -663,7 +663,7 @@ up_mkdir (call_frame_t *frame, xlator_t *this, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); if (!local) { @@ -696,7 +696,7 @@ up_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, uint32_t flags = 0; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); client = frame->root->client; local = frame->local; @@ -725,7 +725,7 @@ up_create (call_frame_t *frame, xlator_t *this, int32_t op_errno = -1; upcall_local_t *local = NULL; - EXIT_IF_UPCALL_OFF (out); + EXIT_IF_UPCALL_OFF (this, out); local = upcall_local_init (frame, this, loc->inode); @@ -800,10 +800,29 @@ out: } int +reconfigure (xlator_t *this, dict_t *options) +{ + upcall_private_t *priv = NULL; + int ret = -1; + + priv = this->private; + GF_ASSERT (priv); + + GF_OPTION_RECONF ("cache-invalidation", priv->cache_invalidation_enabled, + options, bool, out); + GF_OPTION_RECONF ("cache-invalidation-timeout", priv->cache_invalidation_timeout, + options, int32, out); + + ret = 0; +out: + return ret; +} + +int init (xlator_t *this) { int ret = -1; - upcalls_private_t *priv = NULL; + upcall_private_t *priv = NULL; priv = GF_CALLOC (1, sizeof (*priv), gf_upcall_mt_private_t); @@ -814,6 +833,11 @@ init (xlator_t *this) goto out; } + GF_OPTION_INIT ("cache-invalidation", priv->cache_invalidation_enabled, + bool, out); + GF_OPTION_INIT ("cache-invalidation-timeout", + priv->cache_invalidation_timeout, int32, out); + this->private = priv; this->local_pool = mem_pool_new (upcall_local_t, 512); ret = 0; @@ -829,13 +853,14 @@ out: int fini (xlator_t *this) { - upcalls_private_t *priv = NULL; + upcall_private_t *priv = NULL; priv = this->private; if (!priv) { return 0; } this->private = NULL; + GF_FREE (priv); return 0; @@ -952,5 +977,18 @@ struct xlator_cbks cbks = { }; struct volume_options options[] = { + { .key = {"cache-invalidation"}, + .type = GF_OPTION_TYPE_BOOL, + .default_value = "off", + .description = "When \"on\", sends cache-invalidation" + " notifications." + }, + { .key = {"cache-invalidation-timeout"}, + .type = GF_OPTION_TYPE_INT, + .default_value = CACHE_INVALIDATION_TIMEOUT, + .description = "After 'timeout' seconds since the time" + " client accessed any file, cache-invalidation" + " notifications are no longer sent to that client." + }, { .key = {NULL} }, }; diff --git a/xlators/features/upcall/src/upcall.h b/xlators/features/upcall/src/upcall.h index a5aff9d091e..7cbec22bbf2 100644 --- a/xlators/features/upcall/src/upcall.h +++ b/xlators/features/upcall/src/upcall.h @@ -26,9 +26,9 @@ #include "upcall-messages.h" #include "upcall-cache-invalidation.h" -#define EXIT_IF_UPCALL_OFF(label) do { \ - if (!(ON_CACHE_INVALIDATION)) \ - goto label; \ +#define EXIT_IF_UPCALL_OFF(this, label) do { \ + if (!is_upcall_enabled(this)) \ + goto label; \ } while (0) #define UPCALL_STACK_UNWIND(fop, frame, params ...) do { \ @@ -38,10 +38,10 @@ __xl = frame->this; \ __local = frame->local; \ frame->local = NULL; \ - } \ - STACK_UNWIND_STRICT (fop, frame, params); \ - upcall_local_wipe (__xl, __local); \ - } while (0) + } \ + STACK_UNWIND_STRICT (fop, frame, params); \ + upcall_local_wipe (__xl, __local); \ +} while (0) #define UPCALL_STACK_DESTROY(frame) do { \ upcall_local_t *__local = NULL; \ @@ -51,12 +51,13 @@ frame->local = NULL; \ STACK_DESTROY (frame->root); \ upcall_local_wipe (__xl, __local); \ - } while (0) +} while (0) -struct _upcalls_private_t { - int client_id; /* Not sure if reqd */ +struct _upcall_private_t { + gf_boolean_t cache_invalidation_enabled; + int32_t cache_invalidation_timeout; }; -typedef struct _upcalls_private_t upcalls_private_t; +typedef struct _upcall_private_t upcall_private_t; enum _upcall_event_type_t { EVENT_NULL, @@ -122,13 +123,17 @@ 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); upcall_inode_ctx_t *upcall_inode_ctx_get (inode_t *inode, xlator_t *this); 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); +/* Xlator options */ +gf_boolean_t is_upcall_enabled(xlator_t *this); + +/* Cache invalidation specific */ void upcall_cache_invalidate (call_frame_t *frame, xlator_t *this, client_t *client, inode_t *inode, uint32_t flags); void upcall_client_cache_invalidate (xlator_t *xl, uuid_t gfid, upcall_client_t *up_client_entry, uint32_t flags); -void upcall_cache_forget (xlator_t *this, inode_t *inode, - upcall_inode_ctx_t *up_inode_ctx); #endif /* __UPCALL_H__ */ diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c index bad7e63d309..78d44f933a3 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c @@ -1780,6 +1780,16 @@ struct volopt_map_entry glusterd_volopt_map[] = { .op_version = GD_OP_VERSION_3_7_0, .type = NO_DOC, }, + /* Upcall translator options */ + { .key = "features.cache-invalidation", + .voltype = "features/upcall", + .value = "off", + .op_version = GD_OP_VERSION_3_7_0, + }, + { .key = "features.cache-invalidation-timeout", + .voltype = "features/upcall", + .op_version = GD_OP_VERSION_3_7_0, + }, { .key = NULL } }; |