diff options
Diffstat (limited to 'glusterfsd')
-rw-r--r-- | glusterfsd/src/glusterfsd.c | 26 | ||||
-rw-r--r-- | glusterfsd/src/glusterfsd.h | 1 |
2 files changed, 20 insertions, 7 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 14627f0af94..87cda657e2c 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -149,6 +149,8 @@ static struct argp_option gf_options[] = { {"disable-direct-io-mode", ARGP_DISABLE_DIRECT_IO_MODE_KEY, 0, 0, "Disable direct I/O mode in fuse kernel module" " [default if big writes are supported]"}, + {"enable-direct-io-mode", ARGP_ENABLE_DIRECT_IO_MODE_KEY, 0, 0, + "Force direct I/O mode in fuse kernel module"}, {"entry-timeout", ARGP_ENTRY_TIMEOUT_KEY, "SECONDS", 0, "Set entry timeout to SECONDS in fuse kernel module [default: 1]"}, {"attribute-timeout", ARGP_ATTRIBUTE_TIMEOUT_KEY, "SECONDS", 0, @@ -335,7 +337,7 @@ _add_fuse_mount (xlator_t *graph) /* On Darwin machines, O_APPEND is not handled, * which may corrupt the data */ - if (cmd_args->fuse_direct_io_mode_flag == _gf_true) { + if (cmd_args->fuse_direct_io_mode_flag == 1) { gf_log ("glusterfs", GF_LOG_DEBUG, "'direct-io-mode' in fuse causes data corruption " "if O_APPEND is used. disabling 'direct-io-mode'"); @@ -347,12 +349,18 @@ _add_fuse_mount (xlator_t *graph) cmd_args->non_local); #else /* ! DARWIN HOST OS */ - if (cmd_args->fuse_direct_io_mode_flag == _gf_true) { + switch (cmd_args->fuse_direct_io_mode_flag) { + case 0: /* disable */ + ret = dict_set_static_ptr (top->options, ZR_DIRECT_IO_OPT, + "disable"); + break; + case 1: /* enable */ ret = dict_set_static_ptr (top->options, ZR_DIRECT_IO_OPT, "enable"); - } else { - ret = dict_set_static_ptr (top->options, ZR_DIRECT_IO_OPT, - "disable"); + break; + case 2: /* default */ + default: + break; } #endif /* GF_DARWIN_HOST_OS */ @@ -880,7 +888,11 @@ parse_opts (int key, char *arg, struct argp_state *state) break; case ARGP_DISABLE_DIRECT_IO_MODE_KEY: - cmd_args->fuse_direct_io_mode_flag = _gf_false; + cmd_args->fuse_direct_io_mode_flag = 0; + break; + + case ARGP_ENABLE_DIRECT_IO_MODE_KEY: + cmd_args->fuse_direct_io_mode_flag = 1; break; case ARGP_ENTRY_TIMEOUT_KEY: @@ -1143,7 +1155,7 @@ main (int argc, char *argv[]) /* parsing command line arguments */ cmd_args->log_level = DEFAULT_LOG_LEVEL; - cmd_args->fuse_direct_io_mode_flag = _gf_true; + cmd_args->fuse_direct_io_mode_flag = 2; cmd_args->fuse_attribute_timeout = -1; INIT_LIST_HEAD (&cmd_args->xlator_options); diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index 8198f6f5238..b3f933ca624 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -66,6 +66,7 @@ enum argp_option_keys { ARGP_ATTRIBUTE_TIMEOUT_KEY = 136, ARGP_VOLUME_NAME_KEY = 137, ARGP_XLATOR_OPTION_KEY = 138, + ARGP_ENABLE_DIRECT_IO_MODE_KEY = 139, #ifdef GF_DARWIN_HOST_OS ARGP_NON_LOCAL_KEY = 139, #endif /* DARWIN */ |