1 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.c
2 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.c 1969-12-31 19:00:00.000000000 -0500
3 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.c 2005-12-06 11:54:37.883130927 -0500
5 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
7 + * $Id: ad_lustre.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
9 + * Copyright (C) 2001 University of Chicago.
10 + * See COPYRIGHT notice in top-level directory.
13 +#include "ad_lustre.h"
15 +/* adioi.h has the ADIOI_Fns_struct define */
18 +struct ADIOI_Fns_struct ADIO_LUSTRE_operations = {
19 + ADIOI_LUSTRE_Open, /* Open */
20 + ADIOI_LUSTRE_ReadContig, /* ReadContig */
21 + ADIOI_LUSTRE_WriteContig, /* WriteContig */
22 + ADIOI_GEN_ReadStridedColl, /* ReadStridedColl */
23 + ADIOI_GEN_WriteStridedColl, /* WriteStridedColl */
24 + ADIOI_GEN_SeekIndividual, /* SeekIndividual */
25 + ADIOI_LUSTRE_Fcntl, /* Fcntl */
26 + ADIOI_LUSTRE_SetInfo, /* SetInfo */
27 + ADIOI_GEN_ReadStrided, /* ReadStrided */
28 + ADIOI_GEN_WriteStrided, /* WriteStrided */
29 + ADIOI_LUSTRE_Close, /* Close */
30 + ADIOI_LUSTRE_IreadContig, /* IreadContig */
31 + ADIOI_LUSTRE_IwriteContig, /* IwriteContig */
32 + ADIOI_LUSTRE_ReadDone, /* ReadDone */
33 + ADIOI_LUSTRE_WriteDone, /* WriteDone */
34 + ADIOI_LUSTRE_ReadComplete, /* ReadComplete */
35 + ADIOI_LUSTRE_WriteComplete, /* WriteComplete */
36 + ADIOI_LUSTRE_IreadStrided, /* IreadStrided */
37 + ADIOI_LUSTRE_IwriteStrided, /* IwriteStrided */
38 + ADIOI_GEN_Flush, /* Flush */
39 + ADIOI_LUSTRE_Resize, /* Resize */
40 + ADIOI_GEN_Delete, /* Delete */
42 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_close.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_close.c
43 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_close.c 1969-12-31 19:00:00.000000000 -0500
44 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_close.c 2005-12-06 11:54:37.895129327 -0500
46 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
48 + * $Id: ad_lustre_close.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
50 + * Copyright (C) 1997 University of Chicago.
51 + * See COPYRIGHT notice in top-level directory.
54 +#include "ad_lustre.h"
56 +void ADIOI_LUSTRE_Close(ADIO_File fd, int *error_code)
59 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
60 + static char myname[] = "ADIOI_LUSTRE_CLOSE";
63 + err = close(fd->fd_sys);
66 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
67 + "**io %s", strerror(errno));
68 +#elif defined(PRINT_ERR_MSG)
69 + *error_code = MPI_ERR_UNKNOWN;
71 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
72 + myname, "I/O Error", "%s", strerror(errno));
73 + ADIOI_Error(fd, *error_code, myname);
76 + else *error_code = MPI_SUCCESS;
78 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_done.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_done.c
79 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_done.c 1969-12-31 19:00:00.000000000 -0500
80 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_done.c 2005-12-06 11:54:37.898128927 -0500
82 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
84 + * $Id: ad_lustre_done.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
86 + * Copyright (C) 1997 University of Chicago.
87 + * See COPYRIGHT notice in top-level directory.
90 +#include "ad_lustre.h"
92 +int ADIOI_LUSTRE_ReadDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
96 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
97 + static char myname[] = "ADIOI_LUSTRE_READDONE";
100 + aio_result_t *result=0, *tmp;
104 +#ifdef AIO_HANDLE_IN_AIOCB
105 + struct aiocb *tmp1;
109 + if (*request == ADIO_REQUEST_NULL) {
110 + *error_code = MPI_SUCCESS;
115 +/* HP, FreeBSD, Linux */
116 +#ifdef HAVE_STATUS_SET_BYTES
117 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
119 + (*request)->fd->async_count--;
120 + ADIOI_Free_request((ADIOI_Req_node *) (*request));
121 + *request = ADIO_REQUEST_NULL;
122 + *error_code = MPI_SUCCESS;
127 + if ((*request)->queued) {
128 + tmp = (aio_result_t *) (*request)->handle;
129 + if (tmp->aio_return == AIO_INPROGRESS) {
131 + *error_code = MPI_SUCCESS;
133 + else if (tmp->aio_return != -1) {
134 + result = (aio_result_t *) aiowait(0); /* dequeue any one request */
136 + (*request)->nbytes = tmp->aio_return;
137 + *error_code = MPI_SUCCESS;
141 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
142 + "**io %s", strerror(tmp->aio_errno));
144 +#elif defined(PRINT_ERR_MSG)
145 + *error_code = MPI_ERR_UNKNOWN;
147 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
148 + myname, "I/O Error", "%s", strerror(tmp->aio_errno));
149 + ADIOI_Error((*request)->fd, *error_code, myname);
152 + } /* if ((*request)->queued) ... */
154 + /* ADIOI_Complete_Async completed this request, but request object
157 + *error_code = MPI_SUCCESS;
159 +#ifdef HAVE_STATUS_SET_BYTES
160 + if (done && ((*request)->nbytes != -1))
161 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
166 +#ifdef AIO_HANDLE_IN_AIOCB
168 + if ((*request)->queued) {
169 + tmp1 = (struct aiocb *) (*request)->handle;
170 + errno = aio_error(tmp1->aio_handle);
171 + if (errno == EINPROG) {
173 + *error_code = MPI_SUCCESS;
176 + err = aio_return(tmp1->aio_handle);
177 + (*request)->nbytes = err;
178 + errno = aio_error(tmp1->aio_handle);
184 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
185 + "**io %s", strerror(errno));
187 +#elif defined(PRINT_ERR_MSG)
188 + *error_code = MPI_ERR_UNKNOWN;
190 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
191 + myname, "I/O Error", "%s", strerror(errno));
192 + ADIOI_Error((*request)->fd, *error_code, myname);
195 + else *error_code = MPI_SUCCESS;
197 + } /* if ((*request)->queued) */
200 + *error_code = MPI_SUCCESS;
202 +#ifdef HAVE_STATUS_SET_BYTES
203 + if (done && ((*request)->nbytes != -1))
204 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
207 +#elif (!defined(NO_AIO) && !defined(AIO_SUN))
208 +/* DEC, SGI IRIX 5 and 6 */
209 + if ((*request)->queued) {
210 + errno = aio_error((const struct aiocb *) (*request)->handle);
211 + if (errno == EINPROGRESS) {
213 + *error_code = MPI_SUCCESS;
216 + err = aio_return((struct aiocb *) (*request)->handle);
217 + (*request)->nbytes = err;
218 + errno = aio_error((struct aiocb *) (*request)->handle);
224 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
225 + "**io %s", strerror(errno));
227 +#elif defined(PRINT_ERR_MSG)
228 + *error_code = MPI_ERR_UNKNOWN;
230 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
231 + myname, "I/O Error", "%s", strerror(errno));
232 + ADIOI_Error((*request)->fd, *error_code, myname);
235 + else *error_code = MPI_SUCCESS;
237 + } /* if ((*request)->queued) */
240 + *error_code = MPI_SUCCESS;
242 +#ifdef HAVE_STATUS_SET_BYTES
243 + if (done && ((*request)->nbytes != -1))
244 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
251 + /* if request is still queued in the system, it is also there
252 + on ADIOI_Async_list. Delete it from there. */
253 + if ((*request)->queued) ADIOI_Del_req_from_list(request);
255 + (*request)->fd->async_count--;
256 + if ((*request)->handle) ADIOI_Free((*request)->handle);
257 + ADIOI_Free_request((ADIOI_Req_node *) (*request));
258 + *request = ADIO_REQUEST_NULL;
266 +int ADIOI_LUSTRE_WriteDone(ADIO_Request *request, ADIO_Status *status, int *error_code)
268 + return ADIOI_LUSTRE_ReadDone(request, status, error_code);
270 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_fcntl.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_fcntl.c
271 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_fcntl.c 1969-12-31 19:00:00.000000000 -0500
272 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_fcntl.c 2005-12-06 11:54:37.901128527 -0500
274 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
276 + * $Id: ad_lustre_fcntl.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
278 + * Copyright (C) 1997 University of Chicago.
279 + * See COPYRIGHT notice in top-level directory.
282 +#include "ad_lustre.h"
283 +#include "adio_extern.h"
285 +#include "mpisgi2.h"
288 +void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int *error_code)
291 + ADIO_Offset curr_fsize, alloc_size, size, len, done;
292 + ADIO_Status status;
294 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
295 + static char myname[] = "ADIOI_LUSTRE_FCNTL";
299 + case ADIO_FCNTL_GET_FSIZE:
300 + fcntl_struct->fsize = lseek(fd->fd_sys, 0, SEEK_END);
301 + if (fd->fp_sys_posn != -1)
302 + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
303 + if (fcntl_struct->fsize == -1) {
305 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
306 + "**io %s", strerror(errno));
307 +#elif defined(PRINT_ERR_MSG)
308 + *error_code = MPI_ERR_UNKNOWN;
310 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
311 + myname, "I/O Error", "%s", strerror(errno));
312 + ADIOI_Error(fd, *error_code, myname);
315 + else *error_code = MPI_SUCCESS;
318 + case ADIO_FCNTL_SET_DISKSPACE:
319 + /* will be called by one process only */
320 + /* On file systems with no preallocation function, I have to
322 + to allocate space. Since there could be holes in the file,
323 + I need to read up to the current file size, write it back,
324 + and then write beyond that depending on how much
325 + preallocation is needed.
326 + read/write in sizes of no more than ADIOI_PREALLOC_BUFSZ */
328 + curr_fsize = lseek(fd->fd_sys, 0, SEEK_END);
329 + alloc_size = fcntl_struct->diskspace;
331 + size = ADIOI_MIN(curr_fsize, alloc_size);
333 + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
334 + buf = (char *) ADIOI_Malloc(ADIOI_PREALLOC_BUFSZ);
337 + for (i=0; i<ntimes; i++) {
338 + len = ADIOI_MIN(size-done, ADIOI_PREALLOC_BUFSZ);
339 + ADIO_ReadContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET, done,
340 + &status, error_code);
341 + if (*error_code != MPI_SUCCESS) {
344 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
345 + "**io %s", strerror(errno));
346 +#elif defined(PRINT_ERR_MSG)
347 + FPRINTF(stderr, "ADIOI_LUSTRE_Fcntl: To preallocate disk space, ROMIO needs to read the file and write it back, but is unable to read the file. Please give the file read permission and open it with MPI_MODE_RDWR.\n");
348 + MPI_Abort(MPI_COMM_WORLD, 1);
350 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_PREALLOC_PERM,
351 + myname, (char *) 0, (char *) 0);
352 + ADIOI_Error(fd, *error_code, myname);
356 + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
357 + done, &status, error_code);
358 + if (*error_code != MPI_SUCCESS) return;
362 + if (alloc_size > curr_fsize) {
363 + memset(buf, 0, ADIOI_PREALLOC_BUFSZ);
364 + size = alloc_size - curr_fsize;
365 + ntimes = (size + ADIOI_PREALLOC_BUFSZ - 1)/ADIOI_PREALLOC_BUFSZ;
366 + for (i=0; i<ntimes; i++) {
367 + len = ADIOI_MIN(alloc_size-done, ADIOI_PREALLOC_BUFSZ);
368 + ADIO_WriteContig(fd, buf, len, MPI_BYTE, ADIO_EXPLICIT_OFFSET,
369 + done, &status, error_code);
370 + if (*error_code != MPI_SUCCESS) return;
375 + if (fd->fp_sys_posn != -1)
376 + lseek(fd->fd_sys, fd->fp_sys_posn, SEEK_SET);
377 + *error_code = MPI_SUCCESS;
380 + case ADIO_FCNTL_SET_IOMODE:
381 + /* for implementing PFS I/O modes. will not occur in MPI-IO
383 + if (fd->iomode != fcntl_struct->iomode) {
384 + fd->iomode = fcntl_struct->iomode;
385 + MPI_Barrier(MPI_COMM_WORLD);
387 + *error_code = MPI_SUCCESS;
390 + case ADIO_FCNTL_SET_ATOMICITY:
391 + fd->atomicity = (fcntl_struct->atomicity == 0) ? 0 : 1;
392 + *error_code = MPI_SUCCESS;
396 + FPRINTF(stderr, "Unknown flag passed to ADIOI_LUSTRE_Fcntl\n");
397 + MPI_Abort(MPI_COMM_WORLD, 1);
400 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c
401 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c 1969-12-31 19:00:00.000000000 -0500
402 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_flush.c 2005-12-06 11:54:37.903128261 -0500
404 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
406 + * $Id: ad_lustre_flush.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
408 + * Copyright (C) 1997 University of Chicago.
409 + * See COPYRIGHT notice in top-level directory.
412 +#include "ad_lustre.h"
414 +void ADIOI_LUSTRE_Flush(ADIO_File fd, int *error_code)
416 + ADIOI_GEN_Flush(fd, error_code);
418 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h
419 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h 1969-12-31 19:00:00.000000000 -0500
420 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre.h 2005-12-06 11:54:37.891129861 -0500
422 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
424 + * $Id: ad_lustre.h,v 1.2 2005/07/07 14:38:17 liam Exp $
426 + * Copyright (C) 1997 University of Chicago.
427 + * See COPYRIGHT notice in top-level directory.
430 +#ifndef AD_UNIX_INCLUDE
431 +#define AD_UNIX_INCLUDE
434 +#define HAVE_ASM_TYPES_H 1
437 +#include <linux/types.h>
439 +#include <sys/ioctl.h>
440 +#include "lustre/lustre_user.h"
445 +#include <sys/asynch.h>
448 +#ifdef NEEDS_ADIOCB_T
449 +typedef struct adiocb adiocb_t;
454 +int ADIOI_LUSTRE_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
455 + int wr, void *handle);
458 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c
459 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c 1969-12-31 19:00:00.000000000 -0500
460 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_hints.c 2005-12-06 11:54:37.904128127 -0500
462 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
464 + * $Id: ad_lustre_hints.c,v 1.2 2005/07/07 14:38:17 liam Exp $
466 + * Copyright (C) 1997 University of Chicago.
467 + * See COPYRIGHT notice in top-level directory.
470 +#include "ad_lustre.h"
472 +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code)
474 + char *value, *value_in_fd;
475 + int flag, tmp_val, str_factor=-1, str_unit=0, start_iodev=-1;
476 + struct lov_user_md lum = { 0 };
477 + int err, myrank, fd_sys, perm, amode, old_mask;
479 + if ( (fd->info) == MPI_INFO_NULL) {
480 + /* This must be part of the open call. can set striping parameters
482 + MPI_Info_create(&(fd->info));
484 + /* has user specified striping or server buffering parameters
485 + and do they have the same value on all processes? */
486 + if (users_info != MPI_INFO_NULL) {
487 + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
489 + MPI_Info_get(users_info, "striping_factor", MPI_MAX_INFO_VAL,
492 + str_factor=atoi(value);
493 + tmp_val = str_factor;
494 + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
495 + if (tmp_val != str_factor) {
496 + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"striping_factor\" must be the same on all processes\n");
497 + MPI_Abort(MPI_COMM_WORLD, 1);
501 + MPI_Info_get(users_info, "striping_unit", MPI_MAX_INFO_VAL,
504 + str_unit=atoi(value);
505 + tmp_val = str_unit;
506 + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
507 + if (tmp_val != str_unit) {
508 + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"striping_unit\" must be the same on all processes\n");
509 + MPI_Abort(MPI_COMM_WORLD, 1);
513 + MPI_Info_get(users_info, "start_iodevice", MPI_MAX_INFO_VAL,
516 + start_iodev=atoi(value);
517 + tmp_val = start_iodev;
518 + MPI_Bcast(&tmp_val, 1, MPI_INT, 0, fd->comm);
519 + if (tmp_val != start_iodev) {
520 + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: the value for key \"start_iodevice\" must be the same on all processes\n");
521 + MPI_Abort(MPI_COMM_WORLD, 1);
525 + /* if user has specified striping info, process 0 tries to set it */
526 + if ((str_factor > 0) || (str_unit > 0) || (start_iodev >= 0)) {
527 + MPI_Comm_rank(fd->comm, &myrank);
529 + if (fd->perm == ADIO_PERM_NULL) {
530 + old_mask = umask(022);
532 + perm = old_mask ^ 0666;
534 + else perm = fd->perm;
537 + if (fd->access_mode & ADIO_CREATE)
538 + amode = amode | O_CREAT;
539 + if (fd->access_mode & ADIO_RDWR ||
540 + (fd->access_mode & ADIO_RDONLY &&
541 + fd->access_mode & ADIO_WRONLY))
542 + amode = amode | O_RDWR;
543 + else if (fd->access_mode & ADIO_WRONLY)
544 + amode = amode | O_WRONLY;
545 + else if (fd->access_mode & ADIO_RDONLY)
546 + amode = amode | O_RDONLY;
547 + if (fd->access_mode & ADIO_EXCL)
548 + amode = amode | O_EXCL;
550 + /* we need to create file so ensure this is set */
551 + amode = amode | O_LOV_DELAY_CREATE | O_CREAT;
553 + fd_sys = open(fd->filename, amode, perm);
554 + if (fd_sys == -1) {
555 + if (errno != EEXIST)
556 + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: Failure to open file %s %d %d\n",strerror(errno), amode, perm);
558 + lum.lmm_magic = LOV_USER_MAGIC;
559 + lum.lmm_pattern = 0;
560 + lum.lmm_stripe_size = str_unit;
561 + lum.lmm_stripe_count = str_factor;
562 + lum.lmm_stripe_offset = start_iodev;
564 + err = ioctl(fd_sys, LL_IOC_LOV_SETSTRIPE, &lum);
565 + if (err == -1 && errno != EEXIST) {
566 + FPRINTF(stderr, "ADIOI_LUSTRE_SetInfo: Failure to set stripe info %s \n",strerror(errno));
573 + MPI_Barrier(fd->comm);
579 + /* set the values for collective I/O and data sieving parameters */
580 + ADIOI_GEN_SetInfo(fd, users_info, error_code);
584 + /* The file has been opened previously and fd->fd_sys is a valid
585 + file descriptor. cannot set striping parameters now. */
587 + /* set the values for collective I/O and data sieving parameters */
588 + ADIOI_GEN_SetInfo(fd, users_info, error_code);
592 + *error_code = MPI_SUCCESS;
594 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c
595 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c 1969-12-31 19:00:00.000000000 -0500
596 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iread.c 2005-12-06 11:54:37.904128127 -0500
598 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
600 + * $Id: ad_lustre_iread.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
602 + * Copyright (C) 1997 University of Chicago.
603 + * See COPYRIGHT notice in top-level directory.
606 +#include "ad_lustre.h"
608 +void ADIOI_LUSTRE_IreadContig(ADIO_File fd, void *buf, int count,
609 + MPI_Datatype datatype, int file_ptr_type,
610 + ADIO_Offset offset, ADIO_Request *request, int *error_code)
614 + ADIO_Status status;
617 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
618 + static char myname[] = "ADIOI_LUSTRE_IREADCONTIG";
622 + (*request) = ADIOI_Malloc_request();
623 + (*request)->optype = ADIOI_READ;
624 + (*request)->fd = fd;
625 + (*request)->datatype = datatype;
627 + MPI_Type_size(datatype, &typesize);
628 + len = count * typesize;
631 + /* HP, FreeBSD, Linux */
632 + /* no support for nonblocking I/O. Use blocking I/O. */
634 + ADIOI_LUSTRE_ReadContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
635 + &status, error_code);
636 + (*request)->queued = 0;
637 +#ifdef HAVE_STATUS_SET_BYTES
638 + if (*error_code == MPI_SUCCESS) {
639 + MPI_Get_elements(&status, MPI_BYTE, &len);
640 + (*request)->nbytes = len;
645 + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
646 + err = ADIOI_LUSTRE_aio(fd, buf, len, offset, 0, &((*request)->handle));
647 + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
649 + (*request)->queued = 1;
650 + ADIOI_Add_req_to_list(request);
654 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
655 + "**io %s", strerror(errno));
657 +#elif defined(PRINT_ERR_MSG)
658 + *error_code = MPI_ERR_UNKNOWN;
660 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
661 + myname, "I/O Error", "%s", strerror(errno));
662 + ADIOI_Error(fd, *error_code, myname);
665 + else *error_code = MPI_SUCCESS;
668 + fd->fp_sys_posn = -1; /* set it to null. */
674 +void ADIOI_LUSTRE_IreadStrided(ADIO_File fd, void *buf, int count,
675 + MPI_Datatype datatype, int file_ptr_type,
676 + ADIO_Offset offset, ADIO_Request *request, int
679 + ADIO_Status status;
680 +#ifdef HAVE_STATUS_SET_BYTES
684 + *request = ADIOI_Malloc_request();
685 + (*request)->optype = ADIOI_READ;
686 + (*request)->fd = fd;
687 + (*request)->datatype = datatype;
688 + (*request)->queued = 0;
689 + (*request)->handle = 0;
691 +/* call the blocking version. It is faster because it does data sieving. */
692 + ADIOI_LUSTRE_ReadStrided(fd, buf, count, datatype, file_ptr_type,
693 + offset, &status, error_code);
697 +#ifdef HAVE_STATUS_SET_BYTES
698 + if (*error_code == MPI_SUCCESS) {
699 + MPI_Type_size(datatype, &typesize);
700 + (*request)->nbytes = count * typesize;
704 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c
705 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c 1969-12-31 19:00:00.000000000 -0500
706 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_iwrite.c 2005-12-06 11:54:37.906127861 -0500
708 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
710 + * $Id: ad_lustre_iwrite.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
712 + * Copyright (C) 1997 University of Chicago.
713 + * See COPYRIGHT notice in top-level directory.
716 +#include "ad_lustre.h"
718 +void ADIOI_LUSTRE_IwriteContig(ADIO_File fd, void *buf, int count,
719 + MPI_Datatype datatype, int file_ptr_type,
720 + ADIO_Offset offset, ADIO_Request *request, int *error_code)
724 + ADIO_Status status;
727 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
728 + static char myname[] = "ADIOI_LUSTRE_IWRITECONTIG";
732 + *request = ADIOI_Malloc_request();
733 + (*request)->optype = ADIOI_WRITE;
734 + (*request)->fd = fd;
735 + (*request)->datatype = datatype;
737 + MPI_Type_size(datatype, &typesize);
738 + len = count * typesize;
741 + /* HP, FreeBSD, Linux */
742 + /* no support for nonblocking I/O. Use blocking I/O. */
744 + ADIOI_LUSTRE_WriteContig(fd, buf, len, MPI_BYTE, file_ptr_type, offset,
745 + &status, error_code);
746 + (*request)->queued = 0;
747 +#ifdef HAVE_STATUS_SET_BYTES
748 + if (*error_code == MPI_SUCCESS) {
749 + MPI_Get_elements(&status, MPI_BYTE, &len);
750 + (*request)->nbytes = len;
755 + if (file_ptr_type == ADIO_INDIVIDUAL) offset = fd->fp_ind;
756 + err = ADIOI_LUSTRE_aio(fd, buf, len, offset, 1, &((*request)->handle));
757 + if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind += len;
759 + (*request)->queued = 1;
760 + ADIOI_Add_req_to_list(request);
764 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
765 + "**io %s", strerror(errno));
767 +#elif defined(PRINT_ERR_MSG)
768 + *error_code = MPI_ERR_UNKNOWN;
770 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
771 + myname, "I/O Error", "%s", strerror(errno));
772 + ADIOI_Error(fd, *error_code, myname);
775 + else *error_code = MPI_SUCCESS;
778 + fd->fp_sys_posn = -1; /* set it to null. */
785 +void ADIOI_LUSTRE_IwriteStrided(ADIO_File fd, void *buf, int count,
786 + MPI_Datatype datatype, int file_ptr_type,
787 + ADIO_Offset offset, ADIO_Request *request, int
790 + ADIO_Status status;
791 +#ifdef HAVE_STATUS_SET_BYTES
795 + *request = ADIOI_Malloc_request();
796 + (*request)->optype = ADIOI_WRITE;
797 + (*request)->fd = fd;
798 + (*request)->datatype = datatype;
799 + (*request)->queued = 0;
800 + (*request)->handle = 0;
802 +/* call the blocking version. It is faster because it does data sieving. */
803 + ADIOI_LUSTRE_WriteStrided(fd, buf, count, datatype, file_ptr_type,
804 + offset, &status, error_code);
808 +#ifdef HAVE_STATUS_SET_BYTES
809 + if (*error_code == MPI_SUCCESS) {
810 + MPI_Type_size(datatype, &typesize);
811 + (*request)->nbytes = count * typesize;
817 +/* This function is for implementation convenience. It is not user-visible.
818 + It takes care of the differences in the interface for nonblocking I/O
819 + on various Unix machines! If wr==1 write, wr==0 read. */
821 +int ADIOI_LUSTRE_aio(ADIO_File fd, void *buf, int len, ADIO_Offset offset,
822 + int wr, void *handle)
824 + int err=-1, fd_sys;
829 + aio_result_t *result;
831 + struct aiocb *aiocbp;
835 + fd_sys = fd->fd_sys;
838 + result = (aio_result_t *) ADIOI_Malloc(sizeof(aio_result_t));
839 + result->aio_return = AIO_INPROGRESS;
840 + if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
841 + else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
844 + if (errno == EAGAIN) {
845 + /* the man pages say EPROCLIM, but in reality errno is set to EAGAIN! */
847 + /* exceeded the max. no. of outstanding requests.
848 + complete all previous async. requests and try again.*/
850 + ADIOI_Complete_async(&error_code);
851 + if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
852 + else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
854 + while (err == -1) {
855 + if (errno == EAGAIN) {
856 + /* sleep and try again */
858 + if (wr) err = aiowrite(fd_sys, buf, len, offset, SEEK_SET, result);
859 + else err = aioread(fd_sys, buf, len, offset, SEEK_SET, result);
862 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
863 + MPI_Abort(MPI_COMM_WORLD, 1);
868 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
869 + MPI_Abort(MPI_COMM_WORLD, 1);
873 + *((aio_result_t **) handle) = result;
876 +#ifdef NO_FD_IN_AIOCB
878 + aiocbp = (struct aiocb *) ADIOI_Malloc(sizeof(struct aiocb));
879 + aiocbp->aio_whence = SEEK_SET;
880 + aiocbp->aio_offset = offset;
881 + aiocbp->aio_buf = buf;
882 + aiocbp->aio_nbytes = len;
883 + if (wr) err = aio_write(fd_sys, aiocbp);
884 + else err = aio_read(fd_sys, aiocbp);
887 + if (errno == EAGAIN) {
888 + /* exceeded the max. no. of outstanding requests.
889 + complete all previous async. requests and try again. */
891 + ADIOI_Complete_async(&error_code);
892 + if (wr) err = aio_write(fd_sys, aiocbp);
893 + else err = aio_read(fd_sys, aiocbp);
895 + while (err == -1) {
896 + if (errno == EAGAIN) {
897 + /* sleep and try again */
899 + if (wr) err = aio_write(fd_sys, aiocbp);
900 + else err = aio_read(fd_sys, aiocbp);
903 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
904 + MPI_Abort(MPI_COMM_WORLD, 1);
909 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
910 + MPI_Abort(MPI_COMM_WORLD, 1);
914 + *((struct aiocb **) handle) = aiocbp;
916 +#elif (!defined(NO_AIO) && !defined(AIO_SUN))
917 +/* DEC, SGI IRIX 5 and 6 */
919 + aiocbp = (struct aiocb *) ADIOI_Calloc(sizeof(struct aiocb), 1);
920 + aiocbp->aio_fildes = fd_sys;
921 + aiocbp->aio_offset = offset;
922 + aiocbp->aio_buf = buf;
923 + aiocbp->aio_nbytes = len;
925 +#ifdef AIO_PRIORITY_DEFAULT
927 + aiocbp->aio_reqprio = AIO_PRIO_DFL; /* not needed in DEC Unix 4.0 */
928 + aiocbp->aio_sigevent.sigev_signo = 0;
930 + aiocbp->aio_reqprio = 0;
933 +#ifdef AIO_SIGNOTIFY_NONE
935 + aiocbp->aio_sigevent.sigev_notify = SIGEV_NONE;
937 + aiocbp->aio_sigevent.sigev_signo = 0;
940 + if (wr) err = aio_write(aiocbp);
941 + else err = aio_read(aiocbp);
944 + if (errno == EAGAIN) {
945 + /* exceeded the max. no. of outstanding requests.
946 + complete all previous async. requests and try again. */
948 + ADIOI_Complete_async(&error_code);
949 + if (wr) err = aio_write(aiocbp);
950 + else err = aio_read(aiocbp);
952 + while (err == -1) {
953 + if (errno == EAGAIN) {
954 + /* sleep and try again */
956 + if (wr) err = aio_write(aiocbp);
957 + else err = aio_read(aiocbp);
960 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
961 + MPI_Abort(MPI_COMM_WORLD, 1);
966 + FPRINTF(stderr, "Unknown errno %d in ADIOI_LUSTRE_aio\n", errno);
967 + MPI_Abort(MPI_COMM_WORLD, 1);
971 + *((struct aiocb **) handle) = aiocbp;
976 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c
977 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c 1969-12-31 19:00:00.000000000 -0500
978 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_open.c 2005-12-06 11:54:37.906127861 -0500
980 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
982 + * $Id: ad_lustre_open.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
984 + * Copyright (C) 1997 University of Chicago.
985 + * See COPYRIGHT notice in top-level directory.
988 +#include "ad_lustre.h"
990 +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code)
992 + int perm, old_mask, amode;
993 + struct lov_user_md lum = { 0 };
996 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
997 + static char myname[] = "ADIOI_LUSTRE_OPEN";
1000 + if (fd->perm == ADIO_PERM_NULL) {
1001 + old_mask = umask(022);
1003 + perm = old_mask ^ 0666;
1005 + else perm = fd->perm;
1008 + if (fd->access_mode & ADIO_CREATE)
1009 + amode = amode | O_CREAT;
1010 + if (fd->access_mode & ADIO_RDONLY)
1011 + amode = amode | O_RDONLY;
1012 + if (fd->access_mode & ADIO_WRONLY)
1013 + amode = amode | O_WRONLY;
1014 + if (fd->access_mode & ADIO_RDWR)
1015 + amode = amode | O_RDWR;
1016 + if (fd->access_mode & ADIO_EXCL)
1017 + amode = amode | O_EXCL;
1019 + fd->fd_sys = open(fd->filename, amode, perm);
1021 + if (fd->fd_sys != -1) {
1024 + value = (char *) ADIOI_Malloc((MPI_MAX_INFO_VAL+1)*sizeof(char));
1026 + /* get file striping information and set it in info */
1027 + lum.lmm_magic = LOV_USER_MAGIC;
1028 + err = ioctl(fd->fd_sys, LL_IOC_LOV_GETSTRIPE, (void *) &lum);
1031 + sprintf(value, "%d", lum.lmm_stripe_size);
1032 + MPI_Info_set(fd->info, "striping_unit", value);
1034 + sprintf(value, "%d", lum.lmm_stripe_count);
1035 + MPI_Info_set(fd->info, "striping_factor", value);
1037 + sprintf(value, "%d", lum.lmm_stripe_offset);
1038 + MPI_Info_set(fd->info, "start_iodevice", value);
1040 + ADIOI_Free(value);
1042 + if (fd->access_mode & ADIO_APPEND)
1043 + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
1047 + if ((fd->fd_sys != -1) && (fd->access_mode & ADIO_APPEND))
1048 + fd->fp_ind = fd->fp_sys_posn = lseek(fd->fd_sys, 0, SEEK_END);
1050 + if (fd->fd_sys == -1) {
1052 + if (errno == ENAMETOOLONG)
1053 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_BAD_FILE, "**filenamelong", "**filenamelong %s %d", fd->filename, strlen(fd->filename) );
1054 + else if (errno == ENOENT)
1055 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_NO_SUCH_FILE, "**filenoexist", "**filenoexist %s", fd->filename );
1056 + else if (errno == ENOTDIR || errno == ELOOP)
1057 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_BAD_FILE, "**filenamedir", "**filenamedir %s", fd->filename );
1058 + else if (errno == EACCES) {
1059 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ACCESS, "**fileaccess", "**fileaccess %s",
1062 + else if (errno == EROFS) {
1063 + /* Read only file or file system and write access requested */
1064 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_READ_ONLY, "**ioneedrd", 0 );
1067 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1068 + "**io %s", strerror(errno));
1070 +#elif defined(PRINT_ERR_MSG)
1071 + *error_code = MPI_ERR_UNKNOWN;
1072 +#else /* MPICH-1 */
1073 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1074 + myname, "I/O Error", "%s", strerror(errno));
1075 + ADIOI_Error(ADIO_FILE_NULL, *error_code, myname);
1078 + else *error_code = MPI_SUCCESS;
1080 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c
1081 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c 1969-12-31 19:00:00.000000000 -0500
1082 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_rdcoll.c 2005-12-06 11:54:37.907127727 -0500
1084 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1086 + * $Id: ad_lustre_rdcoll.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1088 + * Copyright (C) 1997 University of Chicago.
1089 + * See COPYRIGHT notice in top-level directory.
1092 +#include "ad_lustre.h"
1094 +void ADIOI_LUSTRE_ReadStridedColl(ADIO_File fd, void *buf, int count,
1095 + MPI_Datatype datatype, int file_ptr_type,
1096 + ADIO_Offset offset, ADIO_Status *status, int
1099 + ADIOI_GEN_ReadStridedColl(fd, buf, count, datatype, file_ptr_type,
1100 + offset, status, error_code);
1102 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_read.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_read.c
1103 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_read.c 1969-12-31 19:00:00.000000000 -0500
1104 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_read.c 2005-12-06 11:54:37.907127727 -0500
1106 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1108 + * $Id: ad_lustre_read.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1110 + * Copyright (C) 1997 University of Chicago.
1111 + * See COPYRIGHT notice in top-level directory.
1114 +#include "ad_lustre.h"
1116 +void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count,
1117 + MPI_Datatype datatype, int file_ptr_type,
1118 + ADIO_Offset offset, ADIO_Status *status, int *error_code)
1120 + int err=-1, datatype_size, len;
1121 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
1122 + static char myname[] = "ADIOI_LUSTRE_READCONTIG";
1125 + MPI_Type_size(datatype, &datatype_size);
1126 + len = datatype_size * count;
1128 + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
1129 + if (fd->fp_sys_posn != offset)
1130 + lseek(fd->fd_sys, offset, SEEK_SET);
1131 + err = read(fd->fd_sys, buf, len);
1132 + fd->fp_sys_posn = offset + len;
1133 + /* individual file pointer not updated */
1135 + else { /* read from curr. location of ind. file pointer */
1136 + if (fd->fp_sys_posn != fd->fp_ind)
1137 + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
1138 + err = read(fd->fd_sys, buf, len);
1139 + fd->fp_ind += err;
1140 + fd->fp_sys_posn = fd->fp_ind;
1143 +#ifdef HAVE_STATUS_SET_BYTES
1144 + if (err != -1) MPIR_Status_set_bytes(status, datatype, err);
1149 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1150 + "**io %s", strerror(errno));
1151 +#elif defined(PRINT_ERR_MSG)
1152 + *error_code = MPI_ERR_UNKNOWN;
1153 +#else /* MPICH-1 */
1154 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1155 + myname, "I/O Error", "%s", strerror(errno));
1156 + ADIOI_Error(fd, *error_code, myname);
1159 + else *error_code = MPI_SUCCESS;
1165 +void ADIOI_LUSTRE_ReadStrided(ADIO_File fd, void *buf, int count,
1166 + MPI_Datatype datatype, int file_ptr_type,
1167 + ADIO_Offset offset, ADIO_Status *status, int
1170 + ADIOI_GEN_ReadStrided(fd, buf, count, datatype, file_ptr_type,
1171 + offset, status, error_code);
1173 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_resize.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_resize.c
1174 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_resize.c 1969-12-31 19:00:00.000000000 -0500
1175 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_resize.c 2005-12-06 11:54:37.909127460 -0500
1177 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1179 + * $Id: ad_lustre_resize.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1181 + * Copyright (C) 1997 University of Chicago.
1182 + * See COPYRIGHT notice in top-level directory.
1185 +#include "ad_lustre.h"
1187 +void ADIOI_LUSTRE_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
1190 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
1191 + static char myname[] = "ADIOI_LUSTRE_RESIZE";
1194 + err = ftruncate(fd->fd_sys, size);
1197 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1198 + "**io %s", strerror(errno));
1199 +#elif defined(PRINT_ERR_MSG)
1200 + *error_code = MPI_ERR_UNKNOWN;
1201 +#else /* MPICH-1 */
1202 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1203 + myname, "I/O Error", "%s", strerror(errno));
1204 + ADIOI_Error(fd, *error_code, myname);
1207 + else *error_code = MPI_SUCCESS;
1209 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_seek.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_seek.c
1210 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_seek.c 1969-12-31 19:00:00.000000000 -0500
1211 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_seek.c 2005-12-06 11:54:37.911127194 -0500
1213 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1215 + * $Id: ad_lustre_seek.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1217 + * Copyright (C) 1997 University of Chicago.
1218 + * See COPYRIGHT notice in top-level directory.
1221 +#include "ad_lustre.h"
1223 +ADIO_Offset ADIOI_LUSTRE_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
1224 + int whence, int *error_code)
1226 + return ADIOI_GEN_SeekIndividual(fd, offset, whence, error_code);
1228 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wait.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wait.c
1229 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wait.c 1969-12-31 19:00:00.000000000 -0500
1230 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wait.c 2005-12-06 11:54:37.914126794 -0500
1232 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1234 + * $Id: ad_lustre_wait.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1236 + * Copyright (C) 1997 University of Chicago.
1237 + * See COPYRIGHT notice in top-level directory.
1240 +#include "ad_lustre.h"
1242 +void ADIOI_LUSTRE_ReadComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
1245 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
1246 + static char myname[] = "ADIOI_LUSTRE_READCOMPLETE";
1249 + aio_result_t *result=0, *tmp;
1253 +#ifdef AIO_HANDLE_IN_AIOCB
1254 + struct aiocb *tmp1;
1258 + if (*request == ADIO_REQUEST_NULL) {
1259 + *error_code = MPI_SUCCESS;
1264 + if ((*request)->queued) { /* dequeue it */
1265 + tmp = (aio_result_t *) (*request)->handle;
1266 + while (tmp->aio_return == AIO_INPROGRESS) usleep(1000);
1267 + /* sleep for 1 ms., until done. Is 1 ms. a good number? */
1268 + /* when done, dequeue any one request */
1269 + result = (aio_result_t *) aiowait(0);
1271 + (*request)->nbytes = tmp->aio_return;
1273 + if (tmp->aio_return == -1) {
1275 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1276 + "**io %s", strerror(tmp->aio_errno));
1278 +#elif defined(PRINT_ERR_MSG)
1279 + *error_code = MPI_ERR_UNKNOWN;
1280 +#else /* MPICH-1 */
1281 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1282 + myname, "I/O Error", "%s", strerror(tmp->aio_errno));
1283 + ADIOI_Error((*request)->fd, *error_code, myname);
1286 + else *error_code = MPI_SUCCESS;
1288 +/* aiowait only dequeues a request. The completion of a request can be
1289 + checked by just checking the aio_return flag in the handle passed
1290 + to the original aioread()/aiowrite(). Therefore, I need to ensure
1291 + that aiowait() is called exactly once for each previous
1292 + aioread()/aiowrite(). This is also taken care of in ADIOI_xxxDone */
1294 + else *error_code = MPI_SUCCESS;
1296 +#ifdef HAVE_STATUS_SET_BYTES
1297 + if ((*request)->nbytes != -1)
1298 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
1303 +#ifdef AIO_HANDLE_IN_AIOCB
1305 + if ((*request)->queued) {
1307 + err = aio_suspend(1, (struct aiocb **) &((*request)->handle));
1308 + } while ((err == -1) && (errno == EINTR));
1310 + tmp1 = (struct aiocb *) (*request)->handle;
1312 + err = aio_return(tmp1->aio_handle);
1313 + (*request)->nbytes = err;
1314 + errno = aio_error(tmp1->aio_handle);
1316 + else (*request)->nbytes = -1;
1318 +/* on DEC, it is required to call aio_return to dequeue the request.
1319 + IBM man pages don't indicate what function to use for dequeue.
1320 + I'm assuming it is aio_return! POSIX says aio_return may be called
1321 + only once on a given handle. */
1325 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1326 + "**io %s", strerror(errno));
1328 +#elif defined(PRINT_ERR_MSG)
1329 + *error_code = MPI_ERR_UNKNOWN;
1330 +#else /* MPICH-1 */
1331 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1332 + myname, "I/O Error", "%s", strerror(errno));
1333 + ADIOI_Error((*request)->fd, *error_code, myname);
1336 + else *error_code = MPI_SUCCESS;
1337 + } /* if ((*request)->queued) */
1338 + else *error_code = MPI_SUCCESS;
1340 +#ifdef HAVE_STATUS_SET_BYTES
1341 + if ((*request)->nbytes != -1)
1342 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
1345 +#elif (!defined(NO_AIO) && !defined(AIO_SUN))
1346 +/* DEC, SGI IRIX 5 and 6 */
1347 + if ((*request)->queued) {
1349 + err = aio_suspend((const aiocb_t **) &((*request)->handle), 1, 0);
1350 + } while ((err == -1) && (errno == EINTR));
1353 + err = aio_return((struct aiocb *) (*request)->handle);
1354 + (*request)->nbytes = err;
1355 + errno = aio_error((struct aiocb *) (*request)->handle);
1357 + else (*request)->nbytes = -1;
1361 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1362 + "**io %s", strerror(errno));
1364 +#elif defined(PRINT_ERR_MSG)
1365 + *error_code = MPI_ERR_UNKNOWN;
1366 +#else /* MPICH-1 */
1367 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1368 + myname, "I/O Error", "%s", strerror(errno));
1369 + ADIOI_Error((*request)->fd, *error_code, myname);
1372 + else *error_code = MPI_SUCCESS;
1373 + } /* if ((*request)->queued) */
1374 + else *error_code = MPI_SUCCESS;
1375 +#ifdef HAVE_STATUS_SET_BYTES
1376 + if ((*request)->nbytes != -1)
1377 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
1382 + if ((*request)->queued != -1) {
1384 + /* queued = -1 is an internal hack used when the request must
1385 + be completed, but the request object should not be
1386 + freed. This is used in ADIOI_Complete_async, because the user
1387 + will call MPI_Wait later, which would require status to
1388 + be filled. Ugly but works. queued = -1 should be used only
1389 + in ADIOI_Complete_async.
1390 + This should not affect the user in any way. */
1392 + /* if request is still queued in the system, it is also there
1393 + on ADIOI_Async_list. Delete it from there. */
1394 + if ((*request)->queued) ADIOI_Del_req_from_list(request);
1396 + (*request)->fd->async_count--;
1397 + if ((*request)->handle) ADIOI_Free((*request)->handle);
1398 + ADIOI_Free_request((ADIOI_Req_node *) (*request));
1399 + *request = ADIO_REQUEST_NULL;
1403 +/* HP, FreeBSD, Linux */
1405 +#ifdef HAVE_STATUS_SET_BYTES
1406 + MPIR_Status_set_bytes(status, (*request)->datatype, (*request)->nbytes);
1408 + (*request)->fd->async_count--;
1409 + ADIOI_Free_request((ADIOI_Req_node *) (*request));
1410 + *request = ADIO_REQUEST_NULL;
1411 + *error_code = MPI_SUCCESS;
1416 +void ADIOI_LUSTRE_WriteComplete(ADIO_Request *request, ADIO_Status *status, int *error_code)
1418 + ADIOI_LUSTRE_ReadComplete(request, status, error_code);
1420 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wrcoll.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wrcoll.c
1421 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wrcoll.c 1969-12-31 19:00:00.000000000 -0500
1422 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_wrcoll.c 2005-12-06 11:54:37.914126794 -0500
1424 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1426 + * $Id: ad_lustre_wrcoll.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1428 + * Copyright (C) 1997 University of Chicago.
1429 + * See COPYRIGHT notice in top-level directory.
1432 +#include "ad_lustre.h"
1434 +void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, void *buf, int count,
1435 + MPI_Datatype datatype, int file_ptr_type,
1436 + ADIO_Offset offset, ADIO_Status *status, int
1439 + ADIOI_GEN_WriteStridedColl(fd, buf, count, datatype, file_ptr_type,
1440 + offset, status, error_code);
1442 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_write.c mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_write.c
1443 --- mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_write.c 1969-12-31 19:00:00.000000000 -0500
1444 +++ mpich-1.2.6/romio/adio/ad_lustre/ad_lustre_write.c 2005-12-06 11:54:37.914126794 -0500
1446 +/* -*- Mode: C; c-basic-offset:4 ; -*- */
1448 + * $Id: ad_lustre_write.c,v 1.1.1.1 2004/11/04 11:03:38 liam Exp $
1450 + * Copyright (C) 1997 University of Chicago.
1451 + * See COPYRIGHT notice in top-level directory.
1454 +#include "ad_lustre.h"
1456 +void ADIOI_LUSTRE_WriteContig(ADIO_File fd, void *buf, int count,
1457 + MPI_Datatype datatype, int file_ptr_type,
1458 + ADIO_Offset offset, ADIO_Status *status, int *error_code)
1460 + int err=-1, datatype_size, len;
1461 +#if defined(MPICH2) || !defined(PRINT_ERR_MSG)
1462 + static char myname[] = "ADIOI_LUSTRE_WRITECONTIG";
1465 + MPI_Type_size(datatype, &datatype_size);
1466 + len = datatype_size * count;
1468 + if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
1469 + if (fd->fp_sys_posn != offset)
1470 + lseek(fd->fd_sys, offset, SEEK_SET);
1471 + err = write(fd->fd_sys, buf, len);
1472 + fd->fp_sys_posn = offset + err;
1473 + /* individual file pointer not updated */
1475 + else { /* write from curr. location of ind. file pointer */
1476 + if (fd->fp_sys_posn != fd->fp_ind)
1477 + lseek(fd->fd_sys, fd->fp_ind, SEEK_SET);
1478 + err = write(fd->fd_sys, buf, len);
1479 + fd->fp_ind += err;
1480 + fd->fp_sys_posn = fd->fp_ind;
1483 +#ifdef HAVE_STATUS_SET_BYTES
1484 + if (err != -1 && status) MPIR_Status_set_bytes(status, datatype, err);
1489 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
1490 + "**io %s", strerror(errno));
1491 +#elif defined(PRINT_ERR_MSG)
1492 + *error_code = MPI_ERR_UNKNOWN;
1494 + *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
1495 + myname, "I/O Error", "%s", strerror(errno));
1496 + ADIOI_Error(fd, *error_code, myname);
1499 + else *error_code = MPI_SUCCESS;
1504 +void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, void *buf, int count,
1505 + MPI_Datatype datatype, int file_ptr_type,
1506 + ADIO_Offset offset, ADIO_Status *status, int
1509 + ADIOI_GEN_WriteStrided(fd, buf, count, datatype, file_ptr_type,
1510 + offset, status, error_code);
1512 diff -r -u --new-file mpich-1.2.6/romio/adio/ad_lustre/Makefile.in mpich-1.2.6/romio/adio/ad_lustre/Makefile.in
1513 --- mpich-1.2.6/romio/adio/ad_lustre/Makefile.in 1969-12-31 19:00:00.000000000 -0500
1514 +++ mpich-1.2.6/romio/adio/ad_lustre/Makefile.in 2005-12-06 11:54:37.883130927 -0500
1518 +LIBNAME = @LIBNAME@
1521 +SHLIBNAME = @SHLIBNAME@
1523 +INCLUDE_DIR = -I@MPI_INCLUDE_DIR@ -I${srcdir}/../include -I../include
1524 +CFLAGS = @CFLAGS@ $(INCLUDE_DIR)
1526 +C_COMPILE_SHL = $(CC_SHL) @CFLAGS@ $(INCLUDE_DIR)
1530 +AD_LUSTRE_OBJECTS = ad_lustre_close.o ad_lustre_read.o \
1531 + ad_lustre_open.o ad_lustre_write.o ad_lustre_done.o \
1532 + ad_lustre_fcntl.o ad_lustre_iread.o ad_lustre_iwrite.o ad_lustre_wait.o \
1533 + ad_lustre_resize.o ad_lustre_hints.o \
1537 +default: $(LIBNAME)
1538 + @if [ "@ENABLE_SHLIB@" != "none" ] ; then \
1539 + $(MAKE) $(SHLIBNAME).la ;\
1542 +.SUFFIXES: $(SUFFIXES) .p .lo
1545 + $(CC) $(CFLAGS) -c $<
1547 + $(C_COMPILE_SHL) -c $<
1550 +$(LIBNAME): $(AD_LUSTRE_OBJECTS)
1551 + $(AR) $(LIBNAME) $(AD_LUSTRE_OBJECTS)
1553 +AD_LUSTRE_LOOBJECTS=$(AD_LUSTRE_OBJECTS:.o=.lo)
1554 +$(SHLIBNAME).la: $(AD_LUSTRE_LOOBJECTS)
1555 + $(AR) $(SHLIBNAME).la $(AD_LUSTRE_LOOBJECTS)
1558 + -@for file in ${AD_LUSTRE_OBJECTS:.o=.c} ; do \
1559 + gcov -b -f $$file ; done
1563 --- mpich-1.2.6/romio/Makefile.in 2004-01-27 18:27:35.000000000 -0500
1564 +++ mpich-1.2.6/romio/Makefile.in 2005-12-06 11:54:38.000000000 -0500
1565 @@ -14,7 +14,7 @@ DIRS = mpi-io adio/common
1567 EXTRA_SRC_DIRS = @EXTRA_SRC_DIRS@
1568 FILE_SYS_DIRS = @FILE_SYS_DIRS@
1569 -ALL_DIRS = mpi-io mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran adio/common adio/ad_pfs adio/ad_piofs adio/ad_nfs adio/ad_ufs adio/ad_xfs adio/ad_hfs adio/ad_sfs adio/ad_testfs adio/ad_pvfs adio/ad_pvfs2 test
1570 +ALL_DIRS = mpi-io mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran adio/common adio/ad_pfs adio/ad_piofs adio/ad_nfs adio/ad_ufs adio/ad_xfs adio/ad_hfs adio/ad_sfs adio/ad_testfs adio/ad_pvfs adio/ad_pvfs2 adio/ad_lustre test
1574 --- mpich-1.2.6/romio/configure.in 2004-08-02 09:37:31.000000000 -0400
1575 +++ mpich-1.2.6/romio/configure.in 2005-12-06 11:54:38.000000000 -0500
1576 @@ -90,7 +90,7 @@ MPIO_REQ_REAL_POBJECTS="_iotest.o _iowai
1580 -known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs xfs hfs sfs"
1581 +known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs xfs hfs sfs lustre"
1582 known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi"
1585 @@ -1270,6 +1270,9 @@ fi
1586 if test -n "$file_system_testfs"; then
1587 AC_DEFINE(ROMIO_TESTFS,1,[Define for TESTFS])
1589 +if test -n "$file_system_lustre"; then
1590 + AC_DEFINE(ROMIO_LUSTRE,1,[Define for LUSTRE])
1592 if test -n "$file_system_piofs"; then
1593 AC_DEFINE(PIOFS,1,[Define for PIOFS])
1594 USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp"
1595 @@ -1634,7 +1637,7 @@ AC_OUTPUT(Makefile localdefs mpi-io/Make
1596 adio/ad_nfs/Makefile adio/ad_ufs/Makefile \
1597 adio/ad_xfs/Makefile adio/ad_hfs/Makefile \
1598 adio/ad_sfs/Makefile adio/ad_pfs/Makefile \
1599 - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \
1600 + adio/ad_testfs/Makefile adio/ad_lustre/Makefile adio/ad_pvfs/Makefile \
1601 adio/ad_pvfs2/Makefile adio/ad_piofs/Makefile \
1602 mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \
1603 mpi2-other/array/fortran/Makefile test/fmisc.f \
1604 --- mpich-1.2.6/romio/configure 2004-08-04 12:08:28.000000000 -0400
1605 +++ mpich-1.2.6/romio/configure 2005-12-06 11:54:38.000000000 -0500
1606 @@ -623,7 +623,7 @@ MPIO_REQ_REAL_POBJECTS="_iotest.o _iowai
1610 -known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs xfs hfs sfs"
1611 +known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs lustre xfs hfs sfs"
1612 known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi"
1615 @@ -4022,6 +4022,13 @@ if test -n "$file_system_testfs"; then
1619 +if test -n "$file_system_lustre"; then
1620 + cat >> confdefs.h <<\EOF
1626 if test -n "$file_system_piofs"; then
1627 cat >> confdefs.h <<\EOF
1629 @@ -4746,7 +4753,7 @@ trap 'rm -fr `echo "Makefile localdefs m
1630 adio/ad_xfs/Makefile adio/ad_hfs/Makefile \
1631 adio/ad_sfs/Makefile adio/ad_pfs/Makefile \
1632 adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \
1633 - adio/ad_pvfs2/Makefile adio/ad_piofs/Makefile \
1634 + adio/ad_pvfs2/Makefile adio/ad_piofs/Makefile adio/ad_lustre/Makefile\
1635 mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \
1636 mpi2-other/array/fortran/Makefile test/fmisc.f \
1637 test/fcoll_test.f test/pfcoll_test.f test/fperf.f adio/include/romioconf.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
1638 @@ -4912,7 +4919,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile l
1639 adio/ad_nfs/Makefile adio/ad_ufs/Makefile \
1640 adio/ad_xfs/Makefile adio/ad_hfs/Makefile \
1641 adio/ad_sfs/Makefile adio/ad_pfs/Makefile \
1642 - adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \
1643 + adio/ad_testfs/Makefile adio/ad_lustre/Makefile adio/ad_pvfs/Makefile \
1644 adio/ad_pvfs2/Makefile adio/ad_piofs/Makefile \
1645 mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \
1646 mpi2-other/array/fortran/Makefile test/fmisc.f \
1647 --- mpich-1.2.6/romio/adio/include/romioconf.h.in 2004-08-04 12:08:28.000000000 -0400
1648 +++ mpich-1.2.6/romio/adio/include/romioconf.h.in 2005-12-06 11:54:38.000000000 -0500
1650 /* Define for TESTFS */
1653 +/* Define for LUSTRE */
1656 /* Define for PIOFS */
1659 --- mpich-1.2.6/romio/adio/include/mpio_error.h 2002-11-15 11:26:23.000000000 -0500
1660 +++ mpich-1.2.6/romio/adio/include/mpio_error.h 2005-12-06 11:54:38.000000000 -0500
1662 #define MPIR_ERR_FILETYPE 33
1663 #define MPIR_ERR_NO_NTFS 35
1664 #define MPIR_ERR_NO_TESTFS 36
1665 +#define MPIR_ERR_NO_LUSTRE 37
1668 #ifndef MPIR_ERR_COMM_NULL
1669 --- mpich-1.2.6/romio/adio/include/adioi_fs_proto.h 2003-06-24 18:48:23.000000000 -0400
1670 +++ mpich-1.2.6/romio/adio/include/adioi_fs_proto.h 2005-12-06 11:54:38.000000000 -0500
1671 @@ -261,6 +261,68 @@ ADIO_Offset ADIOI_UFS_SeekIndividual(ADI
1672 void ADIOI_UFS_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
1676 +extern struct ADIOI_Fns_struct ADIO_LUSTRE_operations;
1678 +void ADIOI_LUSTRE_Open(ADIO_File fd, int *error_code);
1679 +void ADIOI_LUSTRE_Close(ADIO_File fd, int *error_code);
1680 +void ADIOI_LUSTRE_ReadContig(ADIO_File fd, void *buf, int count,
1681 + MPI_Datatype datatype, int file_ptr_type,
1682 + ADIO_Offset offset, ADIO_Status *status, int
1684 +void ADIOI_LUSTRE_WriteContig(ADIO_File fd, void *buf, int count,
1685 + MPI_Datatype datatype, int file_ptr_type,
1686 + ADIO_Offset offset, ADIO_Status *status, int
1688 +void ADIOI_LUSTRE_IwriteContig(ADIO_File fd, void *buf, int count,
1689 + MPI_Datatype datatype, int file_ptr_type,
1690 + ADIO_Offset offset, ADIO_Request *request, int
1692 +void ADIOI_LUSTRE_IreadContig(ADIO_File fd, void *buf, int count,
1693 + MPI_Datatype datatype, int file_ptr_type,
1694 + ADIO_Offset offset, ADIO_Request *request, int
1696 +int ADIOI_LUSTRE_ReadDone(ADIO_Request *request, ADIO_Status *status, int
1698 +int ADIOI_LUSTRE_WriteDone(ADIO_Request *request, ADIO_Status *status, int
1700 +void ADIOI_LUSTRE_ReadComplete(ADIO_Request *request, ADIO_Status *status, int
1702 +void ADIOI_LUSTRE_WriteComplete(ADIO_Request *request, ADIO_Status *status,
1704 +void ADIOI_LUSTRE_Fcntl(ADIO_File fd, int flag, ADIO_Fcntl_t *fcntl_struct, int
1706 +void ADIOI_LUSTRE_WriteStrided(ADIO_File fd, void *buf, int count,
1707 + MPI_Datatype datatype, int file_ptr_type,
1708 + ADIO_Offset offset, ADIO_Status *status, int
1710 +void ADIOI_LUSTRE_ReadStrided(ADIO_File fd, void *buf, int count,
1711 + MPI_Datatype datatype, int file_ptr_type,
1712 + ADIO_Offset offset, ADIO_Status *status, int
1714 +void ADIOI_LUSTRE_WriteStridedColl(ADIO_File fd, void *buf, int count,
1715 + MPI_Datatype datatype, int file_ptr_type,
1716 + ADIO_Offset offset, ADIO_Status *status, int
1718 +void ADIOI_LUSTRE_ReadStridedColl(ADIO_File fd, void *buf, int count,
1719 + MPI_Datatype datatype, int file_ptr_type,
1720 + ADIO_Offset offset, ADIO_Status *status, int
1722 +void ADIOI_LUSTRE_IreadStrided(ADIO_File fd, void *buf, int count,
1723 + MPI_Datatype datatype, int file_ptr_type,
1724 + ADIO_Offset offset, ADIO_Request *request, int
1726 +void ADIOI_LUSTRE_IwriteStrided(ADIO_File fd, void *buf, int count,
1727 + MPI_Datatype datatype, int file_ptr_type,
1728 + ADIO_Offset offset, ADIO_Request *request, int
1730 +void ADIOI_LUSTRE_Flush(ADIO_File fd, int *error_code);
1731 +void ADIOI_LUSTRE_Resize(ADIO_File fd, ADIO_Offset size, int *error_code);
1732 +ADIO_Offset ADIOI_LUSTRE_SeekIndividual(ADIO_File fd, ADIO_Offset offset,
1733 + int whence, int *error_code);
1734 +void ADIOI_LUSTRE_SetInfo(ADIO_File fd, MPI_Info users_info, int *error_code);
1738 extern struct ADIOI_Fns_struct ADIO_NTFS_operations;
1740 --- mpich-1.2.6/romio/adio/include/adio.h 2004-06-07 13:59:57.000000000 -0400
1741 +++ mpich-1.2.6/romio/adio/include/adio.h 2005-12-06 11:54:38.000000000 -0500
1742 @@ -276,6 +276,7 @@ typedef struct {
1743 #define ADIO_NTFS 158 /* NTFS for Windows NT */
1744 #define ADIO_TESTFS 159 /* fake file system for testing */
1745 #define ADIO_PVFS2 160 /* PVFS2: 2nd generation PVFS */
1746 +#define ADIO_LUSTRE 161 /* Lustre */
1748 #define ADIO_SEEK_SET SEEK_SET
1749 #define ADIO_SEEK_CUR SEEK_CUR
1750 --- mpich-1.2.6/romio/adio/common/setfn.c 2003-06-24 18:48:18.000000000 -0400
1751 +++ mpich-1.2.6/romio/adio/common/setfn.c 2005-12-06 11:54:38.000000000 -0500
1752 @@ -114,6 +114,16 @@ void ADIOI_SetFunctions(ADIO_File fd)
1758 + *(fd->fns) = ADIO_LUSTRE_operations;
1760 + FPRINTF(stderr, "ADIOI_SetFunctions: ROMIO has not been configured to use the LUSTRE file system\n");
1761 + MPI_Abort(MPI_COMM_WORLD, 1);
1767 FPRINTF(stderr, "ADIOI_SetFunctions: Unsupported file system type\n");
1768 MPI_Abort(MPI_COMM_WORLD, 1);
1769 --- mpich-1.2.6/romio/adio/common/ad_fstype.c 2003-09-04 16:24:44.000000000 -0400
1770 +++ mpich-1.2.6/romio/adio/common/ad_fstype.c 2005-12-06 11:54:38.000000000 -0500
1771 @@ -204,6 +204,11 @@ static void ADIO_FileSysType_fncall(char
1774 #elif defined(LINUX)
1775 +#warning use correct include
1776 +# if defined (LUSTRE)
1777 +#define LL_SUPER_MAGIC 0x0BD00BD0
1781 err = statfs(filename, &fsbuf);
1782 } while (err && (errno == ESTALE));
1783 @@ -218,6 +223,9 @@ static void ADIO_FileSysType_fncall(char
1785 /* FPRINTF(stderr, "%d\n", fsbuf.f_type);*/
1786 if (fsbuf.f_type == NFS_SUPER_MAGIC) *fstype = ADIO_NFS;
1787 +# if defined (LUSTRE)
1788 + else if (fsbuf.f_type == LL_SUPER_MAGIC) *fstype = ADIO_LUSTRE;
1790 # if defined(ROMIO_PVFS)
1791 else if (fsbuf.f_type == PVFS_SUPER_MAGIC) *fstype = ADIO_PVFS;
1793 @@ -359,6 +367,11 @@ static void ADIO_FileSysType_prefix(char
1795 *fstype = ADIO_TESTFS;
1797 + else if (!strncmp(filename, "lustre:", 7)
1798 + || !strncmp(filename, "LUSTRE:", 7))
1800 + *fstype = ADIO_LUSTRE;
1804 *fstype = ADIO_NTFS;
1805 @@ -644,6 +657,24 @@ void ADIO_ResolveFileType(MPI_Comm comm,
1806 *ops = &ADIO_TESTFS_operations;
1809 + if (file_system == ADIO_LUSTRE) {
1812 + *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iofstypeunsupported", 0);
1814 +# elif defined(PRINT_ERR_MSG)
1815 + FPRINTF(stderr, "ADIO_ResolveFileType: ROMIO has not been configured to use the LUSTRE file system\n");
1816 + MPI_Abort(MPI_COMM_WORLD, 1);
1817 +# else /* MPICH-1 */
1818 + myerrcode = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_LUSTRE,
1819 + myname, (char *) 0, (char *) 0);
1820 + *error_code = ADIOI_Error(MPI_FILE_NULL, myerrcode, myname);
1824 + *ops = &ADIO_LUSTRE_operations;
1827 *error_code = MPI_SUCCESS;
1828 *fstype = file_system;