mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-20 23:16:28 -05:00
Avoid strlen in deferred pathset insertion by pre-caching path hash in pathset.index
This commit is contained in:
parent
6ae014d6ed
commit
2a60279674
1 changed files with 4 additions and 1 deletions
|
|
@ -2737,7 +2737,10 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
* Append the file to the disk list. Hash table insertions into
|
||||
* inodeset, pathset, and stampset are deferred until all records
|
||||
* are parsed to avoid cache thrashing and allow pre-reserving buckets.
|
||||
* Cache the path hash in pathset.index to avoid recomputing strlen
|
||||
* during insertion.
|
||||
*/
|
||||
file->pathset.index = file_path_hash_len(file->sub, sub_len);
|
||||
tommy_list_insert_tail(&disk->filelist, &file->nodelist, file);
|
||||
++disk_file_count[mapping];
|
||||
|
||||
|
|
@ -3950,7 +3953,7 @@ static void state_read_content(struct snapraid_state* state, const char* path, S
|
|||
|
||||
if (file->inode != INODE_INVALID)
|
||||
tommy_hashdyn_insert(&disk->inodeset, &file->nodeset, file, file_inode_hash(file->inode));
|
||||
tommy_hashdyn_insert(&disk->pathset, &file->pathset, file, file_path_hash(file->sub));
|
||||
tommy_hashdyn_insert(&disk->pathset, &file->pathset, file, file->pathset.index);
|
||||
tommy_hashdyn_insert(&disk->stampset, &file->stampset, file, file_stamp_hash(file->size, file->mtime_sec, file->mtime_nsec));
|
||||
|
||||
node = node->next;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue