00001
00002
00003
00004
00005
00006
00007
00008
00009 #include "ad_panfs.h"
00010 #include <pan_fs_client_cw_mode.h>
00011
00012 void ADIOI_PANFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
00013 {
00014 static char myname[] = "ADIOI_PANFS_SETINFO";
00015 char* value;
00016 int flag, tmp_val = -1;
00017 unsigned long int concurrent_write = 0;
00018 pan_fs_client_layout_agg_type_t layout_type = PAN_FS_CLIENT_LAYOUT_TYPE__DEFAULT;
00019 unsigned long int layout_stripe_unit = 0;
00020 unsigned long int layout_parity_stripe_width = 0;
00021 unsigned long int layout_parity_stripe_depth = 0;
00022 unsigned long int layout_total_num_comps = 0;
00023 pan_fs_client_layout_visit_t layout_visit_policy = PAN_FS_CLIENT_LAYOUT_VISIT__ROUND_ROBIN;
00024 int gen_error_code;
00025
00026 *error_code = MPI_SUCCESS;
00027
00028 if (fd->info == MPI_INFO_NULL) {
00029
00030
00031
00032 MPI_Info_create(&(fd->info));
00033
00034
00035
00036 if (users_info != MPI_INFO_NULL) {
00037 value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
00038
00039 ADIOI_Info_get(users_info, "panfs_concurrent_write", MPI_MAX_INFO_VAL,
00040 value, &flag);
00041 if (flag) {
00042 concurrent_write = strtoul(value,NULL,10);
00043 tmp_val = concurrent_write;
00044 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00045 if (tmp_val != concurrent_write) {
00046 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_concurrent_write\" must be the same on all processes\n");
00047 MPI_Abort(MPI_COMM_WORLD, 1);
00048 }
00049 ADIOI_Info_set(fd->info, "panfs_concurrent_write", value);
00050 }
00051
00052 ADIOI_Info_get(users_info, "panfs_layout_type", MPI_MAX_INFO_VAL,
00053 value, &flag);
00054 if (flag) {
00055 layout_type = strtoul(value,NULL,10);
00056 tmp_val = layout_type;
00057 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00058 if (tmp_val != layout_type) {
00059 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_type\" must be the same on all processes\n");
00060 MPI_Abort(MPI_COMM_WORLD, 1);
00061 }
00062 ADIOI_Info_set(fd->info, "panfs_layout_type", value);
00063 }
00064
00065 ADIOI_Info_get(users_info, "panfs_layout_stripe_unit", MPI_MAX_INFO_VAL,
00066 value, &flag);
00067 if (flag) {
00068 layout_stripe_unit = strtoul(value,NULL,10);
00069 tmp_val = layout_stripe_unit;
00070 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00071 if (tmp_val != layout_stripe_unit) {
00072 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_stripe_unit\" must be the same on all processes\n");
00073 MPI_Abort(MPI_COMM_WORLD, 1);
00074 }
00075 ADIOI_Info_set(fd->info, "panfs_layout_stripe_unit", value);
00076 }
00077
00078 ADIOI_Info_get(users_info, "panfs_layout_parity_stripe_width", MPI_MAX_INFO_VAL,
00079 value, &flag);
00080 if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
00081 layout_parity_stripe_width = strtoul(value,NULL,10);
00082 tmp_val = layout_parity_stripe_width;
00083 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00084 if (tmp_val != layout_parity_stripe_width) {
00085 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_width\" must be the same on all processes\n");
00086 MPI_Abort(MPI_COMM_WORLD, 1);
00087 }
00088 ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_width", value);
00089 }
00090
00091 ADIOI_Info_get(users_info, "panfs_layout_parity_stripe_depth", MPI_MAX_INFO_VAL,
00092 value, &flag);
00093 if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE)) {
00094 layout_parity_stripe_depth = strtoul(value,NULL,10);
00095 tmp_val = layout_parity_stripe_depth;
00096 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00097 if (tmp_val != layout_parity_stripe_depth) {
00098 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_parity_stripe_depth\" must be the same on all processes\n");
00099 MPI_Abort(MPI_COMM_WORLD, 1);
00100 }
00101 ADIOI_Info_set(fd->info, "panfs_layout_parity_stripe_depth", value);
00102 }
00103
00104 ADIOI_Info_get(users_info, "panfs_layout_total_num_comps", MPI_MAX_INFO_VAL,
00105 value, &flag);
00106 if (flag) {
00107 layout_total_num_comps = strtoul(value,NULL,10);
00108 tmp_val = layout_total_num_comps;
00109 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00110 if (tmp_val != layout_total_num_comps) {
00111 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_total_num_comps\" must be the same on all processes\n");
00112 MPI_Abort(MPI_COMM_WORLD, 1);
00113 }
00114 ADIOI_Info_set(fd->info, "panfs_layout_total_num_comps", value);
00115 }
00116
00117 ADIOI_Info_get(users_info, "panfs_layout_visit_policy", MPI_MAX_INFO_VAL,
00118 value, &flag);
00119 if (flag && (layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID1_5_PARITY_STRIPE || layout_type == PAN_FS_CLIENT_LAYOUT_TYPE__RAID10)) {
00120 layout_visit_policy = strtoul(value,NULL,10);
00121 tmp_val = layout_visit_policy;
00122 MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
00123 if (tmp_val != layout_visit_policy) {
00124 FPRINTF(stderr, "ADIOI_PANFS_SetInfo: the value for key \"panfs_layout_visit_policy\" must be the same on all processes\n");
00125 MPI_Abort(MPI_COMM_WORLD, 1);
00126 }
00127 ADIOI_Info_set(fd->info, "panfs_layout_visit_policy", value);
00128 }
00129
00130 ADIOI_Free(value);
00131
00132 }
00133 }
00134
00135 ADIOI_GEN_SetInfo(fd, users_info, &gen_error_code);
00136
00137
00138
00139 if(*error_code == MPI_SUCCESS)
00140 {
00141 *error_code = gen_error_code;
00142 }
00143 }