Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
updating the MSG vision of file size when writing
authorsuter <frederic.suter@cc.in2p3.fr>
Tue, 27 May 2014 11:46:54 +0000 (13:46 +0200)
committersuter <frederic.suter@cc.in2p3.fr>
Tue, 27 May 2014 15:06:25 +0000 (17:06 +0200)
src/msg/msg_io.c

index 4b65d03..898604d 100644 (file)
@@ -140,7 +140,7 @@ sg_size_t MSG_file_read(msg_file_t fd, sg_size_t size)
 sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
 {
   msg_file_priv_t file_priv = MSG_file_priv(fd);
-  sg_size_t write_size;
+  sg_size_t write_size, offset;
 
   /* Find the host where the file is physically located (remote or local)*/
   msg_storage_t storage_src =(msg_storage_t) xbt_lib_get_elm_or_null(storage_lib, file_priv->storageId);
@@ -172,7 +172,9 @@ sg_size_t MSG_file_write(msg_file_t fd, sg_size_t size)
     }
   }
   /* Write file on local or remote host */
+  offset = simcall_file_tell(file_priv->simdata->smx_file);
   write_size = simcall_file_write(file_priv->simdata->smx_file, size, attached_host);
+  file_priv->size = offset+write_size;
 
   return write_size;
 }