From owner-svn-src-head@FreeBSD.ORG Tue Mar 19 14:49:16 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 58C4C898; Tue, 19 Mar 2013 14:49:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 3276EBF4; Tue, 19 Mar 2013 14:49:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.6/8.14.6) with ESMTP id r2JEnGa5023346; Tue, 19 Mar 2013 14:49:16 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.6/8.14.5/Submit) id r2JEnF1m023342; Tue, 19 Mar 2013 14:49:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201303191449.r2JEnF1m023342@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 19 Mar 2013 14:49:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r248516 - head/sys/geom X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Mar 2013 14:49:16 -0000 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);