diff options
Diffstat (limited to 'glusterfsd')
| -rw-r--r-- | glusterfsd/src/glusterfsd.c | 36 | 
1 files changed, 33 insertions, 3 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 908345d266d..c6eb58d5156 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -163,7 +163,7 @@ static struct argp_option gf_options[] = {           "Brick name to be registered with Gluster portmapper" },          {"brick-port", ARGP_BRICK_PORT_KEY, "BRICK-PORT", OPTION_HIDDEN,           "Brick Port to be registered with Gluster portmapper" }, -	{"fopen-keep-cache", ARGP_FOPEN_KEEP_CACHE_KEY, 0, 0, +	{"fopen-keep-cache", ARGP_FOPEN_KEEP_CACHE_KEY, "BOOL", OPTION_ARG_OPTIONAL,  	 "Do not purge the cache on file open"},          {0, 0, 0, 0, "Fuse options:"}, @@ -379,7 +379,8 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)                  }          } -	if (cmd_args->fopen_keep_cache) { +	switch (cmd_args->fopen_keep_cache) { +	case GF_OPTION_ENABLE:  		ret = dict_set_static_ptr(options, "fopen-keep-cache",  			"on");  		if (ret < 0) { @@ -388,6 +389,23 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)  				"fopen-keep-cache");  			goto err;  		} +		break; +	case GF_OPTION_DISABLE: +		ret = dict_set_static_ptr(options, "fopen-keep-cache", +			"off"); +		if (ret < 0) { +			gf_log("glusterfsd", GF_LOG_ERROR, +				"failed to set dict value for key " +				"fopen-keep-cache"); +			goto err; +		} +		break; +        case GF_OPTION_DEFERRED: /* default */ +        default: +                gf_log ("glusterfsd", GF_LOG_DEBUG, +			"fopen-keep-cache mode %d", +                        cmd_args->fopen_keep_cache); +                break;  	}  	if (cmd_args->gid_timeout) { @@ -990,7 +1008,18 @@ parse_opts (int key, char *arg, struct argp_state *state)                  break;  	case ARGP_FOPEN_KEEP_CACHE_KEY: -		cmd_args->fopen_keep_cache = 1; +                if (!arg) +                        arg = "on"; + +                if (gf_string2boolean (arg, &b) == 0) { +                        cmd_args->fopen_keep_cache = b; + +                        break; +                } + +                argp_failure (state, -1, 0, +                              "unknown cache setting \"%s\"", arg); +  		break;  	case ARGP_GID_TIMEOUT_KEY: @@ -1330,6 +1359,7 @@ glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx)  #endif          cmd_args->fuse_attribute_timeout = -1;          cmd_args->fuse_entry_timeout = -1; +	cmd_args->fopen_keep_cache = GF_OPTION_DEFERRED;          INIT_LIST_HEAD (&cmd_args->xlator_options);          INIT_LIST_HEAD (&cmd_args->volfile_servers);  | 
