From 7018d7178e366146881d693e0159e13307e888ee Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 18 Jul 2012 15:50:35 -0700 Subject: fuse-bridge: expose negative entry caching of FUSE Fuse kernel module supports caching negative entries, enabled by specifying a timeout while returning ENOENT to lookup. This patch enables the functionality to be enabled with the command line. Also fixed a typo bug in mount.glusterfs.in. Change-Id: I47eab2834cca9a05887266358afbf504bbb4c489 BUG: 841417 Signed-off-by: Anand Avati Reviewed-on: http://review.gluster.com/3696 Tested-by: Gluster Build System Reviewed-by: Brian Foster --- xlators/mount/fuse/src/fuse-bridge.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'xlators/mount/fuse/src/fuse-bridge.c') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index b96d60173..d4ca1d1f6 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -359,7 +359,15 @@ fuse_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this, "%"PRIu64": %s() %s => -1 (%s)", frame->root->unique, gf_fop_list[frame->root->op], state->loc.path, strerror (op_errno)); - send_fuse_err (this, state->finh, op_errno); + if (op_errno == ENOENT) { + feo.entry_valid = + calc_timeout_sec (priv->negative_timeout); + feo.entry_valid_nsec = + calc_timeout_nsec (priv->negative_timeout); + send_fuse_obj (this, finh, &feo); + } else { + send_fuse_err (this, state->finh, op_errno); + } } free_fuse_state (state); @@ -4547,6 +4555,11 @@ init (xlator_t *this_xl) if (ret != 0) priv->entry_timeout = 1.0; /* default */ + ret = dict_get_double (options, "negative-timeout", + &priv->negative_timeout); + if (ret != 0) + priv->negative_timeout = 0.0; /* default */ + ret = dict_get_int32 (options, "client-pid", &priv->client_pid); if (ret == 0) @@ -4777,6 +4790,9 @@ struct volume_options options[] = { { .key = {ZR_ENTRY_TIMEOUT_OPT}, .type = GF_OPTION_TYPE_DOUBLE }, + { .key = {ZR_NEGATIVE_TIMEOUT_OPT}, + .type = GF_OPTION_TYPE_DOUBLE + }, { .key = {ZR_STRICT_VOLFILE_CHECK}, .type = GF_OPTION_TYPE_BOOL }, -- cgit