Browse Source

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.
pull/979/head
Antonio SJ Musumeci 3 years ago
parent
commit
68b3026264
  1. 14
      libfuse/lib/fuse.c

14
libfuse/lib/fuse.c

@ -173,7 +173,6 @@ struct node
struct lock *locks;
uint32_t stat_crc32b;
char inline_name[32];
uint8_t is_hidden:1;
uint8_t is_stat_cache_valid:1;
};
@ -394,7 +393,6 @@ void
free_node(struct fuse *f_,
struct node *node_)
{
if(node_->name != node_->inline_name)
filename_free(f_,node_->name);
if(node_->is_hidden)
@ -611,7 +609,6 @@ unhash_name(struct fuse *f,
*nodep = node->name_next;
node->name_next = NULL;
unref_node(f,node->parent);
if(node->name != node->inline_name)
filename_free(f,node->name);
node->name = NULL;
node->parent = NULL;
@ -675,17 +672,9 @@ hash_name(struct fuse *f,
{
size_t hash = name_hash(f,parentid,name);
struct node *parent = get_node(f,parentid);
if(strlen(name) < sizeof(node->inline_name))
{
strcpy(node->inline_name,name);
node->name = node->inline_name;
}
else
{
node->name = filename_strdup(f,name);
if(node->name == NULL)
return -1;
}
parent->refctr++;
node->parent = parent;
@ -4190,8 +4179,7 @@ fuse_new_common(struct fuse_chan *ch,
goto out_free_id_table;
}
strcpy(root->inline_name,"/");
root->name = root->inline_name;
root->name = filename_strdup(f,"/");
root->parent = NULL;
root->nodeid = FUSE_ROOT_ID;

Loading…
Cancel
Save