[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] fs-backend: Fix freelist implementation



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1216141171 -3600
# Node ID 5f529c74a71250cdffd7cd97cb21f14691c00f69
# Parent  b38bceff087af4573dfaf5bb6dad7ac1cfa36148
fs-backend: Fix freelist implementation

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
---
 tools/fs-back/fs-backend.c |    4 ++--
 tools/fs-back/fs-backend.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff -r b38bceff087a -r 5f529c74a712 tools/fs-back/fs-backend.c
--- a/tools/fs-back/fs-backend.c        Tue Jul 15 17:58:39 2008 +0100
+++ b/tools/fs-back/fs-backend.c        Tue Jul 15 17:59:31 2008 +0100
@@ -110,9 +110,9 @@ void allocate_request_array(struct mount
     unsigned short *freelist;
     
     requests = malloc(sizeof(struct fs_request) *nr_entries);
-    freelist = malloc(sizeof(unsigned short) * nr_entries); 
+    freelist = malloc(sizeof(unsigned short) * (nr_entries + 1)); 
     memset(requests, 0, sizeof(struct fs_request) * nr_entries);
-    memset(freelist, 0, sizeof(unsigned short) * nr_entries);
+    memset(freelist, 0, sizeof(unsigned short) * (nr_entries + 1));
     for(i=0; i< nr_entries; i++)
     {
         requests[i].active = 0; 
diff -r b38bceff087a -r 5f529c74a712 tools/fs-back/fs-backend.h
--- a/tools/fs-back/fs-backend.h        Tue Jul 15 17:58:39 2008 +0100
+++ b/tools/fs-back/fs-backend.h        Tue Jul 15 17:59:31 2008 +0100
@@ -72,14 +72,14 @@ extern struct fs_op *fsops[];
 
 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;
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.