mirror of
https://github.com/trapexit/mergerfs.git
synced 2025-03-15 02:35:12 +08:00
Remove embedded name in node struct
The 32 byte array is below the average size so those 32 bytes are wasted a large portion of the time.
This commit is contained in:
parent
810c5a40f7
commit
68b3026264
@ -173,7 +173,6 @@ struct node
|
|||||||
struct lock *locks;
|
struct lock *locks;
|
||||||
|
|
||||||
uint32_t stat_crc32b;
|
uint32_t stat_crc32b;
|
||||||
char inline_name[32];
|
|
||||||
uint8_t is_hidden:1;
|
uint8_t is_hidden:1;
|
||||||
uint8_t is_stat_cache_valid:1;
|
uint8_t is_stat_cache_valid:1;
|
||||||
};
|
};
|
||||||
@ -394,8 +393,7 @@ void
|
|||||||
free_node(struct fuse *f_,
|
free_node(struct fuse *f_,
|
||||||
struct node *node_)
|
struct node *node_)
|
||||||
{
|
{
|
||||||
if(node_->name != node_->inline_name)
|
filename_free(f_,node_->name);
|
||||||
filename_free(f_,node_->name);
|
|
||||||
|
|
||||||
if(node_->is_hidden)
|
if(node_->is_hidden)
|
||||||
fuse_fs_free_hide(f_->fs,node_->hidden_fh);
|
fuse_fs_free_hide(f_->fs,node_->hidden_fh);
|
||||||
@ -611,8 +609,7 @@ unhash_name(struct fuse *f,
|
|||||||
*nodep = node->name_next;
|
*nodep = node->name_next;
|
||||||
node->name_next = NULL;
|
node->name_next = NULL;
|
||||||
unref_node(f,node->parent);
|
unref_node(f,node->parent);
|
||||||
if(node->name != node->inline_name)
|
filename_free(f,node->name);
|
||||||
filename_free(f,node->name);
|
|
||||||
node->name = NULL;
|
node->name = NULL;
|
||||||
node->parent = NULL;
|
node->parent = NULL;
|
||||||
f->name_table.use--;
|
f->name_table.use--;
|
||||||
@ -675,17 +672,9 @@ hash_name(struct fuse *f,
|
|||||||
{
|
{
|
||||||
size_t hash = name_hash(f,parentid,name);
|
size_t hash = name_hash(f,parentid,name);
|
||||||
struct node *parent = get_node(f,parentid);
|
struct node *parent = get_node(f,parentid);
|
||||||
if(strlen(name) < sizeof(node->inline_name))
|
node->name = filename_strdup(f,name);
|
||||||
{
|
if(node->name == NULL)
|
||||||
strcpy(node->inline_name,name);
|
return -1;
|
||||||
node->name = node->inline_name;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
node->name = filename_strdup(f,name);
|
|
||||||
if(node->name == NULL)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
parent->refctr++;
|
parent->refctr++;
|
||||||
node->parent = parent;
|
node->parent = parent;
|
||||||
@ -4190,8 +4179,7 @@ fuse_new_common(struct fuse_chan *ch,
|
|||||||
goto out_free_id_table;
|
goto out_free_id_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(root->inline_name,"/");
|
root->name = filename_strdup(f,"/");
|
||||||
root->name = root->inline_name;
|
|
||||||
|
|
||||||
root->parent = NULL;
|
root->parent = NULL;
|
||||||
root->nodeid = FUSE_ROOT_ID;
|
root->nodeid = FUSE_ROOT_ID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user