diff -Naur orangefs-2.8.5-pre_layout/src/client/sysint/sys-create.sm orangefs-2.8.5/src/client/sysint/sys-create.sm --- orangefs-2.8.5-pre_layout/src/client/sysint/sys-create.sm 2012-01-26 18:59:23.000000000 +0400 +++ orangefs-2.8.5/src/client/sysint/sys-create.sm 2012-03-04 17:09:48.429854276 +0400 @@ -144,6 +144,8 @@ PVFS_error ret = -PVFS_EINVAL; PINT_smcb *smcb = NULL; PINT_client_sm *sm_p = NULL; + struct server_configuration_s *server_config = NULL; + enum PVFS_sys_layout_algorithm layout_algo = PVFS_SYS_LAYOUT_ROUND_ROBIN; gossip_debug(GOSSIP_CLIENT_DEBUG, "PVFS_isys_create entered\n"); @@ -242,7 +244,17 @@ } else { - sm_p->u.create.layout.algorithm = PVFS_SYS_LAYOUT_ROUND_ROBIN; + sm_p->object_ref = parent_ref; + /* get default filesystem layout */ + server_config = PINT_get_server_config_struct(sm_p->parent_ref.fs_id); + if (server_config) + { + layout_algo = server_config->default_layout_algo; + /* Release the server config mutex */ + PINT_put_server_config_struct(server_config); + } + + sm_p->u.create.layout.algorithm = layout_algo; } sm_p->object_ref = parent_ref; diff -Naur orangefs-2.8.5-pre_layout/src/common/misc/server-config.c orangefs-2.8.5/src/common/misc/server-config.c --- orangefs-2.8.5-pre_layout/src/common/misc/server-config.c 2012-01-26 18:59:23.000000000 +0400 +++ orangefs-2.8.5/src/common/misc/server-config.c 2012-03-04 19:06:42.738217796 +0400 @@ -125,6 +125,7 @@ static DOTCONF_CB(directio_thread_num); static DOTCONF_CB(directio_ops_per_queue); static DOTCONF_CB(directio_timeout); +static DOTCONF_CB(get_default_layout_algo); static FUNC_ERRORHANDLER(errorhandler); const char *contextchecker(command_t *cmd, unsigned long mask); @@ -1018,6 +1019,25 @@ {"DirectIOTimeout", ARG_INT, directio_timeout, NULL, CTX_STORAGEHINTS, "1000"}, + /* Specifies the default data layout for a filesystem. + * Supported values are: + * + * none - PVFS_SYS_LAYOUT_NONE: + * servers are selected in the order listed in the configuration + * starting with the first one; + * + * random - PVFS_SYS_LAYOUT_RANDOM: + * servers are selected in random order but no server is used twice; + * + * round-robin - PVFS_SYS_LAYOUT_ROUND_ROBIN (default): + * servers are selected in the order listed in the configuration + * starting with a random one; + * + * PVFS_SYS_LAYOUT_LIST is currently not supported as a default value; + * */ + {"LayoutAlgo", ARG_STR, get_default_layout_algo, NULL, + CTX_DEFAULTS, "round-robin"}, + LAST_OPTION }; @@ -3012,6 +3032,33 @@ return NULL; } +DOTCONF_CB(get_default_layout_algo) +{ + struct server_configuration_s *config_s = + (struct server_configuration_s *)cmd->context; + + enum PVFS_sys_layout_algorithm *algo = &config_s->default_layout_algo; + + if(!strcmp(cmd->data.str, "round-robin")) + { + *algo = PVFS_SYS_LAYOUT_ROUND_ROBIN; + } + else if(!strcmp(cmd->data.str, "random")) + { + *algo = PVFS_SYS_LAYOUT_RANDOM; + } + else if(!strcmp(cmd->data.str, "none")) + { + *algo = PVFS_SYS_LAYOUT_NONE; + } + else + { + return "Error unknown LayoutAlgo option, valid values are:\n" + "none, random, round-robin\n"; + } + return NULL; +} + /* * Function: PINT_config_release * diff -Naur orangefs-2.8.5-pre_layout/src/common/misc/server-config.h orangefs-2.8.5/src/common/misc/server-config.h --- orangefs-2.8.5-pre_layout/src/common/misc/server-config.h 2012-01-26 18:59:23.000000000 +0400 +++ orangefs-2.8.5/src/common/misc/server-config.h 2012-03-04 16:19:41.918832526 +0400 @@ -201,6 +201,9 @@ * be configurable. */ int trove_method; + + enum PVFS_sys_layout_algorithm default_layout_algo; /* Default data layout algorithm: + none, random, round-robin (default) */ void *private_data; } server_configuration_s;