From owner-svn-src-projects@FreeBSD.ORG Tue Jan 25 16:56:35 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 3EB6E1065696 for ; Tue, 25 Jan 2011 16:56:35 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-yw0-f54.google.com (mail-yw0-f54.google.com [209.85.213.54]) by mx1.freebsd.org (Postfix) with ESMTP id EA0AC8FC2B for ; Tue, 25 Jan 2011 16:56:34 +0000 (UTC) Received: by ywp6 with SMTP id 6so1878396ywp.13 for ; Tue, 25 Jan 2011 08:56:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=gNCax8cGk6+aWtPipuBvzaAhkP0G7kginw0gRN0u9dw=; b=H9FtUjmQ8fMBdL10+2VV+Wyc4uamOlnbt8xnp0wUth4rkkTePO9Ns1c9oiE4nWmnBq ZZhwrA9e+gHBlMq6wXFuWL+5pAwEQ0bBDEgW8ulStbzGOsJaAa+9qqyvviPhRft+Ek5G 7QYz68hSJsqI4BaPYUwn219Aessc/n8ZKag1Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=h2NOUDH+k5By8mXLpAszM4P+4J48dzEyWZDaepbpXo1GSji7Q85AULavBqADp/wEBS nqfaGPqxsHUJnkv/cBtzDTn/lsgK8TIVjmNZc4HsiGohPg+YAm6bI8oEWacFZLoMh17T WetGgw/WDtxlZYYP5kR075qQq9ex/13SDYwbo= MIME-Version: 1.0 Received: by 10.90.92.13 with SMTP id p13mr49695agb.39.1295973131687; Tue, 25 Jan 2011 08:32:11 -0800 (PST) Sender: asmrookie@gmail.com Received: by 10.236.108.15 with HTTP; Tue, 25 Jan 2011 08:32:11 -0800 (PST) In-Reply-To: <201101251117.49069.jhb@freebsd.org> References: <201101251534.p0PFY7cF039182@svn.freebsd.org> <201101251117.49069.jhb@freebsd.org> Date: Tue, 25 Jan 2011 17:32:11 +0100 X-Google-Sender-Auth: QVp80f-w6XWiMcUSVgr91yw_grw Message-ID: From: Attilio Rao To: John Baldwin Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: svn-src-projects@freebsd.org, Alexander Motin , 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:56:35 -0000 2011/1/25 John Baldwin : > 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: >> =C2=A0 Implement kernel dumping to geom_raid volumes. Dumping mechanism = supports >> =C2=A0 any RAID levels without any additional magic. Dumping to RAID0 an= d RAID1 >> =C2=A0 verified to work right now. >> >> Modified: >> =C2=A0 projects/graid/head/sys/geom/raid/g_raid.c >> =C2=A0 projects/graid/head/sys/geom/raid/g_raid.h >> =C2=A0 projects/graid/head/sys/geom/raid/md_intel.c >> >> Modified: projects/graid/head/sys/geom/raid/g_raid.c >> > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- projects/graid/head/sys/geom/raid/g_raid.c =C2=A0 =C2=A0 =C2=A0 =C2= =A0Tue Jan 25 15:18:10 2011 > (r217827) >> +++ projects/graid/head/sys/geom/raid/g_raid.c =C2=A0 =C2=A0 =C2=A0 =C2= =A0Tue Jan 25 15:34:07 2011 > (r217828) >> @@ -116,8 +116,10 @@ static int g_raid_update_subdisk(struct >> =C2=A0static int g_raid_update_volume(struct g_raid_volume *vol, u_int s= tate); >> =C2=A0static void g_raid_dumpconf(struct sbuf *sb, const char *indent, >> =C2=A0 =C2=A0 =C2=A0struct g_geom *gp, struct g_consumer *cp, struct g_p= rovider *pp); >> +static void g_raid_start(struct bio *bp); >> =C2=A0static void g_raid_start_request(struct bio *bp); >> =C2=A0static void g_raid_disk_done(struct bio *bp); >> +static void g_raid_poll(struct g_raid_softc *sc); >> >> =C2=A0static const char * >> =C2=A0g_raid_disk_state2str(int state) >> @@ -714,6 +716,73 @@ g_raid_unidle(struct g_raid_volume *vol) >> =C2=A0} >> >> =C2=A0static void >> +g_raid_dumpdone(struct bio *bp) >> +{ >> + >> + =C2=A0 =C2=A0 bp->bio_flags |=3D BIO_DONE; >> +} >> + >> +static int >> +g_raid_dump(void *arg, >> + =C2=A0 =C2=A0void *virtual, vm_offset_t physical, off_t offset, size_t= length) >> +{ >> + =C2=A0 =C2=A0 struct g_raid_softc *sc; >> + =C2=A0 =C2=A0 struct g_raid_volume *vol; >> + =C2=A0 =C2=A0 struct bio *bp; >> + >> + =C2=A0 =C2=A0 vol =3D (struct g_raid_volume *)arg; >> + =C2=A0 =C2=A0 sc =3D vol->v_softc; >> + =C2=A0 =C2=A0 G_RAID_DEBUG(3, "Dumping at off %llu len %llu.", >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (long long unsigned)offset, (long long uns= igned)length); >> + >> + =C2=A0 =C2=A0 bp =3D g_alloc_bio(); >> + =C2=A0 =C2=A0 bp->bio_cmd =3D BIO_WRITE; >> + =C2=A0 =C2=A0 bp->bio_done =3D g_raid_dumpdone; >> + =C2=A0 =C2=A0 bp->bio_attribute =3D NULL; >> + =C2=A0 =C2=A0 bp->bio_offset =3D offset; >> + =C2=A0 =C2=A0 bp->bio_length =3D length; >> + =C2=A0 =C2=A0 bp->bio_data =3D virtual; >> + =C2=A0 =C2=A0 bp->bio_to =3D vol->v_provider; >> + >> + =C2=A0 =C2=A0 g_raid_start(bp); >> + >> + =C2=A0 =C2=A0 while (!(bp->bio_flags & BIO_DONE)) { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 G_RAID_DEBUG(4, "Poll..."); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 g_raid_poll(sc); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 DELAY(10); >> + =C2=A0 =C2=A0 } >> + >> + =C2=A0 =C2=A0 G_RAID_DEBUG(3, "Dumping at off %llu len %llu done.", >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 (long long unsigned)offset, (long long uns= igned)length); >> + >> + =C2=A0 =C2=A0 g_destroy_bio(bp); >> + =C2=A0 =C2=A0 return (0); >> +} > > Hmm, so this allocates bio's to make the dump work. =C2=A0I believer othe= r dump > routines in other drivers do not do this, but instead use pre-allocated > commands to schedule dump I/O requests. =C2=A0Would 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? Yes, I'd really support this as well. Having BIOs allocation in progress makes the dumping less robust than it should be (yeah, the discussion is much longer than that, but anyway...). Attilio --=20 Peace can only be achieved by understanding - A. Einstein