X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;ds=sidebyside;f=libcfs%2Finclude%2Flibcfs%2Flibcfs_workitem.h;h=84da4d98591ee1ca16fcedacdffa5f5800c4ecba;hb=1658ae30a0e97e7f4018d8cba67e459078470d1a;hp=29bbd6d03bbb54161b8f8691864fb37fcae5063b;hpb=e3a7c58aebafce40323db54bf6056029e5af4a70;p=fs%2Flustre-release.git diff --git a/libcfs/include/libcfs/libcfs_workitem.h b/libcfs/include/libcfs/libcfs_workitem.h index 29bbd6d..84da4d9 100644 --- a/libcfs/include/libcfs/libcfs_workitem.h +++ b/libcfs/include/libcfs/libcfs_workitem.h @@ -15,17 +15,15 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. + * + * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -62,55 +60,48 @@ #ifndef __LIBCFS_WORKITEM_H__ #define __LIBCFS_WORKITEM_H__ +struct cfs_wi_sched; + +void cfs_wi_sched_destroy(struct cfs_wi_sched *); +int cfs_wi_sched_create(char *name, struct cfs_cpt_table *cptab, int cpt, + int nthrs, struct cfs_wi_sched **); + struct cfs_workitem; typedef int (*cfs_wi_action_t) (struct cfs_workitem *); -typedef struct cfs_workitem { - /** chain on runq or rerunq */ - cfs_list_t wi_list; - /** working function */ - cfs_wi_action_t wi_action; - /** arg for working function */ - void *wi_data; - /** scheduler id, can be negative */ - short wi_sched_id; - /** in running */ - unsigned short wi_running:1; - /** scheduled */ - unsigned short wi_scheduled:1; -} cfs_workitem_t; -/** - * positive values are reserved as CPU id of future implementation of - * per-cpu scheduler, so user can "bind" workitem on specific CPU. - */ -#define CFS_WI_SCHED_ANY (-1) -#define CFS_WI_SCHED_SERIAL (-2) +struct cfs_workitem { + /** chain on runq or rerunq */ + struct list_head wi_list; + /** working function */ + cfs_wi_action_t wi_action; + /** arg for working function */ + void *wi_data; + /** in running */ + unsigned short wi_running:1; + /** scheduled */ + unsigned short wi_scheduled:1; +}; static inline void -cfs_wi_init(cfs_workitem_t *wi, void *data, - cfs_wi_action_t action, short sched_id) +cfs_wi_init(struct cfs_workitem *wi, void *data, cfs_wi_action_t action) { - CFS_INIT_LIST_HEAD(&wi->wi_list); + INIT_LIST_HEAD(&wi->wi_list); - wi->wi_sched_id = sched_id; - wi->wi_running = 0; - wi->wi_scheduled = 0; - wi->wi_data = data; - wi->wi_action = action; + wi->wi_running = 0; + wi->wi_scheduled = 0; + wi->wi_data = data; + wi->wi_action = action; } -void cfs_wi_exit(cfs_workitem_t *wi); -int cfs_wi_cancel(cfs_workitem_t *wi); -void cfs_wi_schedule(cfs_workitem_t *wi); +void cfs_wi_schedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi); +int cfs_wi_deschedule(struct cfs_wi_sched *sched, struct cfs_workitem *wi); +void cfs_wi_exit(struct cfs_wi_sched *sched, struct cfs_workitem *wi); + int cfs_wi_startup(void); void cfs_wi_shutdown(void); -#ifdef __KERNEL__ /** # workitem scheduler loops before reschedule */ #define CFS_WI_RESCHED 128 -#else -int cfs_wi_check_events(void); -#endif #endif /* __LIBCFS_WORKITEM_H__ */