diff --git a/core/src/dird/ndmp_fhdb_mem.cc b/core/src/dird/ndmp_fhdb_mem.cc index f0e9d15b603..d3f6aa9bff7 100644 --- a/core/src/dird/ndmp_fhdb_mem.cc +++ b/core/src/dird/ndmp_fhdb_mem.cc @@ -111,7 +111,7 @@ struct ooo_metadata { }; typedef struct ooo_metadata OOO_MD; -using MetadataTable = htable; +using MetadataTable = htable; struct fhdb_state_mem { N_TREE_ROOT* fhdb_root; @@ -438,8 +438,7 @@ static inline void add_out_of_order_metadata(NIS* nis, item_size = sizeof(OOO_MD); nr_items = (nr_pages * B_PAGE_SIZE) / item_size; - meta_data - = new MetadataTable(md_entry, &md_entry->link, nr_items, nr_pages); + meta_data = new MetadataTable(md_entry, &md_entry->link, nr_items); ((struct fhdb_state_mem*)nis->fhdb_state)->out_of_order_metadata = meta_data; } diff --git a/core/src/findlib/find.h b/core/src/findlib/find.h index ec640f81eda..c0fb21caf5e 100644 --- a/core/src/findlib/find.h +++ b/core/src/findlib/find.h @@ -186,7 +186,7 @@ struct CurLink { char name[1]; /**< The name */ }; -using LinkHash = htable; +using LinkHash = htable; /** diff --git a/core/src/findlib/hardlink.cc b/core/src/findlib/hardlink.cc index 458051968bd..5c21860b591 100644 --- a/core/src/findlib/hardlink.cc +++ b/core/src/findlib/hardlink.cc @@ -63,7 +63,7 @@ CurLink* new_hardlink(JobControlRecord* jcr, uint8_t* new_key; if (!ff_pkt->linkhash) { - ff_pkt->linkhash = new LinkHash(hl, &hl->link, 10000, 480); + ff_pkt->linkhash = new LinkHash(hl, &hl->link, 10000); } len = strlen(fname) + 1; diff --git a/core/src/lib/htable.h b/core/src/lib/htable.h index 1da525097b8..383d867444f 100644 --- a/core/src/lib/htable.h +++ b/core/src/lib/htable.h @@ -127,13 +127,32 @@ struct htable_binary_key { uint32_t len; }; -template class htable { +enum class htableBufferSize +{ + small, + medium, + large +}; + +template +class htable { std::unique_ptr pimpl; public: htable() { pimpl = std::make_unique(); } - htable(T* item, hlink* link, int tsize = 31, int nr_pages = 0) + htable(T* item, hlink* link, int tsize = 31) { + int nr_pages = 0; + if constexpr (BufferSize == htableBufferSize::large) { + nr_pages = 0; + } else if constexpr (BufferSize == htableBufferSize::medium) { + nr_pages = 512; + } else if constexpr (BufferSize == htableBufferSize::small) { + nr_pages = 1; + } + pimpl = std::make_unique(item, link, tsize, nr_pages); } T* lookup(Key key) diff --git a/core/src/lib/tree.cc b/core/src/lib/tree.cc index d722822b711..972d162650c 100644 --- a/core/src/lib/tree.cc +++ b/core/src/lib/tree.cc @@ -92,7 +92,7 @@ TREE_ROOT* new_tree(int count) root->type = TN_ROOT; root->fname = ""; HL_ENTRY* entry = NULL; - new (&root->hardlinks) HardlinkTable(entry, &entry->link, 0, 1); + new (&root->hardlinks) HardlinkTable(entry, &entry->link); return root; } diff --git a/core/src/lib/tree.h b/core/src/lib/tree.h index f5f03275a59..a72ab79e587 100644 --- a/core/src/lib/tree.h +++ b/core/src/lib/tree.h @@ -108,7 +108,7 @@ struct s_hl_entry { }; typedef struct s_hl_entry HL_ENTRY; -using HardlinkTable = htable; +using HardlinkTable = htable; struct s_tree_root { s_tree_root()