Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use what was previously added, and fix broken tests
authordegomme <adegomme@users.noreply.github.com>
Tue, 23 Apr 2019 13:38:32 +0000 (15:38 +0200)
committerdegomme <adegomme@users.noreply.github.com>
Tue, 23 Apr 2019 13:59:07 +0000 (15:59 +0200)
src/plugins/file_system/s4u_FileSystem.cpp
src/smpi/mpi/smpi_file.cpp

index 1c3d3c0..bf1781d 100644 (file)
@@ -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<FileSystemStorageExt>()->decr_used_size(size_ - current_position_);
+    write_size = local_storage_->write(size);
     local_storage_->extension<FileSystemStorageExt>()->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<std::string, sg_size_t>* content = local_storage_->extension<FileSystemStorageExt>()->get_content();
 
index 8d841ef..79d8bcb 100644 (file)
@@ -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);