Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix MSG_file_write bug
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Fri, 29 Nov 2013 08:31:02 +0000 (09:31 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Fri, 29 Nov 2013 11:28:40 +0000 (12:28 +0100)
examples/msg/io/storage.c
examples/msg/io/storage.tesh
src/surf/storage.cpp

index b422797..3dc8554 100644 (file)
@@ -11,7 +11,7 @@
  * - display information on the disks mounted by the current host
  * - create a 200,000 bytes file
  * - completely read the created file
  * - display information on the disks mounted by the current host
  * - create a 200,000 bytes file
  * - completely read the created file
- * - write 100,000 more bytes in the file
+ * - write 100,000 bytes in the file
  * - rename the created file
  * - attach some user data to a disk
  * - dump disk's contents
  * - rename the created file
  * - attach some user data to a disk
  * - dump disk's contents
@@ -78,9 +78,9 @@ static int host(int argc, char *argv[]){
   read = MSG_file_read(file, file_size);
   XBT_INFO("Read %llu bytes on %s", read, file_name);
 
   read = MSG_file_read(file, file_size);
   XBT_INFO("Read %llu bytes on %s", read, file_name);
 
-  // Now write 100,000 more bytes in tmp/data.txt
+  // Now write 100,000 bytes in tmp/data.txt
   write = MSG_file_write(file, 100000);  // Write 100,000 bytes
   write = MSG_file_write(file, 100000);  // Write 100,000 bytes
-  XBT_INFO("Write %llu more bytes on %s", write, file_name);
+  XBT_INFO("Write %llu bytes on %s", write, file_name);
   MSG_file_dump(file);
 
   MSG_file_close(file);
   MSG_file_dump(file);
 
   MSG_file_close(file);
index deffa47..978b990 100644 (file)
@@ -21,10 +21,10 @@ $ ${bindir:=.}/io/storage ${srcdir:=.}/examples/platforms/storage.xml "--log=roo
 > [0.003333] (1@denise) Free size: 536857490006 bytes
 > [0.003333] (1@denise) Used size: 13421994 bytes
 > [0.004583] (1@denise) Read 200000 bytes on ./tmp/data.txt
 > [0.003333] (1@denise) Free size: 536857490006 bytes
 > [0.003333] (1@denise) Used size: 13421994 bytes
 > [0.004583] (1@denise) Read 200000 bytes on ./tmp/data.txt
-> [0.007917] (1@denise) Write 100000 more bytes on ./tmp/data.txt
+> [0.007917] (1@denise) Write 100000 bytes on ./tmp/data.txt
 > [0.007917] (1@denise) File Descriptor information:
 >              Full name: './tmp/data.txt'
 > [0.007917] (1@denise) File Descriptor information:
 >              Full name: './tmp/data.txt'
->              Size: 300000
+>              Size: 100000
 >              Mount point: '/home'
 >              Storage Id: 'Disk4'
 >              Storage Type: 'single_SSD'
 >              Mount point: '/home'
 >              Storage Id: 'Disk4'
 >              Storage Type: 'single_SSD'
@@ -41,7 +41,7 @@ $ ${bindir:=.}/io/storage ${srcdir:=.}/examples/platforms/storage.xml "--log=roo
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/mc_bugged2.c size: 1387 bytes
 > [0.007917] (1@denise) ./include/simdag/simdag.h size: 10325 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/sys/README size: 1461 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/mc_bugged2.c size: 1387 bytes
 > [0.007917] (1@denise) ./include/simdag/simdag.h size: 10325 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/sys/README size: 1461 bytes
-> [0.007917] (1@denise) ./tmp/simgrid.readme size: 300000 bytes
+> [0.007917] (1@denise) ./tmp/simgrid.readme size: 100000 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/common/randdp.c size: 1441 bytes
 > [0.007917] (1@denise) ./include/msg/datatypes.h size: 4635 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/EP/randlc.c size: 3300 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/common/randdp.c size: 1441 bytes
 > [0.007917] (1@denise) ./include/msg/datatypes.h size: 4635 bytes
 > [0.007917] (1@denise) ./doc/simgrid/examples/smpi/NAS/EP/randlc.c size: 3300 bytes
index 961409f..2627dd8 100644 (file)
@@ -333,8 +333,8 @@ void StorageModel::updateActionsState(double /*now*/, double delta)
       /* Hack to avoid rounding differences between x86 and x86_64
        * (note that the next sizes are of type sg_size_t). */
       long incr = delta * rate + MAXMIN_PRECISION;
       /* Hack to avoid rounding differences between x86 and x86_64
        * (note that the next sizes are of type sg_size_t). */
       long incr = delta * rate + MAXMIN_PRECISION;
-      action->p_storage->m_usedSize += incr; // disk usage
-      action->p_file->size += incr; // file size
+      action->p_storage->m_usedSize += (incr - action->p_file->size); // disk usage
+      action->p_file->size = incr; // file size
 
       sg_size_t *psize = xbt_new(sg_size_t,1);
       *psize = action->p_file->size;
 
       sg_size_t *psize = xbt_new(sg_size_t,1);
       *psize = action->p_file->size;