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

[Xen-changelog] [xen-3.1-testing] [gntdev] Fix multiple-grant mapping logic



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1201516858 0
# Node ID b3a8e5930216668e37f0ec67f6d6242d08930bb2
# Parent  af5e5b1a7c892fadca57fd4634fab6deb8e4d2db
[gntdev] Fix multiple-grant mapping logic
Signed-off-by: Derek Murray <Derek.Murray@xxxxxxxxxxxx>
linux-2.6.18-xen changeset:   399:6157dbf408cf9c50a658eb9fdacfc78ca72bd06a
linux-2.6.18-xen date:        Mon Jan 28 10:29:58 2008 +0000
---
 linux-2.6-xen-sparse/drivers/xen/gntdev/gntdev.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff -r af5e5b1a7c89 -r b3a8e5930216 
linux-2.6-xen-sparse/drivers/xen/gntdev/gntdev.c
--- a/linux-2.6-xen-sparse/drivers/xen/gntdev/gntdev.c  Mon Jan 28 10:37:48 
2008 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/gntdev/gntdev.c  Mon Jan 28 10:40:58 
2008 +0000
@@ -215,6 +215,8 @@ static int add_grant_reference(struct fi
        }
 
        slot_index = private_data->free_list[--private_data->free_list_size];
+       private_data->free_list[private_data->free_list_size]
+               = GNTDEV_FREE_LIST_INVALID;
 
        /* Copy the grant information into file's private data. */
        private_data->grants[slot_index].state = GNTDEV_SLOT_NOT_YET_MAPPED;
@@ -271,13 +273,19 @@ static void compress_free_list(struct fi
 {
        gntdev_file_private_data_t *private_data 
                = (gntdev_file_private_data_t *) flip->private_data;
-       int i, j = 0, old_size;
+       int i, j = 0, old_size, slot_index;
        
        old_size = private_data->free_list_size;
        for (i = 0; i < old_size; ++i) {
                if (private_data->free_list[i] != GNTDEV_FREE_LIST_INVALID) {
-                       private_data->free_list[j] = 
-                               private_data->free_list[i];
+                       if (i > j) {
+                               slot_index = private_data->free_list[i];
+                               private_data->free_list[j] = slot_index;
+                               private_data->grants[slot_index].u
+                                       .free_list_index = j;
+                               private_data->free_list[i] 
+                                       = GNTDEV_FREE_LIST_INVALID;
+                       }
                        ++j;
                } else {
                        --private_data->free_list_size;
@@ -908,7 +916,6 @@ static long gntdev_ioctl(struct file *fl
                                start_index + i;
                        ++private_data->free_list_size;
                }
-               compress_free_list(flip);
 
        unmap_out:
                up_write(&private_data->grants_sem);

_______________________________________________
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®.