Skip to content

Commit

Permalink
"Initial energy savings configurations were added"
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://137.99.13.219/srv/svn/ofsproject/ofsproject/2.8.4-stock/osd_branch@57 dfcdf660-53a5-499b-8775-f9b82cf2d3b9
  • Loading branch information
cek10006 committed Mar 17, 2012
1 parent 0cf3186 commit 9f19ad3
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 1 deletion.
78 changes: 77 additions & 1 deletion src/common/misc/server-config.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ static DOTCONF_CB(get_osd_type);
static DOTCONF_CB(get_osd_dir_type);
static DOTCONF_CB(get_create_type);
static DOTCONF_CB(get_member_attr_type);
static DOTCONF_CB(get_eco_type);
static DOTCONF_CB(get_eco_num);
static DOTCONF_CB(get_small_file_size);
static DOTCONF_CB(directio_thread_num);
static DOTCONF_CB(directio_ops_per_queue);
Expand Down Expand Up @@ -1020,6 +1022,16 @@ static const configoption_t options[] =
* Specifies if getting member attributes is enabled or not
*/
{ "MemberAttr", ARG_STR, get_member_attr_type, NULL, CTX_DEFAULTS, "no" },

/*
* Specifies if energy saving mode is enabled or not
*/
{ "EnergySaving", ARG_STR, get_eco_type, NULL, CTX_DEFAULTS, "no" },

/*
* Specifies how many nodes are going to be used in energy saving mode
*/
{ "NumECOnodes", ARG_INT, get_eco_num, NULL, CTX_DEFAULTS, 0 },

/* Specifies the size of the small file transition point */
{"SmallFileSize", ARG_INT, get_small_file_size, NULL, CTX_FILESYSTEM, NULL},
Expand Down Expand Up @@ -3004,10 +3016,34 @@ static DOTCONF_CB(get_member_attr_type)
else if (!strcmp(str, "yes"))
config->member_attr = GET_MEMBER_ATTR;
else
ret = "get_member_attr_type: unknown FileSystem PostCreate option\n";
ret = "get_member_attr_type: unknown FileSystem MemberAttr option\n";
return ret;
}

static DOTCONF_CB(get_eco_type)
{
const char *str = cmd->data.str;
struct server_configuration_s *config = cmd->context;
const char *ret = NULL;

if (!strcmp(str, "no"))
config->energysaving = NO_ENERGY_SAVING;
else if (!strcmp(str, "yes"))
config->energysaving = ENERGY_SAVING;
else
ret = "get_eco_type: unknown FileSystem EnergySaving option\n";
return ret;
}

static DOTCONF_CB(get_eco_num)
{
struct server_configuration_s *config = cmd->context;

config->econumnodes = cmd->data.value;

return NULL;
}

static DOTCONF_CB(get_osd_type)
{
const char *str = cmd->data.str;
Expand Down Expand Up @@ -4242,6 +4278,46 @@ static char *get_handle_range_str(
return ret;
}

char *assign_io_servers(
struct server_configuration_s *config_s,
struct filesystem_configuration_s *fs)
{
char *ret = (char *)0;
PINT_llist *cur = NULL;
struct host_handle_mapping_s *cur_h_mapping = NULL;
int num_io_servers = 0;
gossip_err("%d\n", config_s->econumnodes);

if (config_s && config_s->host_id && fs)
{
cur = fs->data_handle_ranges;
while(cur)
{
cur_h_mapping = PINT_llist_head(cur);
if (!cur_h_mapping)
{
break;
}
assert(cur_h_mapping->alias_mapping);
assert(cur_h_mapping->alias_mapping->host_alias);
assert(cur_h_mapping->handle_range);

num_io_servers++;

cur = PINT_llist_next(cur);
}
}

if (config_s->econumnodes > num_io_servers)
{
gossip_err("Turning off energy saving mode\n");
config_s->econumnodes = 0;
config_s->energysaving = 0;
}

return ret;
}

/*
returns 1 if the specified configuration object is valid
(i.e. contains values that make sense); 0 otherwise
Expand Down
11 changes: 11 additions & 0 deletions src/common/misc/server-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ typedef struct server_configuration_s
NO_MEMBER_ATTR, /* fetch attributes of a single object at once */
GET_MEMBER_ATTR, /* fetch attributes of all the objects that are members of a collection */
} member_attr;

enum {
NO_ENERGY_SAVING, /* fetch attributes of a single object at once */
ENERGY_SAVING, /* fetch attributes of all the objects that are members of a collection */
} energysaving;

int econumnodes;

void *private_data;
} server_configuration_s;
Expand Down Expand Up @@ -276,6 +283,10 @@ char *PINT_config_get_data_handle_range_str(
char *PINT_config_get_merged_handle_range_str(
struct server_configuration_s *config_s,
struct filesystem_configuration_s *fs);

char *assign_io_servers(
struct server_configuration_s *config_s,
struct filesystem_configuration_s *fs);

int PINT_config_is_valid_configuration(
struct server_configuration_s *config_s);
Expand Down
5 changes: 5 additions & 0 deletions src/server/pvfs2-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -905,6 +905,11 @@ static int server_initialize_subsystems(
PINT_config_get_merged_handle_range_str(
&server_config, cur_fs);

if(server_config.energysaving)
{
assign_io_servers(&server_config, cur_fs);
}

/*
* error out if we're not configured to house either a meta or
* data handle range at all.
Expand Down

0 comments on commit 9f19ad3

Please sign in to comment.