From 649530d077d1a5bd5866e6f98b597fc9e2d01165 Mon Sep 17 00:00:00 2001 From: degomme Date: Tue, 23 Apr 2019 15:38:32 +0200 Subject: [PATCH] Use what was previously added, and fix broken tests --- src/plugins/file_system/s4u_FileSystem.cpp | 14 +++++++++----- src/smpi/mpi/smpi_file.cpp | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/file_system/s4u_FileSystem.cpp b/src/plugins/file_system/s4u_FileSystem.cpp index 1c3d3c0372..bf1781d05b 100644 --- a/src/plugins/file_system/s4u_FileSystem.cpp +++ b/src/plugins/file_system/s4u_FileSystem.cpp @@ -142,15 +142,19 @@ sg_size_t File::write(sg_size_t size, int write_inside) // If the storage is full before even starting to write if (sg_storage_get_size_used(local_storage_) >= sg_storage_get_size(local_storage_)) return 0; - /* Substract the part of the file that might disappear from the used sized on the storage element */ - sg_size_t write_size = local_storage_->write(size); - current_position_ += write_size; + sg_size_t write_size=0; if(write_inside==0){ + /* Substract the part of the file that might disappear from the used sized on the storage element */ local_storage_->extension()->decr_used_size(size_ - current_position_); + write_size = local_storage_->write(size); local_storage_->extension()->incr_used_size(write_size); + current_position_ += write_size; size_ = current_position_; - }else if(current_position_>size_){ - size_ = current_position_; + }else { + write_size = local_storage_->write(size); + current_position_ += write_size; + if(current_position_>size_) + size_ = current_position_; } std::map* content = local_storage_->extension()->get_content(); diff --git a/src/smpi/mpi/smpi_file.cpp b/src/smpi/mpi/smpi_file.cpp index 8d841ef4f7..79d8bcb625 100644 --- a/src/smpi/mpi/smpi_file.cpp +++ b/src/smpi/mpi/smpi_file.cpp @@ -171,7 +171,7 @@ namespace smpi{ MPI_Offset movesize = datatype->get_extent()*count; MPI_Offset writesize = datatype->size()*count; XBT_DEBUG("Position before write in MPI_File %s : %llu",fh->file_->get_path(),fh->file_->tell()); - MPI_Offset write = fh->file_->write(writesize); + MPI_Offset write = fh->file_->write(writesize, 1); XBT_VERB("Write in MPI_File %s, %lld bytes written, readsize %lld bytes, movesize %lld", fh->file_->get_path(), write, writesize, movesize); if(writesize!=movesize){ fh->file_->seek(position+movesize, SEEK_SET); -- 2.20.1