svn commit: r248516 - head/sys/geom
Konstantin Belousov
kib at FreeBSD.org
Tue Mar 19 14:49:16 UTC 2013
Author: kib
Date: Tue Mar 19 14:49:15 2013
New Revision: 248516
URL: http://svnweb.freebsd.org/changeset/base/248516
Log:
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
Modified:
head/sys/geom/geom_disk.c
head/sys/geom/geom_disk.h
Modified: head/sys/geom/geom_disk.c
==============================================================================
--- head/sys/geom/geom_disk.c Tue Mar 19 14:43:57 2013 (r248515)
+++ head/sys/geom/geom_disk.c Tue Mar 19 14:49:15 2013 (r248516)
@@ -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);
Modified: head/sys/geom/geom_disk.h
==============================================================================
--- head/sys/geom/geom_disk.h Tue Mar 19 14:43:57 2013 (r248515)
+++ head/sys/geom/geom_disk.h Tue Mar 19 14:49:15 2013 (r248516)
@@ -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);
More information about the svn-src-head
mailing list