00001
00002
00003
00004
00005
00006
00007
00008 #include "ad_xfs.h"
00009 #include "adio_extern.h"
00010
00011 static unsigned xfs_direct_read_chunk_size;
00012 static unsigned xfs_direct_write_chunk_size;
00013
00014 void ADIOI_XFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
00015 {
00016 char *value, * c;
00017 int flag;
00018 static char xfs_initialized = 0;
00019
00020 if (fd->info == MPI_INFO_NULL) MPI_Info_create(&(fd->info));
00021
00022 ADIOI_Info_set(fd->info, "direct_read", "false");
00023 ADIOI_Info_set(fd->info, "direct_write", "false");
00024 fd->direct_read = fd->direct_write = 0;
00025
00026 if (!xfs_initialized) {
00027 xfs_initialized = 1;
00028 c = getenv("MPIO_DIRECT_READ_CHUNK_SIZE");
00029 if (c) {
00030 int io;
00031 io = atoi(c);
00032 if (io <= 0) {
00033 fprintf(stderr,
00034 "MPI: Ignoring an invalid setting for MPIO_DIRECT_READ_CHUNK_SIZE.\n"
00035 " It must be set to a positive integer value.\n");
00036 } else {
00037 xfs_direct_read_chunk_size = io;
00038 }
00039 } else {
00040 xfs_direct_read_chunk_size = 0;
00041 }
00042
00043 c = getenv("MPIO_DIRECT_WRITE_CHUNK_SIZE");
00044 if (c) {
00045 int io;
00046 io = atoi(c);
00047 if (io <= 0) {
00048 fprintf(stderr,
00049 "MPI: Ignoring an invalid setting for MPIO_DIRECT_WRITE_CHUNK_SIZE.\n"
00050 " It must be set to a positive integer value.\n");
00051 } else {
00052 xfs_direct_write_chunk_size = io;
00053 }
00054 } else {
00055 xfs_direct_write_chunk_size = 0;
00056 }
00057 }
00058
00059 if (!fd->hints->initialized) {
00060 fd->hints->fs_hints.xfs.read_chunk_sz =
00061 xfs_direct_read_chunk_size;
00062 fd->hints->fs_hints.xfs.write_chunk_sz =
00063 xfs_direct_write_chunk_size;
00064 }
00065
00066
00067 if (users_info != MPI_INFO_NULL) {
00068 value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
00069
00070 ADIOI_Info_get(users_info, "direct_read", MPI_MAX_INFO_VAL,
00071 value, &flag);
00072 if (flag && !strcmp(value, "true")) {
00073 ADIOI_Info_set(fd->info, "direct_read", "true");
00074 fd->direct_read = 1;
00075 }
00076
00077 ADIOI_Info_get(users_info, "direct_write", MPI_MAX_INFO_VAL,
00078 value, &flag);
00079 if (flag && !strcmp(value, "true")) {
00080 ADIOI_Info_set(fd->info, "direct_write", "true");
00081 fd->direct_write = 1;
00082 }
00083
00084 ADIOI_Free(value);
00085 }
00086
00087
00088 ADIOI_GEN_SetInfo(fd, users_info, error_code);
00089
00090
00091 if (ADIOI_Direct_read) fd->direct_read = 1;
00092 if (ADIOI_Direct_write) fd->direct_write = 1;
00093
00094
00095
00096 *error_code = MPI_SUCCESS;
00097 }