From fdff523325bf49dc1cb9b62787dcf4ae22898d0f Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Tue, 14 Aug 2012 12:16:00 +0200 Subject: [PATCH] Zero out node when allocating from a slab. Fix compile warning when not using node slab. --- lib/fuse.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/fuse.c b/lib/fuse.c index f801f84..49d69db 100644 --- a/lib/fuse.c +++ b/lib/fuse.c @@ -325,12 +325,12 @@ static void list_add(struct list_head *new, struct list_head *prev, prev->next = new; } -static void list_add_head(struct list_head *new, struct list_head *head) +static inline void list_add_head(struct list_head *new, struct list_head *head) { list_add(new, head, head->next); } -static void list_add_tail(struct list_head *new, struct list_head *head) +static inline void list_add_tail(struct list_head *new, struct list_head *head) { list_add(new, head->prev, head); } @@ -423,6 +423,7 @@ static struct node *alloc_node(struct fuse *f) list_del(&slab->list); list_add_tail(&slab->list, &f->full_slabs); } + memset(node, 0, sizeof(struct node)); return (struct node *) node; } @@ -838,13 +839,8 @@ static struct node *find_node(struct fuse *f, fuse_ino_t parent, if (node == NULL) goto out_err; - node->refctr = 0; node->nodeid = next_id(f); node->generation = f->generation; - node->open_count = 0; - node->is_hidden = 0; - node->treelock = 0; - node->ticket = 0; if (f->conf.remember) inc_nlookup(node); @@ -4661,9 +4657,7 @@ struct fuse *fuse_new_common(struct fuse_chan *ch, struct fuse_args *args, root->parent = NULL; root->nodeid = FUSE_ROOT_ID; - root->generation = 0; - root->refctr = 1; - root->nlookup = 1; + inc_nlookup(root); hash_id(f, root); return f; -- 2.11.4.GIT