X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/62a32394d08487c948e60b95817e03d81f1af91d..6e1bfe4b91bd83b1bf4f09b20d5781c3aa4f7562:/src/surf/storage_n11.cpp diff --git a/src/surf/storage_n11.cpp b/src/surf/storage_n11.cpp index dfe6fcc769..6b5addb4c3 100644 --- a/src/surf/storage_n11.cpp +++ b/src/surf/storage_n11.cpp @@ -69,19 +69,7 @@ StorageImpl* StorageN11Model::createStorage(const char* id, const char* type_id, double StorageN11Model::nextOccuringEvent(double now) { - double min_completion = StorageModel::nextOccuringEventFull(now); - - for(auto storage: p_storageList) { - double rate = 0; - // Foreach write action on that disk - for (auto write_action: storage->writeActions_) { - rate += lmm_variable_getvalue(write_action->getVariable()); - } - if(rate > 0) - min_completion = MIN(min_completion, (storage->size_-storage->usedSize_)/rate); - } - - return min_completion; + return StorageModel::nextOccuringEventFull(now); } void StorageN11Model::updateActionsState(double /*now*/, double delta) @@ -149,44 +137,6 @@ StorageN11::StorageN11(StorageModel* model, const char* name, lmm_system_t maxmi simgrid::s4u::Storage::onCreation(this->piface_); } -StorageAction *StorageN11::open(const char* mount, const char* path) -{ - XBT_DEBUG("\tOpen file '%s'",path); - - sg_size_t size; - // if file does not exist create an empty file - if (content_->find(path) != content_->end()) - size = content_->at(path); - else { - size = 0; - content_->insert({path, size}); - XBT_DEBUG("File '%s' was not found, file created.",path); - } - FileImpl* file = new FileImpl(path, mount, size); - - StorageAction* action = new StorageN11Action(model(), 0, isOff(), this, OPEN); - action->file_ = file; - - return action; -} - -StorageAction *StorageN11::close(surf_file_t fd) -{ - XBT_DEBUG("\tClose file '%s' size '%llu'", fd->cname(), fd->size()); - // unref write actions from storage - for (std::vector::iterator it = writeActions_.begin(); it != writeActions_.end();) { - StorageAction *write_action = *it; - if ((write_action->file_) == fd) { - write_action->unref(); - it = writeActions_.erase(it); - } else { - ++it; - } - } - StorageAction* action = new StorageN11Action(model(), 0, isOff(), this, CLOSE); - return action; -} - StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size) { if (fd->tell() + size > fd->size()) { @@ -232,20 +182,11 @@ StorageN11Action::StorageN11Action(Model* model, double cost, bool failed, Stora // Must be less than the max bandwidth for all actions lmm_expand(model->getMaxminSystem(), storage->constraint(), getVariable(), 1.0); switch(type) { - case OPEN: - case CLOSE: - case STAT: - break; case READ: lmm_expand(model->getMaxminSystem(), storage->constraintRead_, getVariable(), 1.0); break; case WRITE: lmm_expand(model->getMaxminSystem(), storage->constraintWrite_, getVariable(), 1.0); - - //TODO there is something annoying with what's below. Have to sort it out... - // Action *action = this; - // storage->p_writeActions->push_back(action); - // ref(); break; default: THROW_UNIMPLEMENTED; @@ -298,7 +239,7 @@ void StorageN11Action::setMaxDuration(double /*duration*/) THROW_UNIMPLEMENTED; } -void StorageN11Action::setPriority(double /*priority*/) +void StorageN11Action::setSharingWeight(double /*priority*/) { THROW_UNIMPLEMENTED; }