1/*-
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 20 unchanged lines hidden (view full) ---
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/geom/geom_io.c 121323 2003-10-22 06:32:20Z phk $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/malloc.h>
43#include <sys/bio.h>
44
45#include <sys/errno.h>
--- 262 unchanged lines hidden (view full) ---
308g_io_schedule_down(struct thread *tp __unused)
309{
310 struct bio *bp;
311 off_t excess;
312 int error;
313 struct mtx mymutex;
314
315 bzero(&mymutex, sizeof mymutex);
316 mtx_init(&mymutex, "g_xdown", MTX_DEF, 0);
317
318 for(;;) {
319 g_bioq_lock(&g_bio_run_down);
320 bp = g_bioq_first(&g_bio_run_down);
321 if (bp == NULL) {
322 msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock,
323 PRIBIO | PDROP, "-", hz/10);
324 continue;
--- 35 unchanged lines hidden (view full) ---
360
361void
362g_io_schedule_up(struct thread *tp __unused)
363{
364 struct bio *bp;
365 struct mtx mymutex;
366
367 bzero(&mymutex, sizeof mymutex);
368 mtx_init(&mymutex, "g_xup", MTX_DEF, 0);
369 for(;;) {
370 g_bioq_lock(&g_bio_run_up);
371 bp = g_bioq_first(&g_bio_run_up);
372 if (bp != NULL) {
373 g_bioq_unlock(&g_bio_run_up);
374 mtx_lock(&mymutex);
375 biodone(bp);
376 mtx_unlock(&mymutex);
--- 56 unchanged lines hidden ---
2 * Copyright (c) 2002 Poul-Henning Kamp
3 * Copyright (c) 2002 Networks Associates Technology, Inc.
4 * All rights reserved.
5 *
6 * This software was developed for the FreeBSD Project by Poul-Henning Kamp
7 * and NAI Labs, the Security Research Division of Network Associates, Inc.
8 * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the
--- 20 unchanged lines hidden (view full) ---
29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33 * SUCH DAMAGE.
34 */
35
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/sys/geom/geom_io.c 121323 2003-10-22 06:32:20Z phk $");
38
39#include <sys/param.h>
40#include <sys/systm.h>
41#include <sys/kernel.h>
42#include <sys/malloc.h>
43#include <sys/bio.h>
44
45#include <sys/errno.h>
--- 262 unchanged lines hidden (view full) ---
308g_io_schedule_down(struct thread *tp __unused)
309{
310 struct bio *bp;
311 off_t excess;
312 int error;
313 struct mtx mymutex;
314
315 bzero(&mymutex, sizeof mymutex);
316 mtx_init(&mymutex, "g_xdown", MTX_DEF, 0);
317
318 for(;;) {
319 g_bioq_lock(&g_bio_run_down);
320 bp = g_bioq_first(&g_bio_run_down);
321 if (bp == NULL) {
322 msleep(&g_wait_down, &g_bio_run_down.bio_queue_lock,
323 PRIBIO | PDROP, "-", hz/10);
324 continue;
--- 35 unchanged lines hidden (view full) ---
360
361void
362g_io_schedule_up(struct thread *tp __unused)
363{
364 struct bio *bp;
365 struct mtx mymutex;
366
367 bzero(&mymutex, sizeof mymutex);
368 mtx_init(&mymutex, "g_xup", MTX_DEF, 0);
369 for(;;) {
370 g_bioq_lock(&g_bio_run_up);
371 bp = g_bioq_first(&g_bio_run_up);
372 if (bp != NULL) {
373 g_bioq_unlock(&g_bio_run_up);
374 mtx_lock(&mymutex);
375 biodone(bp);
376 mtx_unlock(&mymutex);
--- 56 unchanged lines hidden ---