ia64/xen-unstable

changeset 5919:d24e1970c205

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@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Thu Jul 28 12:29:23 2005 +0000 (2005-07-28)
parents 3be03cd7cd4c
children e2d635617acd
files linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Jul 28 12:25:13 2005 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/xenbus/xenbus_xs.c	Thu Jul 28 12:29:23 2005 +0000
     1.3 @@ -479,8 +479,6 @@ int register_xenbus_watch(struct xenbus_
     1.4  	return err;
     1.5  }
     1.6  
     1.7 -static struct xenbus_watch *watch_callback;
     1.8 -
     1.9  void unregister_xenbus_watch(struct xenbus_watch *watch)
    1.10  {
    1.11  	char token[sizeof(watch) * 2 + 1];
    1.12 @@ -492,12 +490,9 @@ void unregister_xenbus_watch(struct xenb
    1.13  	err = xs_unwatch(watch->node, token);
    1.14  	list_del(&watch->list);
    1.15  
    1.16 -	/* Make sure watch thread knows we unwatched, so don't ack. */
    1.17 -	if (watch_callback == watch)
    1.18 -		watch_callback = NULL;
    1.19 -
    1.20  	if (err)
    1.21 -		printk(KERN_WARNING "XENBUS Failed to release watch %s: %i\n",
    1.22 +		printk(KERN_WARNING
    1.23 +		       "XENBUS Failed to release watch %s: %i\n",
    1.24  		       watch->node, err);
    1.25  }
    1.26  
    1.27 @@ -521,18 +516,13 @@ static int watch_thread(void *unused)
    1.28  			struct xenbus_watch *w;
    1.29  			int err;
    1.30  
    1.31 +			err = xs_acknowledge_watch(token);
    1.32 +			if (err)
    1.33 +				printk(KERN_WARNING "XENBUS ack %s fail %i\n",
    1.34 +				       node, err);
    1.35  			w = find_watch(token);
    1.36  			BUG_ON(!w);
    1.37 -			watch_callback = w;
    1.38  			w->callback(w, node);
    1.39 -
    1.40 -			if (watch_callback) {
    1.41 -				err = xs_acknowledge_watch(token);
    1.42 -				if (err)
    1.43 -					printk(KERN_WARNING
    1.44 -					       "XENBUS ack %s fail %i\n",
    1.45 -					       node, err);
    1.46 -			}
    1.47  			kfree(node);
    1.48  		} else
    1.49  			printk(KERN_WARNING "XENBUS xs_read_watch: %li\n",