All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Thibault <samuel.thibault@eu.citrix.com>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH] minios: fix add_id_to_freelist(0)
Date: Fri, 20 Jun 2008 17:35:23 +0100	[thread overview]
Message-ID: <20080620163523.GS4297@implementation.uk.xensource.com> (raw)
In-Reply-To: <20080618112910.GU4247@implementation.uk.xensource.com>

Hello,

Is there anything against that patch?

Samuel

Samuel Thibault, le Wed 18 Jun 2008 12:29:10 +0100, a écrit :
> minios: fix add_id_to_freelist(0)
> 
> add_id_to_freelist(0) would make get_id_from_freelist() always return 0.
> 
> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
> 
> diff -r 78f90b0f707f extras/mini-os/fs-front.c
> --- a/extras/mini-os/fs-front.c	Tue Jun 17 14:45:18 2008 +0100
> +++ b/extras/mini-os/fs-front.c	Wed Jun 18 12:23:59 2008 +0100
> @@ -136,8 +136,8 @@
>  again:    
>      old_id = freelist[0];
>      /* Note: temporal inconsistency, since freelist[0] can be changed by someone
> -     * else, but we are a sole owner of freelist[id], it's OK. */
> -    freelist[id] = old_id;
> +     * else, but we are a sole owner of freelist[id + 1], it's OK. */
> +    freelist[id + 1] = old_id;
>      new_id = id;
>      if(cmpxchg(&freelist[0], old_id, new_id) != old_id)
>      {
> @@ -154,7 +154,7 @@
>  
>  again:    
>      old_id = freelist[0];
> -    new_id = freelist[old_id];
> +    new_id = freelist[old_id + 1];
>      if(cmpxchg(&freelist[0], old_id, new_id) != old_id)
>      {
>          printk("Cmpxchg on freelist remove failed.\n");
> @@ -785,8 +785,8 @@
>      printk("Allocating request array for import %d, nr_entries = %d.\n",
>              import->import_id, import->nr_entries);
>      requests = xmalloc_array(struct fs_request, import->nr_entries);
> -    import->freelist = xmalloc_array(unsigned short, import->nr_entries);
> -    memset(import->freelist, 0, sizeof(unsigned short) * import->nr_entries);
> +    import->freelist = xmalloc_array(unsigned short, import->nr_entries + 1);
> +    memset(import->freelist, 0, sizeof(unsigned short) * (import->nr_entries + 1));
>      for(i=0; i<import->nr_entries; i++)
>      {
>  	/* TODO: that's a lot of memory */
> diff -r 78f90b0f707f extras/mini-os/netfront.c
> --- a/extras/mini-os/netfront.c	Tue Jun 17 14:45:18 2008 +0100
> +++ b/extras/mini-os/netfront.c	Wed Jun 18 12:25:47 2008 +0100
> @@ -38,7 +38,7 @@
>  struct netfront_dev {
>      domid_t dom;
>  
> -    unsigned short tx_freelist[NET_TX_RING_SIZE];
> +    unsigned short tx_freelist[NET_TX_RING_SIZE + 1];
>      struct semaphore tx_sem;
>  
>      struct net_buffer rx_buffers[NET_RX_RING_SIZE];
> @@ -70,14 +70,14 @@
>  
>  static inline void add_id_to_freelist(unsigned int id,unsigned short* freelist)
>  {
> -    freelist[id] = freelist[0];
> +    freelist[id + 1] = freelist[0];
>      freelist[0]  = id;
>  }
>  
>  static inline unsigned short get_id_from_freelist(unsigned short* freelist)
>  {
>      unsigned int id = freelist[0];
> -    freelist[0] = freelist[id];
> +    freelist[0] = freelist[id + 1];
>      return id;
>  }
>  

-- 
Samuel
<P> je sens venir la fonte 14 pour le rapport
 -+- #ens-mim -+-

      reply	other threads:[~2008-06-20 16:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-18 11:29 [PATCH] minios: fix add_id_to_freelist(0) Samuel Thibault
2008-06-20 16:35 ` Samuel Thibault [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080620163523.GS4297@implementation.uk.xensource.com \
    --to=samuel.thibault@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.