[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fuse-devel
Subject:    Re: [fuse-devel] [PATCH] fuse:push the node_slab into end of page
From:       Miklos Szeredi <miklos () szeredi ! hu>
Date:       2012-03-08 9:26:21
Message-ID: 87sjhjfnpe.fsf () tucsk ! pomaz ! szeredi ! hu
[Download RAW message or body]

wyt <yt0907.wang@gmail.com> writes:

> Hi,every one
>     I changed the place of node_slab in a page, moving it to the end of
> page,according to the Slab
> Allocator(http://www.ezdoum.com/upload/20/20020412235505/bonwick94slab.pdf). 
>

Thanks, but there are several problems with your patch:

 1) it's untested (I can see one bug in there by looking at it)
 3) there's no explanation why this is actually needed
 2) there's whitespace damage
 4) ChangeLog entry is missing

If you correct these I'll consider applying it.

Thanks,
Miklos


> ----------------
> diff --git a/lib/fuse.c b/lib/fuse.c
> index e01f450..537e70a 100644
> --- a/lib/fuse.c
> +++ b/lib/fuse.c
> @@ -364,12 +364,12 @@ static size_t get_node_size(struct fuse *f)
>  #ifdef FUSE_NODE_SLAB
>  static struct node_slab *list_to_slab(struct list_head *head)
>  {
> -       return (struct node_slab *) head;
> +  return list_entry(head,struct node_slab,list);
>  }
>
>  static struct node_slab *node_to_slab(struct fuse *f, struct node *node)
>  {
> -       return (struct node_slab *) (((uintptr_t) node) & ~((uintptr_t)
> f->pagesize - 1));
> +  return (struct node_slab *) (((uintptr_t)node | (f->pagesize - 1)) - 
> sizeof(struct node_slab));
>  }
>
>  static int alloc_slab(struct fuse *f)
> @@ -387,12 +387,12 @@ static int alloc_slab(struct fuse *f)
>         if (mem == MAP_FAILED)
>                 return -1;
>
> -       slab = mem;
> +       slab = mem + f->pagesize - sizeof(struct node_slab);
>         init_list_head(&slab->freelist);
>         slab->used = 0;
>         num = (f->pagesize - sizeof(struct node_slab)) / node_size;
>
> -       start = (char *) mem + f->pagesize - num * node_size;
> +       start = mem;
>         for (i = 0; i < num; i++) {
>                 struct list_head *n;

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
fuse-devel mailing list
fuse-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fuse-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic