[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Use explicit functions with args instead of work_structs for callbacks.
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |