diff options
author | kib <kib@FreeBSD.org> | 2013-03-19 14:49:15 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-03-19 14:49:15 +0000 |
commit | aa960ab755489174169b69f3ca850a2e6e544350 (patch) | |
tree | 2fe5aeac51b09599dac0eb407222b067b96f3db5 /sys/geom | |
parent | e5332ab95582db8a564780b7e76fea59e30335a1 (diff) | |
download | FreeBSD-src-aa960ab755489174169b69f3ca850a2e6e544350.zip FreeBSD-src-aa960ab755489174169b69f3ca850a2e6e544350.tar.gz |
A flag for the geom disk driver to indicate that it accepts the
unmapped i/o requests.
Sponsored by: The FreeBSD Foundation
Tested by: pho
Diffstat (limited to 'sys/geom')
-rw-r--r-- | sys/geom/geom_disk.c | 20 | ||||
-rw-r--r-- | sys/geom/geom_disk.h | 1 |
2 files changed, 20 insertions, 1 deletions
diff --git a/sys/geom/geom_disk.c b/sys/geom/geom_disk.c index 72e9162..7fec9da 100644 --- a/sys/geom/geom_disk.c +++ b/sys/geom/geom_disk.c @@ -320,13 +320,29 @@ g_disk_start(struct bio *bp) do { bp2->bio_offset += off; bp2->bio_length -= off; - bp2->bio_data += off; + if ((bp->bio_flags & BIO_UNMAPPED) == 0) { + bp2->bio_data += off; + } else { + KASSERT((dp->d_flags & DISKFLAG_UNMAPPED_BIO) + != 0, + ("unmapped bio not supported by disk %s", + dp->d_name)); + bp2->bio_ma += off / PAGE_SIZE; + bp2->bio_ma_offset += off; + bp2->bio_ma_offset %= PAGE_SIZE; + bp2->bio_ma_n -= off / PAGE_SIZE; + } if (bp2->bio_length > dp->d_maxsize) { /* * XXX: If we have a stripesize we should really * use it here. */ bp2->bio_length = dp->d_maxsize; + if ((bp->bio_flags & BIO_UNMAPPED) != 0) { + bp2->bio_ma_n = howmany( + bp2->bio_ma_offset + + bp2->bio_length, PAGE_SIZE); + } off += dp->d_maxsize; /* * To avoid a race, we need to grab the next bio @@ -488,6 +504,8 @@ g_disk_create(void *arg, int flag) pp->sectorsize = dp->d_sectorsize; pp->stripeoffset = dp->d_stripeoffset; pp->stripesize = dp->d_stripesize; + if ((dp->d_flags & DISKFLAG_UNMAPPED_BIO) != 0) + pp->flags |= G_PF_ACCEPT_UNMAPPED; if (bootverbose) printf("GEOM: new disk %s\n", gp->name); sysctl_ctx_init(&sc->sysctl_ctx); diff --git a/sys/geom/geom_disk.h b/sys/geom/geom_disk.h index 33d8eb2..246fc49 100644 --- a/sys/geom/geom_disk.h +++ b/sys/geom/geom_disk.h @@ -103,6 +103,7 @@ struct disk { #define DISKFLAG_OPEN 0x2 #define DISKFLAG_CANDELETE 0x4 #define DISKFLAG_CANFLUSHCACHE 0x8 +#define DISKFLAG_UNMAPPED_BIO 0x10 struct disk *disk_alloc(void); void disk_create(struct disk *disk, int version); |