Skip to content

Commit

Permalink
tmp commit
Browse files Browse the repository at this point in the history
  • Loading branch information
henricasanova committed Oct 1, 2024
1 parent 8cfc760 commit 1697094
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
5 changes: 0 additions & 5 deletions src/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,14 +157,10 @@ namespace simgrid::fsmod {
*/
sg_size_t File::write(sg_size_t num_bytes, bool simulate_it) {

std::cerr << "IN FILE WRITE!\n";

if (num_bytes == 0) /* Nothing to write, return */
return 0;
std::cerr << "CALLING WRITE_INIT_CHECKS\n";
int my_sequence_number = write_init_checks(num_bytes);

std::cerr << "IN FILE WRITE\n";
// Do the I/O simulation if need be
if (simulate_it) {
try {
Expand All @@ -173,7 +169,6 @@ namespace simgrid::fsmod {
throw xbt::UnimplementedError("Handling of hardware resource failures not implemented");
}
}
std::cerr << "IN FILE WRITE: CALLED PARTITION WRITE\n";

// Update
metadata_->set_access_date(s4u::Engine::get_clock());
Expand Down
4 changes: 1 addition & 3 deletions src/Partition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ namespace simgrid::fsmod {
if (dst_metadata && dst_metadata->get_file_refcount()) {
throw FileIsOpenException(XBT_THROW_POINT, dst_dir_path + "/" + dst_file_name);
}

// Create space if needed
if (dst_metadata) {
auto src_size = src_metadata->get_current_size();
Expand All @@ -124,15 +123,14 @@ namespace simgrid::fsmod {
}

// Do the move (reusing the original unique ptr, just in case)

auto uniq_ptr = std::move(content_.at(src_dir_path).at(src_file_name));
content_.at(src_dir_path).erase(src_file_name);
this->new_file_deletion_event(src_metadata);
uniq_ptr->file_name_ = dst_file_name;
uniq_ptr->set_modification_date(s4u::Engine::get_clock());
uniq_ptr->set_access_date(s4u::Engine::get_clock());
content_[dst_dir_path][dst_file_name] = std::move(uniq_ptr);
this->new_file_creation_event(content_[dst_dir_path][dst_file_name].get());
content_[dst_dir_path][dst_file_name]->set_access_date(s4u::Engine::get_clock());
}

std::set<std::string, std::less<>> Partition::list_files_in_directory(const std::string &dir_path) const {
Expand Down
6 changes: 4 additions & 2 deletions src/PartitionFIFOCaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace simgrid::fsmod {
sg_size_t space_that_can_be_created = 0.0;
std::vector<unsigned long> files_to_remove_to_create_space;

std::cerr << "IN CREATE SPACE!\n";
std::cerr << "** IN CREATE SPACE!\n";

for (auto const& [victim, victim_metadata]: priority_list_) {
std::cerr << "LOOKING AT VICTIM " << victim_metadata->file_name_ << "\n";
Expand All @@ -37,12 +37,14 @@ namespace simgrid::fsmod {
throw NotEnoughSpaceException(XBT_THROW_POINT, "Unable to evict files to create enough space");
}
for (auto const &victim: files_to_remove_to_create_space) {
std::cerr << "EVICTING VICTIM: " << this->priority_list_[victim]->file_name_ << "\n";
this->delete_file(this->priority_list_[victim]->dir_path_, this->priority_list_[victim]->file_name_);
}
std::cerr << "** RETURNING FROM CREATE SPACE\n";
}

void PartitionFIFOCaching::print_priority_list() {
std::cerr << "PLIST = ";
std::cerr << "PLIST " << this->get_name() << " = ";
for (auto const &i : priority_list_) {
std::cerr << " " << i.second->file_name_ << " ";
}
Expand Down
1 change: 0 additions & 1 deletion src/PartitionLRUCaching.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
namespace simgrid::fsmod {

void PartitionLRUCaching::new_file_access_event(FileMetadata *file_metadata) {
std::cerr << "NEW FILE ACCESS ENVENT FOR " << file_metadata->file_name_ << "!\n";
rm_from_priority_list(file_metadata);
file_metadata->sequence_number_ = get_next_sequence_number();
add_to_priority_list(file_metadata);
Expand Down

0 comments on commit 1697094

Please sign in to comment.