From owner-freebsd-geom@FreeBSD.ORG Thu Feb 26 12:43:49 2004 Return-Path: Delivered-To: freebsd-geom@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA93C16A4CF; Thu, 26 Feb 2004 12:43:49 -0800 (PST) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3579043D1F; Thu, 26 Feb 2004 12:43:49 -0800 (PST) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i1QKhmNm003154; Thu, 26 Feb 2004 21:43:48 +0100 (CET) (envelope-from phk@phk.freebsd.dk) To: Pawel Jakub Dawidek From: "Poul-Henning Kamp" In-Reply-To: Your message of "Thu, 26 Feb 2004 21:38:07 +0100." <20040226203807.GD5720@darkness.comp.waw.pl> Date: Thu, 26 Feb 2004 21:43:48 +0100 Message-ID: <3153.1077828228@critter.freebsd.dk> cc: freebsd-geom@FreeBSD.org Subject: Re: GEOM stripe library. X-BeenThere: freebsd-geom@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: GEOM-specific discussions and implementations List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Feb 2004 20:43:50 -0000 In message <20040226203807.GD5720@darkness.comp.waw.pl>, Pawel Jakub Dawidek wr ites: >+> And would look like this in C code: >+>=20 >+> struct stripe *sp; >+>=20 >+> sp =3D g_stripe_new(/* consumers */ 3, /* parts */ 3); >+>=20 >+> sp->consumer[0] =3D c0; >+> sp->consumer[1] =3D c1; >+> sp->consumer[2] =3D c2; >+> sp->slicepart[0].stripes =3D 1024; >+> for (i =3D 0; i < 3; i++) { >+> sp->slicepart[0].components[i].offset =3D 1024; >+> sp->slicepart[0].components[i].bite =3D 1024; >+> } >+> sp->slicepart[1].stripes =3D 3072; >+> sp->slicepart[1].components[0].offset =3D -1; /* autocalculate */ >+> sp->slicepart[1].components[0].bite =3D 512; >+> sp->slicepart[1].components[2].offset =3D -1; /* autocalculate */ >+> sp->slicepart[1].components[2].bite =3D 512; >+>=20 >+> sp->slicepart[1].stripes =3D 256; >+> sp->slicepart[1].components[2].offset =3D -1; /* autocalculate */ >+> sp->slicepart[1].components[2].bite =3D 2048; >+>=20 >+> error =3D g_stripe_calculate(sp); >+>=20 >+> Setting offset to -1 means "continue wherever we got to". > >I'm not sure how to comments this, because I think you misunderstand >my model. The beauty of my model is that there is only two function calls doing one memory allocation involved in this, rather than a ton of function calls where you have to check the error code after each and every one. (See my daemon-news "blueprint" articles for more on this). I also think that you should be prepared for non-uniform striping, even if you think it complicates things, because it exits in real life, even if you have not seen it. If you library is insufficiently general, then it will not gain us enough code reuse to be worth the trouble. -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.