From owner-p4-projects@FreeBSD.ORG Tue Feb 5 13:29:52 2008 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1623216A476; Tue, 5 Feb 2008 13:29:52 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE0A516A524 for ; Tue, 5 Feb 2008 13:29:51 +0000 (UTC) (envelope-from thioretic@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id BADD513C4CE for ; Tue, 5 Feb 2008 13:29:51 +0000 (UTC) (envelope-from thioretic@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id m15DTpoI052739 for ; Tue, 5 Feb 2008 13:29:51 GMT (envelope-from thioretic@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id m15DTp3P052736 for perforce@freebsd.org; Tue, 5 Feb 2008 13:29:51 GMT (envelope-from thioretic@FreeBSD.org) Date: Tue, 5 Feb 2008 13:29:51 GMT Message-Id: <200802051329.m15DTp3P052736@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to thioretic@FreeBSD.org using -f From: Maxim Zhuravlev To: Perforce Change Reviews Cc: Subject: PERFORCE change 134837 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Feb 2008 13:29:52 -0000 http://perforce.freebsd.org/chv.cgi?CH=134837 Change 134837 by thioretic@thioretic on 2008/02/05 13:29:02 Some minor fixes Affected files ... .. //depot/projects/soc2007/thioretic_gidl2/kern/subr_busio.c#7 edit .. //depot/projects/soc2007/thioretic_gidl2/sys/ior_types.h#1 add Differences ... ==== //depot/projects/soc2007/thioretic_gidl2/kern/subr_busio.c#7 (text+ko) ==== @@ -10,6 +10,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_BUS_IO, "bus_io", "Bus io subsystem data structures"); @@ -29,20 +30,7 @@ int work_kthreads_to_wait_on; struct ior { -#define OPEN 1 -#define FDOPEN 2 -#define CLOSE 3 -#define READ 4 -#define WRITE 5 -#define IOCTL 6 -#define POLL 7 -#define MMAP 8 -#define STRATEGY 9 -#define DUMP 10 -#define KQFILTER 11 -#define PURGE 12 -#define SPARE2 13 - u_int32_t type; + u_int32_t type; //see sys/ior_types.h void* data; #define IORS_NONE 0 #define IORS_ENQUEUED 1<<0 @@ -79,7 +67,7 @@ ior_t todo; int flags; - struct mtx guard_spin_mtx; + struct mtx guard_mtx; }; static ior_queue ior_queues[IOR_QUEUES_NUM]; @@ -155,10 +143,10 @@ break; } TAILQ_INSERT_TAIL(&work_kthreads, pwk, link); - }while (work_kthreads_num < ++cur_work_kthreads_num); + }while (work_kthreads_num > ++cur_work_kthreads_num); } else{ - cur_work_kthreads_num = work_kthreads_num; + cur_work_kthreads_num = work_kthreads_num - old_work_kthreads_num; TAILQ_FOREACH(pwk, &work_kthreads, link){ if(cur_work_kthreads_num) cur_work_kthreads_num--; @@ -179,7 +167,7 @@ error = sysctl_handle_int(oidp, &value, sizeof(value), req); if (!error && req->newptr){ if (value > 0){ - old_work_kthreads_num = work_kthreds_num; + old_work_kthreads_num = work_kthreads_num; work_kthreads_num = value; reset_work_kthreads (); }else @@ -199,9 +187,9 @@ for (i = 0; i < IOR_QUEUES_NUM; i++){ ior_queues[i]->iors = TAILQ_HEAD_INITIALIZER(ior_queues[i]->iors); - mtx_init (&ior_queues[i]->guard_spin_mtx, + mtx_init (&ior_queues[i]->guard_mtx, "ior_queue_mtx", - NULL, MTX_SPIN); + NULL, MTX_DEF); } reset_work_kthreads(); @@ -216,23 +204,23 @@ retry: for (qid; qid < IOR_QUEUES_NUM; qid++){ q = ior_queues[qid]; - if (r = q.todo) + if (r = q.todo){ + ior_lock (r); + mtx_lock (&q.guard_mtx); break; + } } if (qid == IOR_QUEUES_NUM) return (1); - ior_lock (r); - mtx_lock_spin(&q.guard_spin_mtx); - if (r->state != IORS_ENQUEUED){ - mtx_unlock_spin (&q.guard_spin_mtx); + mtx_unlock (&q.guard_mtx); ior_unlock (r); goto retry; } q.todo = TAILQ_NEXT(r, link); - mtx_unlock_spin (&q.guard_spin_mtx); + mtx_unlock (&q.guard_mtx); r->state = IORS_OWNED; ior_unlock (r); @@ -386,13 +374,13 @@ return (); } - mtx_lock_spin (&q.guard_spin_mtx); + mtx_lock (&q.guard_mtx); TAILQ_INSERT_TAIL (&q.iors, r, link); if (q.todo == NULL) q.todo = r; - mtx_unlock_spin (&q.guard_spin_mtx); + mtx_unlock (&q.guard_mtx); r->queue_id = queue_id + 1; r->state = IORS_ENQUEUED; @@ -414,18 +402,18 @@ ior_lock (r); - if (r->state != IOR_ENQUEUED || r->children){ + if (r->state != IORS_ENQUEUED || r->children){ ior_unlock (r); return (1); } - mtx_lock_spin (&q.guard_spin_mtx); + mtx_lock (&q.guard_mtx); if (q.todo == r) q.todo = TAILQ_NEXT (r, link); TAILQ_REMOVE (&q.iors, r, link); - mtx_unlock_spin (&q.quard_spin_mtx); + mtx_unlock (&q.quard_mtx); r->state = IORS_NONE;