diff --git a/include/fsmod/Storage.hpp b/include/fsmod/Storage.hpp index a370fb8..89763d6 100644 --- a/include/fsmod/Storage.hpp +++ b/include/fsmod/Storage.hpp @@ -37,8 +37,6 @@ namespace simgrid::fsmod { [[nodiscard]] virtual s4u::ActorPtr start_controller(s4u::Host* host, const std::function &func); protected: - s4u::Host* controller_host_ = nullptr; - s4u::ActorPtr controller_ = nullptr; explicit Storage(std::string name): name_(std::move(name)) {} virtual ~Storage() = default; @@ -55,7 +53,8 @@ namespace simgrid::fsmod { private: std::string name_; std::vector disks_; - + s4u::Host* controller_host_ = nullptr; + s4u::ActorPtr controller_ = nullptr; }; } // namespace simgrid::fsmod diff --git a/src/JBODStorage.cpp b/src/JBODStorage.cpp index 4ae8bd4..7678c12 100644 --- a/src/JBODStorage.cpp +++ b/src/JBODStorage.cpp @@ -105,7 +105,10 @@ namespace simgrid::fsmod { // Create a Comm to transfer data to the host that requested a read to the controller host of the JBOD // Do not assign the destination of the Comm yet, will be done after the completion of the IOs - auto source_host = (controller_host_ == nullptr ? this->get_first_disk()->get_host() : controller_host_); + auto source_host = get_controller_host(); + if (source_host == nullptr) + source_host = this->get_first_disk()->get_host(); + auto comm = s4u::Comm::sendto_init()->set_source(source_host)->set_payload_size(size); comm->set_name("Transfer from JBod"); @@ -186,7 +189,9 @@ namespace simgrid::fsmod { // Do not start computing the parity block before the completion of the comm to the controller comm->add_successor(parity_block_comp); // Start the comm by setting its destination - auto destination_host = (controller_host_ == nullptr ? this->get_first_disk()->get_host() : controller_host_); + auto destination_host = get_controller_host(); + if (destination_host == nullptr) + destination_host = this->get_first_disk()->get_host(); comm->set_destination(destination_host); // Parity Block Computation is now blocked by Comm, start it by assigning it to the controller host