1414 if (writebuf_len) { \
1515 ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
1616 ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
17- if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
17+ if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
18+ ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
1819 if (*error_code != MPI_SUCCESS) { \
1920 *error_code = MPIO_Err_create_code(*error_code, \
2021 MPIR_ERR_RECOVERABLE, myname, \
2526 } \
2627 writebuf_off = req_off; \
2728 writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
28- if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
29+ if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
30+ ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
2931 ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
3032 ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
3133 if (*error_code != MPI_SUCCESS) { \
4244 while (write_sz != req_len) { \
4345 ADIO_WriteContig(fd, writebuf, writebuf_len, MPI_BYTE, \
4446 ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
45- if (!(fd->atomicity)) ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
47+ if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
48+ ADIOI_UNLOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
4649 if (*error_code != MPI_SUCCESS) { \
4750 *error_code = MPIO_Err_create_code(*error_code, \
4851 MPIR_ERR_RECOVERABLE, myname, \
5457 userbuf_off += write_sz; \
5558 writebuf_off += writebuf_len; \
5659 writebuf_len = (unsigned) (ADIOI_MIN(max_bufsize,end_offset-writebuf_off+1));\
57- if (!(fd->atomicity)) ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
60+ if (!fd->atomicity && fd->hints->ds_write == ADIOI_HINT_DISABLE) \
61+ ADIOI_WRITE_LOCK(fd, writebuf_off, SEEK_SET, writebuf_len); \
5862 ADIO_ReadContig(fd, writebuf, writebuf_len, MPI_BYTE, \
5963 ADIO_EXPLICIT_OFFSET, writebuf_off, &status1, error_code); \
6064 if (*error_code != MPI_SUCCESS) { \
@@ -191,9 +195,10 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
191195 writebuf = (char * ) ADIOI_Malloc (max_bufsize );
192196 writebuf_len = (unsigned ) (ADIOI_MIN (max_bufsize , end_offset - writebuf_off + 1 ));
193197
194- /* if atomicity is true, lock the region to be accessed */
195- if (fd -> atomicity )
196- ADIOI_WRITE_LOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
198+ /* if atomicity is true or data sieving is not disable, lock the region
199+ * to be accessed */
200+ if (fd -> atomicity || fd -> hints -> ds_write != ADIOI_HINT_DISABLE )
201+ ADIOI_WRITE_LOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
197202
198203 for (j = 0 ; j < count ; j ++ )
199204 {
@@ -210,7 +215,7 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
210215 ADIO_WriteContig (fd , writebuf , writebuf_len , MPI_BYTE , ADIO_EXPLICIT_OFFSET ,
211216 writebuf_off , & status1 , error_code );
212217
213- if (fd -> atomicity )
218+ if (fd -> atomicity || fd -> hints -> ds_write != ADIOI_HINT_DISABLE )
214219 ADIOI_UNLOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
215220
216221 if (* error_code != MPI_SUCCESS ) goto fn_exit ;
@@ -287,8 +292,10 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
287292 * datatypes, instead of a count of bytes (which might overflow)
288293 * Other WriteContig calls in this path are operating on data
289294 * sieving buffer */
295+ ADIOI_WRITE_LOCK (fd , offset , SEEK_SET , bufsize );
290296 ADIO_WriteContig (fd , buf , count , datatype , ADIO_EXPLICIT_OFFSET ,
291297 offset , status , error_code );
298+ ADIOI_UNLOCK (fd , offset , SEEK_SET , bufsize );
292299
293300 if (file_ptr_type == ADIO_INDIVIDUAL ) {
294301 /* update MPI-IO file pointer to point to the first byte
@@ -338,9 +345,10 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
338345 fwr_size = ADIOI_MIN (flat_file -> blocklens [j ], bufsize - i_offset );
339346 }
340347
341- /* if atomicity is true, lock the region to be accessed */
342- if (fd -> atomicity )
343- ADIOI_WRITE_LOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
348+ /* if atomicity is true or data sieving is not disable, lock the region
349+ * to be accessed */
350+ if (fd -> atomicity || fd -> hints -> ds_write != ADIOI_HINT_DISABLE )
351+ ADIOI_WRITE_LOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
344352
345353 writebuf_off = 0 ;
346354 writebuf_len = 0 ;
@@ -460,11 +468,11 @@ void ADIOI_GEN_WriteStrided(ADIO_File fd, const void *buf, int count,
460468 if (writebuf_len ) {
461469 ADIO_WriteContig (fd , writebuf , writebuf_len , MPI_BYTE , ADIO_EXPLICIT_OFFSET ,
462470 writebuf_off , & status1 , error_code );
463- if (!( fd -> atomicity ))
471+ if (!fd -> atomicity && fd -> hints -> ds_write == ADIOI_HINT_DISABLE )
464472 ADIOI_UNLOCK (fd , writebuf_off , SEEK_SET , writebuf_len );
465473 if (* error_code != MPI_SUCCESS ) goto fn_exit ;
466474 }
467- if (fd -> atomicity )
475+ if (fd -> atomicity || fd -> hints -> ds_write != ADIOI_HINT_DISABLE )
468476 ADIOI_UNLOCK (fd , start_off , SEEK_SET , end_offset - start_off + 1 );
469477
470478 if (file_ptr_type == ADIO_INDIVIDUAL ) fd -> fp_ind = off ;
0 commit comments