Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[surf] Move VMCreatedCallbacks outside of constructor
[simgrid.git] / src / surf / storage_n11.cpp
index 6baacc2..01769e1 100644 (file)
@@ -214,7 +214,7 @@ void surf_storage_model_init_default(void)
 {
   surf_storage_model = new StorageN11Model();
   storage_define_callbacks();
-  xbt_dynar_push(model_list, &surf_storage_model);
+  xbt_dynar_push(all_existing_models, &surf_storage_model);
 }
 
 StorageN11Model::StorageN11Model() : StorageModel() {
@@ -252,7 +252,7 @@ Storage *StorageN11Model::createStorage(const char* id, const char* type_id,
   Storage *storage = new StorageN11(this, id, properties, p_maxminSystem,
       Bread, Bwrite, Bconnection, type_id, (char *)content_name,
       xbt_strdup(content_type), storage_type->size, (char *) attach);
-
+  surf_callback_emit(storageCreatedCallbacks, storage);
   xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
 
   XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n",
@@ -332,10 +332,8 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
 
       action->p_storage->m_usedSize += incr; // disk usage
       action->p_file->current_position+= incr; // current_position
-      //  which becomes the new file size only if it's greater than the current
-      // file size
-      if (action->p_file->current_position > action->p_file->size)
-        action->p_file->size = action->p_file->current_position ;
+      //  which becomes the new file size
+      action->p_file->size = action->p_file->current_position ;
 
       sg_size_t *psize = xbt_new(sg_size_t,1);
       *psize = action->p_file->size;