mmap-cache: bind prot(ection) to MMapFileDescriptor
There are no mmap_cache_get() users that actually deviate prot from the JournalFile's f->prot. So there's no point in making this a separate parameter to mmap_cache_get(), nor is there any need to store it in JournalFile's f->prot. Instead just pass it to mmap_cache_add_fd() at MMapFileDescriptor creation, storing it in there for the mmap() callers, which already receive MMapFileDescriptor *. For functions receiving both an MMapFileDescriptor * and prot, the prot argument has been simply removed and call sites updated. Formalizing this fd:prot binding at the public API also enables discarding the prot check in window_matches(), which is a hot function on long window lists, so a minor CPU efficiency gain should be had there as seen with the past removal of the fd check. Unnoticable for uncached journals, but maybe a little runtime improvement when cached in specific circumstances. window_matches_fd() has also been simplified to treat the MMapFileDescrptor * as equivalent to its fd and prot.
Loading
Please register or sign in to comment