Deleted Added
full compact
geom_vinum_drive.c (154075) geom_vinum_drive.c (172836)
1/*-
2 * Copyright (c) 2004, 2005 Lukas Ertl
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2004, 2005 Lukas Ertl
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 11 unchanged lines hidden (view full) ---

20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/geom/vinum/geom_vinum_drive.c 154075 2006-01-06 18:03:17Z le $");
28__FBSDID("$FreeBSD: head/sys/geom/vinum/geom_vinum_drive.c 172836 2007-10-20 23:23:23Z julian $");
29
30#include <sys/param.h>
31#include <sys/bio.h>
32#include <sys/errno.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/kthread.h>
36#include <sys/libkern.h>

--- 38 unchanged lines hidden (view full) ---

75 fl->offset = GV_DATA_START;
76 fl->size = d->avail;
77 LIST_INSERT_HEAD(&d->freelist, fl, freelist);
78 d->freelist_entries = 1;
79
80 d->bqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO);
81 bioq_init(d->bqueue);
82 mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
29
30#include <sys/param.h>
31#include <sys/bio.h>
32#include <sys/errno.h>
33#include <sys/conf.h>
34#include <sys/kernel.h>
35#include <sys/kthread.h>
36#include <sys/libkern.h>

--- 38 unchanged lines hidden (view full) ---

75 fl->offset = GV_DATA_START;
76 fl->size = d->avail;
77 LIST_INSERT_HEAD(&d->freelist, fl, freelist);
78 d->freelist_entries = 1;
79
80 d->bqueue = g_malloc(sizeof(struct bio_queue_head), M_WAITOK | M_ZERO);
81 bioq_init(d->bqueue);
82 mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
83 kthread_create(gv_drive_worker, d, NULL, 0, 0, "gv_d %s", d->name);
83 kproc_create(gv_drive_worker, d, NULL, 0, 0, "gv_d %s", d->name);
84 d->flags |= GV_DRIVE_THREAD_ACTIVE;
85}
86
87void
88gv_save_config_all(struct gv_softc *sc)
89{
90 struct gv_drive *d;
91

--- 276 unchanged lines hidden (view full) ---

368 g_std_done(bp);
369 else
370 g_io_deliver(bp, ENXIO);
371 mtx_lock(&d->bqueue_mtx);
372 }
373 mtx_unlock(&d->bqueue_mtx);
374 d->flags |= GV_DRIVE_THREAD_DEAD;
375
84 d->flags |= GV_DRIVE_THREAD_ACTIVE;
85}
86
87void
88gv_save_config_all(struct gv_softc *sc)
89{
90 struct gv_drive *d;
91

--- 276 unchanged lines hidden (view full) ---

368 g_std_done(bp);
369 else
370 g_io_deliver(bp, ENXIO);
371 mtx_lock(&d->bqueue_mtx);
372 }
373 mtx_unlock(&d->bqueue_mtx);
374 d->flags |= GV_DRIVE_THREAD_DEAD;
375
376 kthread_exit(ENXIO);
376 kproc_exit(ENXIO);
377}
378
379
380static void
381gv_drive_orphan(struct g_consumer *cp)
382{
383 struct g_geom *gp;
384 struct gv_drive *d;

--- 119 unchanged lines hidden (view full) ---

504 d->bqueue = g_malloc(sizeof(struct bio_queue_head),
505 M_WAITOK | M_ZERO);
506 bioq_init(d->bqueue);
507 }
508 if (mtx_initialized(&d->bqueue_mtx) == 0)
509 mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
510
511 if (!(d->flags & GV_DRIVE_THREAD_ACTIVE)) {
377}
378
379
380static void
381gv_drive_orphan(struct g_consumer *cp)
382{
383 struct g_geom *gp;
384 struct gv_drive *d;

--- 119 unchanged lines hidden (view full) ---

504 d->bqueue = g_malloc(sizeof(struct bio_queue_head),
505 M_WAITOK | M_ZERO);
506 bioq_init(d->bqueue);
507 }
508 if (mtx_initialized(&d->bqueue_mtx) == 0)
509 mtx_init(&d->bqueue_mtx, "gv_drive", NULL, MTX_DEF);
510
511 if (!(d->flags & GV_DRIVE_THREAD_ACTIVE)) {
512 kthread_create(gv_drive_worker, d, NULL, 0, 0,
512 kproc_create(gv_drive_worker, d, NULL, 0, 0,
513 "gv_d %s", d->name);
514 d->flags |= GV_DRIVE_THREAD_ACTIVE;
515 }
516
517 g_access(cp, -1, 0, 0);
518
519 gp->softc = d;
520 d->geom = gp;

--- 146 unchanged lines hidden ---
513 "gv_d %s", d->name);
514 d->flags |= GV_DRIVE_THREAD_ACTIVE;
515 }
516
517 g_access(cp, -1, 0, 0);
518
519 gp->softc = d;
520 d->geom = gp;

--- 146 unchanged lines hidden ---