add policy cache for 'open'

A fusepath -> basepath cache for `open` to limit the overhead of FUSE in 'open, read/write, close' patterns (such as Transmission).
This commit is contained in:
Antonio SJ Musumeci 2019-01-06 12:52:55 -05:00
parent 8e0aa1d9a6
commit 7a057daa0c
44 changed files with 858 additions and 649 deletions

View file

@ -14,17 +14,21 @@
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <fuse.h>
#include "config.hpp"
#include "dirinfo.hpp"
static
int
_releasedir(DirInfo *di)
{
delete di;
#include <fuse.h>
return 0;
namespace local
{
static
int
releasedir(DirInfo *di_)
{
delete di_;
return 0;
}
}
namespace mergerfs
@ -32,12 +36,15 @@ namespace mergerfs
namespace fuse
{
int
releasedir(const char *fusepath,
fuse_file_info *ffi)
releasedir(const char *fusepath_,
fuse_file_info *ffi_)
{
DirInfo *di = reinterpret_cast<DirInfo*>(ffi->fh);
const Config &config = Config::get();
DirInfo *di = reinterpret_cast<DirInfo*>(ffi_->fh);
return ::_releasedir(di);
config.open_cache.cleanup(10);
return local::releasedir(di);
}
}
}