Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Jan 2011 17:32:11 +0100
From:      Attilio Rao <attilio@freebsd.org>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-projects@freebsd.org, Alexander Motin <mav@freebsd.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r217828 - projects/graid/head/sys/geom/raid
Message-ID:  <AANLkTinwLOqrLjwZOQ-y3__KUy_TMq=3LJw2Nh=Zu7fC@mail.gmail.com>
In-Reply-To: <201101251117.49069.jhb@freebsd.org>
References:  <201101251534.p0PFY7cF039182@svn.freebsd.org> <201101251117.49069.jhb@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2011/1/25 John Baldwin <jhb@freebsd.org>:
> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AANLkTinwLOqrLjwZOQ-y3__KUy_TMq=3LJw2Nh=Zu7fC>