Date: Thu, 26 Feb 2004 21:43:48 +0100 From: "Poul-Henning Kamp" <phk@phk.freebsd.dk> To: Pawel Jakub Dawidek <pjd@FreeBSD.org> Cc: freebsd-geom@FreeBSD.org Subject: Re: GEOM stripe library. Message-ID: <3153.1077828228@critter.freebsd.dk> In-Reply-To: Your message of "Thu, 26 Feb 2004 21:38:07 %2B0100." <20040226203807.GD5720@darkness.comp.waw.pl>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3153.1077828228>