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

[Xen-changelog] Simplify code by acking watch as soon as we read it.



# HG changeset patch
# User cl349@xxxxxxxxxxxxxxxxxxxx
# Node ID d24e1970c20542771fc3b359de206f196ec603e0
# Parent  3be03cd7cd4c670655ce086050fba71c0cf6a957
Simplify code by acking watch as soon as we read it.
Since watches no longer block anyone, this doesn't change semantics.
Signed-off-by: Rusty Russel <rusty@xxxxxxxxxxxxxxx>
Signed-off-by: Christian Limpach <Christian.Limpach@xxxxxxxxxxxx>

diff -r 3be03cd7cd4c -r d24e1970c205 
linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
--- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Thu Jul 28 
12:25:13 2005
+++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c       Thu Jul 28 
12:29:23 2005
@@ -479,8 +479,6 @@
        return err;
 }
 
-static struct xenbus_watch *watch_callback;
-
 void unregister_xenbus_watch(struct xenbus_watch *watch)
 {
        char token[sizeof(watch) * 2 + 1];
@@ -492,12 +490,9 @@
        err = xs_unwatch(watch->node, token);
        list_del(&watch->list);
 
-       /* Make sure watch thread knows we unwatched, so don't ack. */
-       if (watch_callback == watch)
-               watch_callback = NULL;
-
        if (err)
-               printk(KERN_WARNING "XENBUS Failed to release watch %s: %i\n",
+               printk(KERN_WARNING
+                      "XENBUS Failed to release watch %s: %i\n",
                       watch->node, err);
 }
 
@@ -521,18 +516,13 @@
                        struct xenbus_watch *w;
                        int err;
 
+                       err = xs_acknowledge_watch(token);
+                       if (err)
+                               printk(KERN_WARNING "XENBUS ack %s fail %i\n",
+                                      node, err);
                        w = find_watch(token);
                        BUG_ON(!w);
-                       watch_callback = w;
                        w->callback(w, node);
-
-                       if (watch_callback) {
-                               err = xs_acknowledge_watch(token);
-                               if (err)
-                                       printk(KERN_WARNING
-                                              "XENBUS ack %s fail %i\n",
-                                              node, err);
-                       }
                        kfree(node);
                } else
                        printk(KERN_WARNING "XENBUS xs_read_watch: %li\n",

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