aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2004-08-04 21:35:05 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2004-08-04 21:35:05 +0000
commit51385a3c0085796ea4b8d6883c03e0735be207b6 (patch)
treec0a8d5c029b11ea1effeb49bac7f946df7e11fc7 /sys
parent29fe871daef9267c2b84fef43ed30893925adc67 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/geom/mirror/g_mirror.c12
-rw-r--r--sys/geom/mirror/g_mirror.h3
-rw-r--r--sys/sys/bio.h32
3 files changed, 25 insertions, 22 deletions
diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c
index ffc067ccc299..137b041d0c5c 100644
--- a/sys/geom/mirror/g_mirror.c
+++ b/sys/geom/mirror/g_mirror.c
@@ -752,7 +752,7 @@ g_mirror_done(struct bio *bp)
struct g_mirror_softc *sc;
sc = bp->bio_from->geom->softc;
- bp->bio_flags = BIO_FLAG1;
+ bp->bio_cflags |= G_MIRROR_BIO_FLAG_REGULAR;
mtx_lock(&sc->sc_queue_mtx);
bioq_disksort(&sc->sc_queue, bp);
wakeup(sc);
@@ -853,7 +853,7 @@ g_mirror_sync_done(struct bio *bp)
G_MIRROR_LOGREQ(3, bp, "Synchronization request delivered.");
sc = bp->bio_from->geom->softc;
- bp->bio_flags = BIO_FLAG2;
+ bp->bio_cflags |= G_MIRROR_BIO_FLAG_SYNC;
mtx_lock(&sc->sc_queue_mtx);
bioq_disksort(&sc->sc_queue, bp);
wakeup(sc);
@@ -914,7 +914,7 @@ g_mirror_sync_one(struct g_mirror_disk *disk)
bp->bio_offset = disk->d_sync.ds_offset;
bp->bio_length = MIN(sc->sc_sync.ds_block,
sc->sc_mediasize - bp->bio_offset);
- bp->bio_flags = 0;
+ bp->bio_cflags = 0;
bp->bio_done = g_mirror_sync_done;
bp->bio_data = uma_zalloc(sc->sc_sync.ds_zone, M_NOWAIT | M_ZERO);
if (bp->bio_data == NULL) {
@@ -961,7 +961,7 @@ g_mirror_sync_request(struct bio *bp)
return;
}
bp->bio_cmd = BIO_WRITE;
- bp->bio_flags = 0;
+ bp->bio_cflags = 0;
G_MIRROR_LOGREQ(3, bp, "Synchronization request finished.");
cp = disk->d_consumer;
KASSERT(cp->acr == 0 && cp->acw == 1 && cp->ace == 1,
@@ -1423,9 +1423,9 @@ end:
bioq_remove(&sc->sc_queue, bp);
mtx_unlock(&sc->sc_queue_mtx);
- if ((bp->bio_flags & BIO_FLAG1) != 0) {
+ if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_REGULAR) != 0) {
g_mirror_regular_request(bp);
- } else if ((bp->bio_flags & BIO_FLAG2) != 0) {
+ } else if ((bp->bio_cflags & G_MIRROR_BIO_FLAG_SYNC) != 0) {
u_int timeout, sps;
g_mirror_sync_request(bp);
diff --git a/sys/geom/mirror/g_mirror.h b/sys/geom/mirror/g_mirror.h
index 110a9f51182b..5be5cdada810 100644
--- a/sys/geom/mirror/g_mirror.h
+++ b/sys/geom/mirror/g_mirror.h
@@ -83,6 +83,9 @@ extern u_int g_mirror_debug;
} \
} while (0)
+#define G_MIRROR_BIO_FLAG_REGULAR 0x01
+#define G_MIRROR_BIO_FLAG_SYNC 0x02
+
/*
* Informations needed for synchronization.
*/
diff --git a/sys/sys/bio.h b/sys/sys/bio.h
index be9b20e02053..33ae4e7a376f 100644
--- a/sys/sys/bio.h
+++ b/sys/sys/bio.h
@@ -49,20 +49,22 @@ typedef void bio_task_t(void *);
* The bio structure describes an I/O operation in the kernel.
*/
struct bio {
- u_int bio_cmd; /* I/O operation. */
+ uint8_t bio_cmd; /* I/O operation. */
+ uint8_t bio_flags; /* General flags. */
+ uint8_t bio_cflags; /* Private use by the consumer. */
+ uint8_t bio_pflags; /* Private use by the provider. */
struct cdev *bio_dev; /* Device to do I/O on. */
struct disk *bio_disk; /* Valid below geom_disk.c only */
off_t bio_offset; /* Offset into file. */
long bio_bcount; /* Valid bytes in buffer. */
caddr_t bio_data; /* Memory, superblocks, indirect etc. */
- u_int bio_flags; /* BIO_ flags. */
int bio_error; /* Errno for BIO_ERROR. */
long bio_resid; /* Remaining I/0 in bytes. */
void (*bio_done)(struct bio *);
- void *bio_driver1; /* Private use by the callee. */
- void *bio_driver2; /* Private use by the callee. */
- void *bio_caller1; /* Private use by the caller. */
- void *bio_caller2; /* Private use by the caller. */
+ void *bio_driver1; /* Private use by the provider. */
+ void *bio_driver2; /* Private use by the provider. */
+ void *bio_caller1; /* Private use by the consumer. */
+ void *bio_caller2; /* Private use by the consumer. */
TAILQ_ENTRY(bio) bio_queue; /* Disksort queue. */
const char *bio_attribute; /* Attribute for BIO_[GS]ETATTR */
struct g_consumer *bio_from; /* GEOM linkage */
@@ -82,18 +84,16 @@ struct bio {
};
/* bio_cmd */
-#define BIO_READ 0x00000001
-#define BIO_WRITE 0x00000002
-#define BIO_DELETE 0x00000004
-#define BIO_GETATTR 0x00000008
-#define BIO_CMD1 0x40000000 /* Available for local hacks */
-#define BIO_CMD2 0x80000000 /* Available for local hacks */
+#define BIO_READ 0x01
+#define BIO_WRITE 0x02
+#define BIO_DELETE 0x04
+#define BIO_GETATTR 0x08
+#define BIO_CMD1 0x40 /* Available for local hacks */
+#define BIO_CMD2 0x80 /* Available for local hacks */
/* bio_flags */
-#define BIO_ERROR 0x00000001
-#define BIO_DONE 0x00000004
-#define BIO_FLAG2 0x40000000 /* Available for local hacks */
-#define BIO_FLAG1 0x80000000 /* Available for local hacks */
+#define BIO_ERROR 0x01
+#define BIO_DONE 0x02
#ifdef _KERNEL