vfs_block: warn only once if sync is not supported

Issue #4825
Issue #4820
This commit is contained in:
Christian Helmuth 2023-04-27 14:15:36 +02:00
parent 6717494c5b
commit 091db48843
3 changed files with 24 additions and 1 deletions

View File

@ -68,6 +68,16 @@
<write at="15" content="123"/>
<expect content="abcdefghIJKLMNO123stuvwxYZABCDEF"/>
</sequence>
<!-- Test write-sync-write-sync-read -->
write operation by reading back the content. -->
<sequence>
<write content="................................"/>
<sync/>
<write content="abcdefghIJKLMNOPqrstuvwxYZABCDEF"/>
<sync/>
<expect content="abcdefghIJKLMNOPqrstuvwxYZABCDEF"/>
</sequence>
</config>
</start>
</config>

View File

@ -194,6 +194,8 @@ class Test::Block_device
return result;
}
void sync() { fsync(_fd.value); }
};
@ -253,6 +255,12 @@ void Test::Main::_exec_step(Genode::Xml_node step, Block_device &block_device)
Genode::error("step '", step, "' failed");
throw Step_failed();
}
if (step.has_type("sync")) {
Genode::log("sync");
block_device.sync();
return;
}
}

View File

@ -332,7 +332,12 @@ class Vfs::Block_file_system::Data_file_system : public Single_file_system
_tx_source->release_packet(p);
if (!p.succeeded()) {
Genode::error("vfs_block: syncing blocks failed");
/* only warn once if sync is not supported */
static bool print_sync_failed = true;
if (print_sync_failed) {
Genode::warning("vfs_block: syncing blocks failed");
print_sync_failed = false;
}
return SYNC_ERR_INVALID;
}