static int glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; struct rlimit lim = {0, }; call_pool_t *pool = NULL; xlator_mem_acct_init (THIS, cli_mt_end); ctx->process_uuid = generate_uuid (); if (!ctx->process_uuid) return -1; ctx->page_size = 128 * GF_UNIT_KB; ctx->iobuf_pool = iobuf_pool_new (8 * GF_UNIT_MB, ctx->page_size); if (!ctx->iobuf_pool) return -1; ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE); if (!ctx->event_pool) return -1; pool = GF_CALLOC (1, sizeof (call_pool_t), cli_mt_call_pool_t); if (!pool) return -1; /* frame_mem_pool size 112 * 16k */ pool->frame_mem_pool = mem_pool_new (call_frame_t, 16384); if (!pool->frame_mem_pool) return -1; /* stack_mem_pool size 256 * 8k */ pool->stack_mem_pool = mem_pool_new (call_stack_t, 8192); if (!pool->stack_mem_pool) return -1; ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024); if (!ctx->stub_mem_pool) return -1; INIT_LIST_HEAD (&pool->all_frames); LOCK_INIT (&pool->lock); ctx->pool = pool; pthread_mutex_init (&(ctx->lock), NULL); cmd_args = &ctx->cmd_args; INIT_LIST_HEAD (&cmd_args->xlator_options); lim.rlim_cur = RLIM_INFINITY; lim.rlim_max = RLIM_INFINITY; setrlimit (RLIMIT_CORE, &lim); return 0; }
static int glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; struct rlimit lim = {0, }; call_pool_t *pool = NULL; int ret = -1; ret = xlator_mem_acct_init (THIS, cli_mt_end); if (ret != 0) { return ret; } ctx->process_uuid = generate_glusterfs_ctx_id (); if (!ctx->process_uuid) return -1; ctx->page_size = 128 * GF_UNIT_KB; ctx->iobuf_pool = iobuf_pool_new (); if (!ctx->iobuf_pool) return -1; ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE, STARTING_EVENT_THREADS); if (!ctx->event_pool) return -1; pool = GF_CALLOC (1, sizeof (call_pool_t), cli_mt_call_pool_t); if (!pool) return -1; /* frame_mem_pool size 112 * 64 */ pool->frame_mem_pool = mem_pool_new (call_frame_t, 32); if (!pool->frame_mem_pool) return -1; /* stack_mem_pool size 256 * 128 */ pool->stack_mem_pool = mem_pool_new (call_stack_t, 16); if (!pool->stack_mem_pool) return -1; ctx->stub_mem_pool = mem_pool_new (call_stub_t, 16); if (!ctx->stub_mem_pool) return -1; ctx->dict_pool = mem_pool_new (dict_t, 32); if (!ctx->dict_pool) return -1; ctx->dict_pair_pool = mem_pool_new (data_pair_t, 512); if (!ctx->dict_pair_pool) return -1; ctx->dict_data_pool = mem_pool_new (data_t, 512); if (!ctx->dict_data_pool) return -1; ctx->logbuf_pool = mem_pool_new (log_buf_t, 256); if (!ctx->logbuf_pool) return -1; INIT_LIST_HEAD (&pool->all_frames); LOCK_INIT (&pool->lock); ctx->pool = pool; pthread_mutex_init (&(ctx->lock), NULL); cmd_args = &ctx->cmd_args; INIT_LIST_HEAD (&cmd_args->xlator_options); lim.rlim_cur = RLIM_INFINITY; lim.rlim_max = RLIM_INFINITY; setrlimit (RLIMIT_CORE, &lim); return 0; }
static int glusterfs_ctx_defaults_init (glusterfs_ctx_t *ctx) { cmd_args_t *cmd_args = NULL; struct rlimit lim = {0, }; call_pool_t *pool = NULL; xlator_mem_acct_init (THIS, gfd_mt_end); ctx->process_uuid = generate_uuid (); if (!ctx->process_uuid) return -1; ctx->page_size = 128 * GF_UNIT_KB; ctx->iobuf_pool = iobuf_pool_new (8 * GF_UNIT_MB, ctx->page_size); if (!ctx->iobuf_pool) return -1; ctx->event_pool = event_pool_new (DEFAULT_EVENT_POOL_SIZE); if (!ctx->event_pool) return -1; pool = GF_CALLOC (1, sizeof (call_pool_t), gfd_mt_call_pool_t); if (!pool) return -1; /* frame_mem_pool size 112 * 16k */ pool->frame_mem_pool = mem_pool_new (call_frame_t, 16384); if (!pool->frame_mem_pool) return -1; /* stack_mem_pool size 256 * 8k */ pool->stack_mem_pool = mem_pool_new (call_stack_t, 8192); if (!pool->stack_mem_pool) return -1; ctx->stub_mem_pool = mem_pool_new (call_stub_t, 1024); if (!ctx->stub_mem_pool) return -1; INIT_LIST_HEAD (&pool->all_frames); LOCK_INIT (&pool->lock); ctx->pool = pool; pthread_mutex_init (&(ctx->lock), NULL); cmd_args = &ctx->cmd_args; /* parsing command line arguments */ cmd_args->log_level = DEFAULT_LOG_LEVEL; #ifdef GF_DARWIN_HOST_OS cmd_args->mac_compat = GF_OPTION_DEFERRED; /* On Darwin machines, O_APPEND is not handled, * which may corrupt the data */ cmd_args->fuse_direct_io_mode = GF_OPTION_DISABLE; #else cmd_args->mac_compat = GF_OPTION_DISABLE; cmd_args->fuse_direct_io_mode = GF_OPTION_DEFERRED; #endif cmd_args->fuse_attribute_timeout = -1; cmd_args->fuse_entry_timeout = -1; INIT_LIST_HEAD (&cmd_args->xlator_options); lim.rlim_cur = RLIM_INFINITY; lim.rlim_max = RLIM_INFINITY; setrlimit (RLIMIT_CORE, &lim); return 0; }