From c61e1d6988484a6875f72fcc81e34d5a1c2dccfa Mon Sep 17 00:00:00 2001 From: stas Date: Sun, 28 Jun 2009 21:49:43 +0000 Subject: - Turn the third (islocked) argument of the knote call into flags parameter. Introduce the new flag KNF_NOKQLOCK to allow event callers to be called without KQ_LOCK mtx held. - Modify VFS knote calls to always use KNF_NOKQLOCK flag. This is required for ZFS as its getattr implementation may sleep. Approved by: re (rwatson) Reviewed by: kib MFC after: 2 weeks --- sys/sys/event.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sys/sys/event.h') diff --git a/sys/sys/event.h b/sys/sys/event.h index 824f084..6824152 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -136,8 +136,14 @@ struct knlist { MALLOC_DECLARE(M_KQUEUE); #endif -#define KNOTE(list, hist, lock) knote(list, hist, lock) -#define KNOTE_LOCKED(list, hint) knote(list, hint, 1) +/* + * Flags for knote call + */ +#define KNF_LISTLOCKED 0x0001 /* knlist is locked */ +#define KNF_NOKQLOCK 0x0002 /* do not keep KQ_LOCK */ + +#define KNOTE(list, hist, flags) knote(list, hist, flags) +#define KNOTE_LOCKED(list, hint) knote(list, hint, KNF_LISTLOCKED) #define KNOTE_UNLOCKED(list, hint) knote(list, hint, 0) #define KNLIST_EMPTY(list) SLIST_EMPTY(&(list)->kl_list) @@ -206,7 +212,7 @@ struct proc; struct knlist; struct mtx; -extern void knote(struct knlist *list, long hint, int islocked); +extern void knote(struct knlist *list, long hint, int lockflags); extern void knote_fork(struct knlist *list, int pid); extern void knlist_add(struct knlist *knl, struct knote *kn, int islocked); extern void knlist_remove(struct knlist *knl, struct knote *kn, int islocked); -- cgit v1.1