From owner-svn-src-projects@FreeBSD.ORG Tue Jan 25 16:18:04 2011 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0E2861065674; Tue, 25 Jan 2011 16:18:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id C06BE8FC1D; Tue, 25 Jan 2011 16:18:03 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 4B0EA46B81; Tue, 25 Jan 2011 11:18:03 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 07FFD8A009; Tue, 25 Jan 2011 11:18:02 -0500 (EST) From: John Baldwin To: Alexander Motin Date: Tue, 25 Jan 2011 11:17:48 -0500 User-Agent: KMail/1.13.5 (FreeBSD/7.4-CBSD-20110107; KDE/4.4.5; amd64; ; ) References: <201101251534.p0PFY7cF039182@svn.freebsd.org> In-Reply-To: <201101251534.p0PFY7cF039182@svn.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201101251117.49069.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Tue, 25 Jan 2011 11:18:02 -0500 (EST) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: svn-src-projects@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r217828 - projects/graid/head/sys/geom/raid X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2011 16:18:04 -0000 On Tuesday, January 25, 2011 10:34:07 am Alexander Motin wrote: > Author: mav > Date: Tue Jan 25 15:34:07 2011 > New Revision: 217828 > URL: http://svn.freebsd.org/changeset/base/217828 > > Log: > Implement kernel dumping to geom_raid volumes. Dumping mechanism supports > any RAID levels without any additional magic. Dumping to RAID0 and RAID1 > verified to work right now. > > Modified: > projects/graid/head/sys/geom/raid/g_raid.c > projects/graid/head/sys/geom/raid/g_raid.h > projects/graid/head/sys/geom/raid/md_intel.c > > Modified: projects/graid/head/sys/geom/raid/g_raid.c > ============================================================================== > --- projects/graid/head/sys/geom/raid/g_raid.c Tue Jan 25 15:18:10 2011 (r217827) > +++ projects/graid/head/sys/geom/raid/g_raid.c Tue Jan 25 15:34:07 2011 (r217828) > @@ -116,8 +116,10 @@ static int g_raid_update_subdisk(struct > static int g_raid_update_volume(struct g_raid_volume *vol, u_int state); > static void g_raid_dumpconf(struct sbuf *sb, const char *indent, > struct g_geom *gp, struct g_consumer *cp, struct g_provider *pp); > +static void g_raid_start(struct bio *bp); > static void g_raid_start_request(struct bio *bp); > static void g_raid_disk_done(struct bio *bp); > +static void g_raid_poll(struct g_raid_softc *sc); > > static const char * > g_raid_disk_state2str(int state) > @@ -714,6 +716,73 @@ g_raid_unidle(struct g_raid_volume *vol) > } > > static void > +g_raid_dumpdone(struct bio *bp) > +{ > + > + bp->bio_flags |= BIO_DONE; > +} > + > +static int > +g_raid_dump(void *arg, > + void *virtual, vm_offset_t physical, off_t offset, size_t length) > +{ > + struct g_raid_softc *sc; > + struct g_raid_volume *vol; > + struct bio *bp; > + > + vol = (struct g_raid_volume *)arg; > + sc = vol->v_softc; > + G_RAID_DEBUG(3, "Dumping at off %llu len %llu.", > + (long long unsigned)offset, (long long unsigned)length); > + > + bp = g_alloc_bio(); > + bp->bio_cmd = BIO_WRITE; > + bp->bio_done = g_raid_dumpdone; > + bp->bio_attribute = NULL; > + bp->bio_offset = offset; > + bp->bio_length = length; > + bp->bio_data = virtual; > + bp->bio_to = vol->v_provider; > + > + g_raid_start(bp); > + > + while (!(bp->bio_flags & BIO_DONE)) { > + G_RAID_DEBUG(4, "Poll..."); > + g_raid_poll(sc); > + DELAY(10); > + } > + > + G_RAID_DEBUG(3, "Dumping at off %llu len %llu done.", > + (long long unsigned)offset, (long long unsigned)length); > + > + g_destroy_bio(bp); > + return (0); > +} Hmm, so this allocates bio's to make the dump work. I believer other dump routines in other drivers do not do this, but instead use pre-allocated commands to schedule dump I/O requests. Would it be possible to pre-allocate the bio that is used here when dumping is enabled and reuse it for each g_raid_dump() call without free'ing it when the I/O is finished? -- John Baldwin