WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] Use explicit functions with args instead of work_structs

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] Use explicit functions with args instead of work_structs for callbacks.
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 23 Aug 2005 18:36:14 +0000
Delivery-date: Wed, 24 Aug 2005 09:06:41 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID 2d3a7be68ba35c3278225214a792587b0c2219e0
# Parent  827a3c3524b334406b863acbf03405cec451d1f4
# Parent  f51fe43c5d1c4e456e8dc243e90970e997da78c9
Use explicit functions with args instead of work_structs for callbacks.
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 827a3c3524b3 -r 2d3a7be68ba3 
linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c
--- a/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Mon Aug 22 20:59:00 2005
+++ b/linux-2.6-xen-sparse/arch/xen/kernel/gnttab.c     Tue Aug 23 08:40:50 2005
@@ -69,11 +69,13 @@
 
 static void do_free_callbacks(void)
 {
-    struct gnttab_free_callback *callback = gnttab_free_callback_list;
+    struct gnttab_free_callback *callback = gnttab_free_callback_list, *next;
     gnttab_free_callback_list = NULL;
     while (callback) {
-       schedule_work(callback->work);
-       callback = callback->next;
+       next = callback->next;
+       callback->next = NULL;
+       callback->fn(callback->arg);
+       callback = next;
     }
 }
 
@@ -266,9 +268,12 @@
 
 void
 gnttab_request_free_callback(struct gnttab_free_callback *callback,
-                            struct work_struct *work)
-{
-    callback->work = work;
+                            void (*fn)(void *), void *arg)
+{
+    if (callback->next)
+       return;
+    callback->fn = fn;
+    callback->arg = arg;
     callback->next = gnttab_free_callback_list;
     gnttab_free_callback_list = callback;
 }
diff -r 827a3c3524b3 -r 2d3a7be68ba3 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Mon Aug 22 
20:59:00 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Tue Aug 23 
08:40:50 2005
@@ -157,9 +157,14 @@
 {
        struct blkfront_info *info = (struct blkfront_info *)arg;
        spin_lock_irq(&blkif_io_lock);
-       info->callback.work = NULL;
        kick_pending_request_queues(info);
        spin_unlock_irq(&blkif_io_lock);
+}
+
+static void blkif_restart_queue_callback(void *arg)
+{
+       struct blkfront_info *info = (struct blkfront_info *)arg;
+       schedule_work(&info->work);
 }
 
 int blkif_open(struct inode *inode, struct file *filep)
@@ -239,10 +244,8 @@
 
     if (gnttab_alloc_grant_references(BLKIF_MAX_SEGMENTS_PER_REQUEST,
                                      &gref_head, &gref_terminal) < 0) {
-           if (info->callback.work)
-                   return 1;
-           INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
-           gnttab_request_free_callback(&info->callback, &info->work);
+           gnttab_request_free_callback(&info->callback,
+                                        blkif_restart_queue_callback, info);
            return 1;
     }
 
@@ -1242,6 +1245,7 @@
        info->vdevice = vdevice;
        info->connected = BLKIF_STATE_DISCONNECTED;
        info->mi = NULL;
+       INIT_WORK(&info->work, blkif_restart_queue, (void *)info);
 
        /* Front end dir is a number, which is used as the id. */
        info->handle = simple_strtoul(strrchr(dev->nodename,'/')+1, NULL, 0);
diff -r 827a3c3524b3 -r 2d3a7be68ba3 
linux-2.6-xen-sparse/include/asm-xen/gnttab.h
--- a/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Mon Aug 22 20:59:00 2005
+++ b/linux-2.6-xen-sparse/include/asm-xen/gnttab.h     Tue Aug 23 08:40:50 2005
@@ -25,7 +25,8 @@
 
 struct gnttab_free_callback {
     struct gnttab_free_callback *next;
-    struct work_struct *work;
+    void (*fn)(void *);
+    void *arg;
 };
 
 int
@@ -73,7 +74,7 @@
 
 void
 gnttab_request_free_callback(
-    struct gnttab_free_callback *callback, struct work_struct *work );
+    struct gnttab_free_callback *callback, void (*fn)(void *), void *arg);
 
 void
 gnttab_grant_foreign_access_ref(

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] Use explicit functions with args instead of work_structs for callbacks., Xen patchbot -unstable <=