Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
further split File and Storage
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Nov 2017 22:55:30 +0000 (23:55 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 21 Nov 2017 22:55:30 +0000 (23:55 +0100)
19 files changed:
include/simgrid/forward.h
include/simgrid/s4u/File.hpp
include/simgrid/s4u/Storage.hpp
include/simgrid/simix.h
src/kernel/activity/SynchroIo.cpp
src/s4u/s4u_file.cpp
src/s4u/s4u_storage.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_io.cpp
src/simix/smx_io_private.hpp
src/surf/FileImpl.cpp
src/surf/FileImpl.hpp
src/surf/StorageImpl.hpp
src/surf/storage_n11.cpp

index e2cdeab..c59cd23 100644 (file)
@@ -80,7 +80,7 @@ typedef simgrid::kernel::context::Context* smx_context_t;
 typedef simgrid::simix::ActorImpl* smx_actor_t;
 typedef simgrid::simix::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
 typedef simgrid::simix::ActorImpl* smx_actor_t;
 typedef simgrid::simix::MutexImpl* smx_mutex_t;
 typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
-typedef simgrid::surf::FileImpl* surf_file_t;
+typedef simgrid::surf::StorageImpl* surf_storage_t;
 
 #else
 
 
 #else
 
@@ -100,7 +100,7 @@ typedef struct s_smx_context* smx_context_t;
 typedef struct s_smx_actor* smx_actor_t;
 typedef struct s_smx_mutex* smx_mutex_t;
 typedef struct s_smx_mailbox* smx_mailbox_t;
 typedef struct s_smx_actor* smx_actor_t;
 typedef struct s_smx_mutex* smx_mutex_t;
 typedef struct s_smx_mailbox* smx_mailbox_t;
-typedef struct s_surf_file* surf_file_t;
+typedef struct s_surf_storage* surf_storage_t;
 
 #endif
 
 
 #endif
 
index 14b370b..1429d2c 100644 (file)
@@ -64,7 +64,7 @@ public:
   int desc_id = 0;
 
 private:
   int desc_id = 0;
 
 private:
-  surf_file_t pimpl_ = nullptr;
+  simgrid::surf::FileImpl* pimpl_ = nullptr;
   std::string path_;
   void* userdata_ = nullptr;
 };
   std::string path_;
   void* userdata_ = nullptr;
 };
index b8d328e..c009740 100644 (file)
@@ -38,6 +38,7 @@ public:
   sg_size_t getSize(); /** Retrieve the total amount of space of this storage element */
   sg_size_t getSizeFree();
   sg_size_t getSizeUsed();
   sg_size_t getSize(); /** Retrieve the total amount of space of this storage element */
   sg_size_t getSizeFree();
   sg_size_t getSizeUsed();
+  void decrUsedSize(sg_size_t size);
 
   std::map<std::string, std::string>* getProperties();
   const char* getProperty(std::string key);
 
   std::map<std::string, std::string>* getProperties();
   const char* getProperty(std::string key);
@@ -47,6 +48,8 @@ public:
   void setUserdata(void* data) { userdata_ = data; }
   void* getUserdata() { return userdata_; }
 
   void setUserdata(void* data) { userdata_ = data; }
   void* getUserdata() { return userdata_; }
 
+  sg_size_t read(sg_size_t size);
+  sg_size_t write(sg_size_t size);
   surf::StorageImpl* getImpl() { return pimpl_; }
 
   /* The signals */
   surf::StorageImpl* getImpl() { return pimpl_; }
 
   /* The signals */
index 8d27291..7d9245d 100644 (file)
@@ -284,9 +284,9 @@ XBT_PUBLIC(void) SIMIX_sem_destroy(smx_sem_t sem);
 XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
 XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
 
 XBT_PUBLIC(void) simcall_sem_acquire(smx_sem_t sem);
 XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
 
-/*****************************   File   **********************************/
-XBT_PUBLIC(sg_size_t) simcall_file_read(surf_file_t fd, sg_size_t size);
-XBT_PUBLIC(sg_size_t) simcall_file_write(surf_file_t fd, sg_size_t size);
+/*****************************   Storage   **********************************/
+XBT_PUBLIC(sg_size_t) simcall_storage_read(surf_storage_t st, sg_size_t size);
+XBT_PUBLIC(sg_size_t) simcall_storage_write(surf_storage_t fd, sg_size_t size);
 /************************** MC simcalls   **********************************/
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
 /************************** MC simcalls   **********************************/
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
index 65ac052..9001cf9 100644 (file)
@@ -23,14 +23,14 @@ void simgrid::kernel::activity::IoImpl::post()
 {
   for (smx_simcall_t const& simcall : simcalls) {
     switch (simcall->call) {
 {
   for (smx_simcall_t const& simcall : simcalls) {
     switch (simcall->call) {
-    case SIMCALL_FILE_WRITE:
-      simcall_file_write__set__result(simcall, surf_io->getCost());
-      break;
-    case SIMCALL_FILE_READ:
-      simcall_file_read__set__result(simcall, surf_io->getCost());
-      break;
-    default:
-      break;
+      case SIMCALL_STORAGE_WRITE:
+        simcall_storage_write__set__result(simcall, surf_io->getCost());
+        break;
+      case SIMCALL_STORAGE_READ:
+        simcall_storage_read__set__result(simcall, surf_io->getCost());
+        break;
+      default:
+        break;
     }
   }
 
     }
   }
 
index f9fa944..8c90137 100644 (file)
@@ -55,12 +55,30 @@ File::~File()
 
 sg_size_t File::read(sg_size_t size)
 {
 
 sg_size_t File::read(sg_size_t size)
 {
-  return simcall_file_read(pimpl_, size);
+  XBT_DEBUG("READ %s on disk '%s'", getPath(), onStorage->getCname());
+  // if the current position is close to the end of the file, we may not be able to read the requested size
+  sg_size_t read_size = onStorage->read(std::min(size, this->size() - this->tell()));
+  pimpl_->incrPosition(read_size);
+  return read_size;
 }
 
 sg_size_t File::write(sg_size_t size)
 {
 }
 
 sg_size_t File::write(sg_size_t size)
 {
-  return simcall_file_write(pimpl_, size);
+  XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", getPath(), onStorage->getCname(), size, this->size());
+  // If the storage is full before even starting to write
+  if (onStorage->getSizeUsed() >= onStorage->getSize())
+    return 0;
+  /* Substract the part of the file that might disappear from the used sized on the storage element */
+  onStorage->decrUsedSize(this->size() - this->tell());
+
+  sg_size_t write_size = onStorage->write(size);
+  pimpl_->incrPosition(write_size);
+  pimpl_->setSize(this->tell());
+
+  onStorage->getContent()->erase(pimpl_->getName());
+  onStorage->getContent()->insert({pimpl_->getName(), this->size()});
+
+  return write_size;
 }
 
 sg_size_t File::size()
 }
 
 sg_size_t File::size()
index 6dd8fe9..5cb09af 100644 (file)
@@ -3,10 +3,10 @@
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
-#include "../surf/StorageImpl.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Storage.hpp"
 #include "simgrid/simix.hpp"
+#include "src/surf/StorageImpl.hpp"
 #include <unordered_map>
 
 namespace simgrid {
 #include <unordered_map>
 
 namespace simgrid {
@@ -60,6 +60,11 @@ sg_size_t Storage::getSizeUsed()
   return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); });
 }
 
   return simgrid::simix::kernelImmediate([this] { return pimpl_->getUsedSize(); });
 }
 
+void Storage::decrUsedSize(sg_size_t size)
+{
+  simgrid::simix::kernelImmediate([this, size] { pimpl_->usedSize_ -= size; });
+}
+
 sg_size_t Storage::getSize()
 {
   return pimpl_->getSize();
 sg_size_t Storage::getSize()
 {
   return pimpl_->getSize();
@@ -85,6 +90,16 @@ std::map<std::string, sg_size_t>* Storage::getContent()
   return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
 }
 
   return simgrid::simix::kernelImmediate([this] { return pimpl_->getContent(); });
 }
 
+sg_size_t Storage::read(sg_size_t size)
+{
+  return simcall_storage_read(pimpl_, size);
+}
+
+sg_size_t Storage::write(sg_size_t size)
+{
+  return simcall_storage_write(pimpl_, size);
+}
+
 /*************
  * Callbacks *
  *************/
 /*************
  * Callbacks *
  *************/
index 568bce1..6af4880 100644 (file)
@@ -505,9 +505,7 @@ void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
  * \ingroup simix_synchro_management
  *
  */
  * \ingroup simix_synchro_management
  *
  */
-void simcall_cond_wait_timeout(smx_cond_t cond,
-                                 smx_mutex_t mutex,
-                                 double timeout)
+void simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
 {
   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
   simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
 {
   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
   simcall_BODY_cond_wait_timeout(cond, mutex, timeout);
@@ -541,22 +539,14 @@ void simcall_sem_acquire_timeout(smx_sem_t sem, double timeout)
   simcall_BODY_sem_acquire_timeout(sem, timeout);
 }
 
   simcall_BODY_sem_acquire_timeout(sem, timeout);
 }
 
-/**
- * \ingroup simix_file_management
- *
- */
-sg_size_t simcall_file_read(surf_file_t fd, sg_size_t size)
+sg_size_t simcall_storage_read(surf_storage_t st, sg_size_t size)
 {
 {
-  return simcall_BODY_file_read(fd, size);
+  return simcall_BODY_storage_read(st, size);
 }
 
 }
 
-/**
- * \ingroup simix_file_management
- *
- */
-sg_size_t simcall_file_write(surf_file_t fd, sg_size_t size)
+sg_size_t simcall_storage_write(surf_storage_t st, sg_size_t size)
 {
 {
-  return simcall_BODY_file_write(fd, size);
+  return simcall_BODY_storage_write(st, size);
 }
 
 void simcall_run_kernel(std::function<void()> const& code)
 }
 
 void simcall_run_kernel(std::function<void()> const& code)
index 3201a9e..020056e 100644 (file)
@@ -1195,76 +1195,76 @@ static inline void simcall_sem_acquire_timeout__set__timeout(smx_simcall_t simca
   simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
   simgrid::simix::marshal<double>(simcall->args[1], arg);
 }
 
-static inline surf_file_t simcall_file_read__get__fd(smx_simcall_t simcall)
+static inline surf_storage_t simcall_storage_read__get__st(smx_simcall_t simcall)
 {
 {
-  return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
+  return simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]);
 }
 }
-static inline surf_file_t simcall_file_read__getraw__fd(smx_simcall_t simcall)
+static inline surf_storage_t simcall_storage_read__getraw__st(smx_simcall_t simcall)
 {
 {
-  return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
+  return simgrid::simix::unmarshal_raw<surf_storage_t>(simcall->args[0]);
 }
 }
-static inline void simcall_file_read__set__fd(smx_simcall_t simcall, surf_file_t arg)
+static inline void simcall_storage_read__set__st(smx_simcall_t simcall, surf_storage_t arg)
 {
 {
-  simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
+  simgrid::simix::marshal<surf_storage_t>(simcall->args[0], arg);
 }
 }
-static inline sg_size_t simcall_file_read__get__size(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_read__get__size(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
-static inline sg_size_t simcall_file_read__getraw__size(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_read__getraw__size(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->args[1]);
 }
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->args[1]);
 }
-static inline void simcall_file_read__set__size(smx_simcall_t simcall, sg_size_t arg)
+static inline void simcall_storage_read__set__size(smx_simcall_t simcall, sg_size_t arg)
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_size_t simcall_file_read__get__result(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_read__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
-static inline sg_size_t simcall_file_read__getraw__result(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_read__getraw__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->result);
 }
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->result);
 }
-static inline void simcall_file_read__set__result(smx_simcall_t simcall, sg_size_t result)
+static inline void simcall_storage_read__set__result(smx_simcall_t simcall, sg_size_t result)
 {
   simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
 {
   simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 
-static inline surf_file_t simcall_file_write__get__fd(smx_simcall_t simcall)
+static inline surf_storage_t simcall_storage_write__get__st(smx_simcall_t simcall)
 {
 {
-  return simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]);
+  return simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]);
 }
 }
-static inline surf_file_t simcall_file_write__getraw__fd(smx_simcall_t simcall)
+static inline surf_storage_t simcall_storage_write__getraw__st(smx_simcall_t simcall)
 {
 {
-  return simgrid::simix::unmarshal_raw<surf_file_t>(simcall->args[0]);
+  return simgrid::simix::unmarshal_raw<surf_storage_t>(simcall->args[0]);
 }
 }
-static inline void simcall_file_write__set__fd(smx_simcall_t simcall, surf_file_t arg)
+static inline void simcall_storage_write__set__st(smx_simcall_t simcall, surf_storage_t arg)
 {
 {
-  simgrid::simix::marshal<surf_file_t>(simcall->args[0], arg);
+  simgrid::simix::marshal<surf_storage_t>(simcall->args[0], arg);
 }
 }
-static inline sg_size_t simcall_file_write__get__size(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_write__get__size(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]);
 }
-static inline sg_size_t simcall_file_write__getraw__size(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_write__getraw__size(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->args[1]);
 }
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->args[1]);
 }
-static inline void simcall_file_write__set__size(smx_simcall_t simcall, sg_size_t arg)
+static inline void simcall_storage_write__set__size(smx_simcall_t simcall, sg_size_t arg)
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
 {
   simgrid::simix::marshal<sg_size_t>(simcall->args[1], arg);
 }
-static inline sg_size_t simcall_file_write__get__result(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_write__get__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
 {
   return simgrid::simix::unmarshal<sg_size_t>(simcall->result);
 }
-static inline sg_size_t simcall_file_write__getraw__result(smx_simcall_t simcall)
+static inline sg_size_t simcall_storage_write__getraw__result(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->result);
 }
 {
   return simgrid::simix::unmarshal_raw<sg_size_t>(simcall->result);
 }
-static inline void simcall_file_write__set__result(smx_simcall_t simcall, sg_size_t result)
+static inline void simcall_storage_write__set__result(smx_simcall_t simcall, sg_size_t result)
 {
   simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
 {
   simgrid::simix::marshal<sg_size_t>(simcall->result, result);
 }
@@ -1381,6 +1381,6 @@ XBT_PRIVATE void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t con
 XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
 XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
 XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
-XBT_PRIVATE void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
-XBT_PRIVATE void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size);
+XBT_PRIVATE void simcall_HANDLER_storage_read(smx_simcall_t simcall, surf_storage_t st, sg_size_t size);
+XBT_PRIVATE void simcall_HANDLER_storage_write(smx_simcall_t simcall, surf_storage_t st, sg_size_t size);
 XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
 XBT_PRIVATE int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max);
\ No newline at end of file
index f942251..dd9b622 100644 (file)
@@ -232,18 +232,18 @@ inline static void simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeou
   return simcall<void, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
 }
 
   return simcall<void, smx_sem_t, double>(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem, timeout);
 }
 
-inline static sg_size_t simcall_BODY_file_read(surf_file_t fd, sg_size_t size)
+inline static sg_size_t simcall_BODY_storage_read(surf_storage_t st, sg_size_t size)
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_file_read(&SIMIX_process_self()->simcall, fd, size);
-  return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_READ, fd, size);
+    simcall_HANDLER_storage_read(&SIMIX_process_self()->simcall, st, size);
+  return simcall<sg_size_t, surf_storage_t, sg_size_t>(SIMCALL_STORAGE_READ, st, size);
 }
 
 }
 
-inline static sg_size_t simcall_BODY_file_write(surf_file_t fd, sg_size_t size)
+inline static sg_size_t simcall_BODY_storage_write(surf_storage_t st, sg_size_t size)
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_file_write(&SIMIX_process_self()->simcall, fd, size);
-  return simcall<sg_size_t, surf_file_t, sg_size_t>(SIMCALL_FILE_WRITE, fd, size);
+    simcall_HANDLER_storage_write(&SIMIX_process_self()->simcall, st, size);
+  return simcall<sg_size_t, surf_storage_t, sg_size_t>(SIMCALL_STORAGE_WRITE, st, size);
 }
 
 inline static int simcall_BODY_mc_random(int min, int max)
 }
 
 inline static int simcall_BODY_mc_random(int min, int max)
index 8e44e97..e2a7c49 100644 (file)
@@ -47,10 +47,11 @@ typedef enum {
   SIMCALL_COND_BROADCAST,
   SIMCALL_SEM_ACQUIRE,
   SIMCALL_SEM_ACQUIRE_TIMEOUT,
   SIMCALL_COND_BROADCAST,
   SIMCALL_SEM_ACQUIRE,
   SIMCALL_SEM_ACQUIRE_TIMEOUT,
-  SIMCALL_FILE_READ,
-  SIMCALL_FILE_WRITE,
+  SIMCALL_STORAGE_READ,
+  SIMCALL_STORAGE_WRITE,
   SIMCALL_MC_RANDOM,
   SIMCALL_SET_CATEGORY,
   SIMCALL_RUN_KERNEL,
   SIMCALL_MC_RANDOM,
   SIMCALL_SET_CATEGORY,
   SIMCALL_RUN_KERNEL,
-  SIMCALL_RUN_BLOCKING,  NUM_SIMCALLS
+  SIMCALL_RUN_BLOCKING,
+  NUM_SIMCALLS
 } e_smx_simcall_t;
 } e_smx_simcall_t;
index 13531f7..1d6a4a6 100644 (file)
@@ -53,8 +53,8 @@ const char* simcall_names[] = {
     "SIMCALL_COND_BROADCAST",
     "SIMCALL_SEM_ACQUIRE",
     "SIMCALL_SEM_ACQUIRE_TIMEOUT",
     "SIMCALL_COND_BROADCAST",
     "SIMCALL_SEM_ACQUIRE",
     "SIMCALL_SEM_ACQUIRE_TIMEOUT",
-    "SIMCALL_FILE_READ",
-    "SIMCALL_FILE_WRITE",
+    "SIMCALL_STORAGE_READ",
+    "SIMCALL_STORAGE_WRITE",
     "SIMCALL_MC_RANDOM",
     "SIMCALL_SET_CATEGORY",
     "SIMCALL_RUN_KERNEL",
     "SIMCALL_MC_RANDOM",
     "SIMCALL_SET_CATEGORY",
     "SIMCALL_RUN_KERNEL",
@@ -197,12 +197,14 @@ case SIMCALL_SEM_ACQUIRE_TIMEOUT:
   simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
   break;
 
   simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
   break;
 
-case SIMCALL_FILE_READ:
-  simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
+case SIMCALL_STORAGE_READ:
+  simcall_HANDLER_storage_read(simcall, simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]),
+                               simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
   break;
 
-case SIMCALL_FILE_WRITE:
-  simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]), simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
+case SIMCALL_STORAGE_WRITE:
+  simcall_HANDLER_storage_write(simcall, simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]),
+                                simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
   break;
 
 case SIMCALL_MC_RANDOM:
   break;
 
 case SIMCALL_MC_RANDOM:
index 8397063..99e748f 100644 (file)
@@ -70,8 +70,8 @@ void       cond_broadcast(smx_cond_t cond) [[nohandler]];
 void      sem_acquire(smx_sem_t sem) [[block]];
 void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
 
 void      sem_acquire(smx_sem_t sem) [[block]];
 void      sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
 
-sg_size_t   file_read(surf_file_t fd, sg_size_t size) [[block]];
-sg_size_t   file_write(surf_file_t fd, sg_size_t size) [[block]];
+sg_size_t   storage_read(surf_storage_t st, sg_size_t size) [[block]];
+sg_size_t   storage_write(surf_storage_t st, sg_size_t size) [[block]];
 
 int        mc_random(int min, int max);
 void       set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
 
 int        mc_random(int min, int max);
 void       set_category(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> synchro, const char* category) [[nohandler]];
index dc04477..1f35bf2 100644 (file)
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_io, simix, "Logging specific to SIMIX (io)");
 
-//SIMIX FILE READ
-void simcall_HANDLER_file_read(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
+void simcall_HANDLER_storage_read(smx_simcall_t simcall, surf_storage_t st, sg_size_t size)
 {
 {
-  smx_activity_t synchro = SIMIX_file_read(fd, size);
+  smx_activity_t synchro = SIMIX_storage_read(st, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size)
+smx_activity_t SIMIX_storage_read(surf_storage_t st, sg_size_t size)
 {
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
 {
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
-  synchro->surf_io                           = file->read(size);
+  synchro->surf_io                           = st->read(size);
 
   synchro->surf_io->setData(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
 
   synchro->surf_io->setData(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
@@ -40,18 +39,17 @@ smx_activity_t SIMIX_file_read(surf_file_t file, sg_size_t size)
   return synchro;
 }
 
   return synchro;
 }
 
-//SIMIX FILE WRITE
-void simcall_HANDLER_file_write(smx_simcall_t simcall, surf_file_t fd, sg_size_t size)
+void simcall_HANDLER_storage_write(smx_simcall_t simcall, surf_storage_t st, sg_size_t size)
 {
 {
-  smx_activity_t synchro = SIMIX_file_write(fd, size);
+  smx_activity_t synchro = SIMIX_storage_write(st, size);
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
   synchro->simcalls.push_back(simcall);
   simcall->issuer->waiting_synchro = synchro;
 }
 
-smx_activity_t SIMIX_file_write(surf_file_t file, sg_size_t size)
+smx_activity_t SIMIX_storage_write(surf_storage_t st, sg_size_t size)
 {
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
 {
   simgrid::kernel::activity::IoImpl* synchro = new simgrid::kernel::activity::IoImpl();
-  synchro->surf_io                           = file->write(size);
+  synchro->surf_io                           = st->write(size);
   synchro->surf_io->setData(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
 
   synchro->surf_io->setData(synchro);
   XBT_DEBUG("Create io synchro %p", synchro);
 
index 05846b7..79581a8 100644 (file)
@@ -11,8 +11,8 @@
 #include "popping_private.hpp"
 #include "simgrid/simix.h"
 
 #include "popping_private.hpp"
 #include "simgrid/simix.h"
 
-XBT_PRIVATE smx_activity_t SIMIX_file_read(surf_file_t fd, sg_size_t size);
-XBT_PRIVATE smx_activity_t SIMIX_file_write(surf_file_t fd, sg_size_t size);
+XBT_PRIVATE smx_activity_t SIMIX_storage_read(surf_storage_t fd, sg_size_t size);
+XBT_PRIVATE smx_activity_t SIMIX_storage_write(surf_storage_t fd, sg_size_t size);
 
 XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
 XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);
 
 XBT_PRIVATE void SIMIX_io_destroy(smx_activity_t synchro);
 XBT_PRIVATE void SIMIX_io_finish(smx_activity_t synchro);
index d190065..4a85e3d 100644 (file)
@@ -27,37 +27,6 @@ FileImpl::FileImpl(sg_storage_t st, std::string path, std::string mount) : path_
   }
 }
 
   }
 }
 
-Action* FileImpl::read(sg_size_t size)
-{
-  XBT_DEBUG("READ %s on disk '%s'", getCname(), location_->getCname());
-  if (current_position_ + size > size_) {
-    if (current_position_ > size_) {
-      size = 0;
-    } else {
-      size = size_ - current_position_;
-    }
-    current_position_ = size_;
-  } else
-    current_position_ += size;
-
-  return location_->read(size);
-}
-
-Action* FileImpl::write(sg_size_t size)
-{
-  XBT_DEBUG("WRITE %s on disk '%s'. size '%llu/%llu'", getCname(), location_->getCname(), size, size_);
-
-  StorageAction* action = location_->write(size);
-  action->file_         = this;
-  /* Substract the part of the file that might disappear from the used sized on the storage element */
-  location_->usedSize_ -= (size_ - current_position_);
-  // If the storage is full before even starting to write
-  if (location_->usedSize_ >= location_->getSize()) {
-    action->setState(Action::State::failed);
-  }
-  return action;
-}
-
 int FileImpl::seek(sg_offset_t offset, int origin)
 {
   switch (origin) {
 int FileImpl::seek(sg_offset_t offset, int origin)
 {
   switch (origin) {
index acb8f27..b7acf36 100644 (file)
@@ -29,8 +29,6 @@ public:
   int seek(sg_offset_t offset, int origin);
   int unlink();
   void move(std::string fullpath);
   int seek(sg_offset_t offset, int origin);
   int unlink();
   void move(std::string fullpath);
-  Action* read(sg_size_t size);
-  Action* write(sg_size_t size);
 
 private:
   StorageImpl* location_;
 
 private:
   StorageImpl* location_;
index b5f52e1..2c45054 100644 (file)
@@ -205,7 +205,6 @@ public:
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
 
   e_surf_action_storage_type_t type_;
   StorageImpl* storage_;
-  FileImpl* file_ = nullptr;
 };
 
 class StorageType {
 };
 
 class StorageType {
index 7229685..2bbfd74 100644 (file)
@@ -86,11 +86,6 @@ void StorageN11Model::updateActionsState(double /*now*/, double delta)
     action->updateRemains(current_progress);
     if (action->type_ == WRITE) {
       action->storage_->usedSize_ += current_progress;
     action->updateRemains(current_progress);
     if (action->type_ == WRITE) {
       action->storage_->usedSize_ += current_progress;
-      action->file_->incrPosition(current_progress);
-      action->file_->setSize(action->file_->tell());
-
-      action->storage_->getContent()->erase(action->file_->getCname());
-      action->storage_->getContent()->insert({action->file_->getCname(), action->file_->size()});
     }
 
     if (action->getMaxDuration() > NO_MAX_DURATION)
     }
 
     if (action->getMaxDuration() > NO_MAX_DURATION)