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 --- glusterfsd/src/glusterfsd.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'glusterfsd/src/glusterfsd.c') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 2b6ee5452..5d5586625 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -178,6 +178,8 @@ static struct argp_option gf_options[] = { "\"on\" for fds not opened with O_RDONLY]"}, {"entry-timeout", ARGP_ENTRY_TIMEOUT_KEY, "SECONDS", 0, "Set entry timeout to SECONDS in fuse kernel module [default: 1]"}, + {"negative-timeout", ARGP_NEGATIVE_TIMEOUT_KEY, "SECONDS", 0, + "Set negative timeout to SECONDS in fuse kernel module [default: 0]"}, {"attribute-timeout", ARGP_ATTRIBUTE_TIMEOUT_KEY, "SECONDS", 0, "Set attribute timeout to SECONDS for inodes in fuse kernel module " "[default: 1]"}, @@ -302,6 +304,17 @@ create_fuse_mount (glusterfs_ctx_t *ctx) } } + if (cmd_args->fuse_negative_timeout >= 0) { + ret = dict_set_double (master->options, ZR_NEGATIVE_TIMEOUT_OPT, + cmd_args->fuse_negative_timeout); + if (ret < 0) { + gf_log ("glusterfsd", GF_LOG_ERROR, + "failed to set dict value for key %s", + ZR_NEGATIVE_TIMEOUT_OPT); + goto err; + } + } + if (cmd_args->client_pid_set) { ret = dict_set_int32 (master->options, "client-pid", cmd_args->client_pid); @@ -746,6 +759,18 @@ parse_opts (int key, char *arg, struct argp_state *state) argp_failure (state, -1, 0, "unknown entry timeout %s", arg); break; + case ARGP_NEGATIVE_TIMEOUT_KEY: + d = 0.0; + + gf_string2double (arg, &d); + if (!(d < 0.0)) { + cmd_args->fuse_negative_timeout = d; + break; + } + + argp_failure (state, -1, 0, "unknown negative timeout %s", arg); + break; + case ARGP_ATTRIBUTE_TIMEOUT_KEY: d = 0.0; -- cgit