os: add File_system_session::num_entries RPC

This patch splits the querying of the number of directory entries from
the directory's 'status' information. Subsuming the number of directory
entries as part of the status makes 'stat' calls too costly for some
file systems that need to read a directory for determining the number of
entries. So when stat'ing the entries of one directory that contains sub
directories, all entries of each sub directory are visited.

Thanks to Cedric Degea for pointing out this performance bottleneck!

With this change, the 'status' function returns a 'Status::size' value
of 0 when called for a directory handle.

Fixes #4603
This commit is contained in:
Norman Feske
2022-09-12 14:38:23 +02:00
parent 5b4b243e3d
commit cc9368ccb4
7 changed files with 48 additions and 12 deletions

View File

@ -112,6 +112,11 @@ class File_system::Session_client : public Genode::Rpc_client<Session>
{
call<Rpc_move>(from_dir, from_name, to_dir, to_name);
}
unsigned num_entries(Dir_handle dir) override
{
return call<Rpc_num_entries>(dir);
}
};
#endif /* _INCLUDE__FILE_SYSTEM_SESSION__CLIENT_H_ */