mirror of
https://github.com/mhx/dwarfs.git
synced 2025-08-04 02:06:22 -04:00
Evict compressed metadata from cache
This is usually what you want. If you're looking to *rapidly* unmount, then mount the filesystem again, compressed metadata isn't for you anyway.
This commit is contained in:
parent
70c2a97fdd
commit
c8e988c34e
@ -159,11 +159,13 @@ make_metadata(logger& lgr, std::shared_ptr<mmif> mm,
|
||||
throw std::runtime_error("no metadata found");
|
||||
}
|
||||
|
||||
auto meta_section =
|
||||
get_section_data(mm, meta_it->second, meta_buffer, force_buffers);
|
||||
auto& meta_section = meta_it->second;
|
||||
|
||||
auto meta_section_range =
|
||||
get_section_data(mm, meta_section, meta_buffer, force_buffers);
|
||||
|
||||
if (lock_mode != mlock_mode::NONE) {
|
||||
if (auto ec = mm->lock(meta_it->second.start, meta_section.size())) {
|
||||
if (auto ec = mm->lock(meta_section.start, meta_section_range.size())) {
|
||||
if (lock_mode == mlock_mode::MUST) {
|
||||
throw boost::system::system_error(ec, "mlock");
|
||||
} else {
|
||||
@ -172,10 +174,17 @@ make_metadata(logger& lgr, std::shared_ptr<mmif> mm,
|
||||
}
|
||||
}
|
||||
|
||||
// don't keep the compressed metadata in cache
|
||||
if (meta_section.header.compression != compression_type::NONE) {
|
||||
if (auto ec = mm->release(meta_section.start, meta_section.header.length)) {
|
||||
log.info() << "madvise() failed: " << ec.message();
|
||||
}
|
||||
}
|
||||
|
||||
return metadata_v2(
|
||||
lgr,
|
||||
get_section_data(mm, schema_it->second, schema_buffer, force_buffers),
|
||||
meta_section, options, stat_defaults, inode_offset);
|
||||
meta_section_range, options, stat_defaults, inode_offset);
|
||||
}
|
||||
|
||||
template <typename LoggerPolicy>
|
||||
|
Loading…
x
Reference in New Issue
Block a user