Article View: muc.lists.freebsd.hackers
Article #32Re: FemtoFS
From: Adrian Chadd
Date: Thu, 15 Oct 2026 21:22
Date: Thu, 15 Oct 2026 21:22
118 lines
10689 bytes
10689 bytes
--0000000000002aaaed065de7a7a2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, 14 Oct 2026 at 23:56, Andrea Cocito <andrea@cocito.eu> wrote: > Hello, > > As a weekend project I am working on a small filesystem. > > The idea is to have a read-only filesystem focused at efficiency useable > for =E2=80=9Cfirmare images=E2=80=9D or projects like NanoBSD or mfsBSD, = where using a full > UFS image is a waste of space and resources. > > I am at a point where I have it more or less working (see git@github.com:= puffetto/FemtoFS.git > / https://github.com/puffetto/FemtoFS.git ); but need advice and a second > opinion about a design issue. > > Currently the code, when mounting an image off md(4), duplicates the whol= e > memory area to have a private copy. > > To avoid this I see two options: > > a. Add two hooks in md(4): md_image_hold(*consumer, **address, *size) and > md_image_release(*consumer) which basically tell md(4): =E2=80=9CThis ima= ge is now > locked for my use, don=E2=80=99t touch it=E2=80=9D and =E2=80=9CHere is i= t, it's back yours=E2=80=9D. > > b. Implement a separate (and simplified) =E2=80=9Crmd=E2=80=9D driver whi= ch exposes those > two hooks in a simplified =E2=80=9Cmd=E2=80=9D provider. > > I think that option =E2=80=98a.=E2=80=99 is cleaner, but I wonder if/when= a small patch > providing those hooks would ever make it into the FreeBSD tree. > Oh, interesting. You're not accessing the backing device via bio calls. Your code treats the filesystem as one big chunk of memory. I think that's the big disconnect here - md doesn't expose the memory region as a single huge region. It would change your filesystem to be quite a bit more complicated because your code would have to grow bio and sleep/wakeup code. > Opinions? > > While here if anyone wants to take a look at the specification and code > and report me any issue, mistake or bug they find it would be great. A lo= t > of work, admittedly, was done by Codex. > It definitely needs a bunch of cleanup work and layout work but i mean, if it works it works! It's a good starting point, and I think the first filesystem I've seen written for FreeBSD in a while now. :-) -adrian --0000000000002aaaed065de7a7a2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote g= mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Wed, 14 Oct = 2026 at 23:56, Andrea Cocito <<a href=3D"mailto:andrea@cocito.eu">andrea= @cocito.eu</a>> wrote:<br></div><blockquote class=3D"gmail_quote" style= =3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding= -left:1ex"><div>Hello,<div><br></div><div>As a weekend project I am working= on a small filesystem.=C2=A0</div><div><br></div><div>The idea is to have = a read-only filesystem focused at efficiency useable for =E2=80=9Cfirmare i= mages=E2=80=9D or projects like NanoBSD or mfsBSD, where using a full UFS i= mage is a waste of space and resources.</div><div><br></div><div>I am at a = point where I have it more or less working (see git@github.com:puffetto/Fem= toFS.git / <a href=3D"https://github.com/puffetto/FemtoFS.git" target=3D"_b= lank">https://github.com/puffetto/FemtoFS.git</a> ); but need advice and a = second opinion about a design issue.</div><div><br></div><div>Currently the= code, when mounting an image off md(4), duplicates the whole memory area t= o have a private copy.</div><div><br></div><div>To avoid this I see two opt= ions:</div><div><br></div><div>a. Add two hooks in md(4): md_image_hold(*co= nsumer, **address, *size) and md_image_release(*consumer) which basically t= ell md(4): =E2=80=9CThis image is now locked for my use, don=E2=80=99t touc= h it=E2=80=9D and =E2=80=9CHere is it, it's back yours=E2=80=9D.</div><= div><br></div><div>b. Implement a separate (and simplified) =E2=80=9Crmd=E2= =80=9D driver which exposes those two hooks in a simplified =E2=80=9Cmd=E2= =80=9D provider.</div><div><br></div><div>I think that option =E2=80=98a.= =E2=80=99 is cleaner, but I wonder if/when a small patch providing those ho= oks would ever make it into the FreeBSD tree.=C2=A0</div></div></blockquote= ><div><br></div><div>Oh, interesting. You're not accessing the backing = device via bio calls. Your code treats the filesystem as one big chunk of m= emory.</div><div>I think that's the big disconnect here - md doesn'= t expose the memory region as a single huge region.</div><div><br></div><di= v>It would change your filesystem to be quite a bit more complicated becaus= e your code would have to grow bio and sleep/wakeup code.</div><div><br></d= iv><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bord= er-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div><d= iv>Opinions?</div><div><br></div><div>While here if anyone wants to take a = look at the specification and code and report me any issue, mistake or bug = they find it would be great. A lot of work, admittedly, was done by Codex.<= /div></div></blockquote><div><br></div><div>It definitely needs a bunch of = cleanup work and layout work but i mean, if it works it works! It's a g= ood starting point, and I think the first filesystem I've seen written = for FreeBSD in a while now. :-)</div><div><br></div><div><br></div><div><br= ></div><div>-adrian</div><div><br></div></div></div> --0000000000002aaaed065de7a7a2-- -- Posted automagically by a mail2news gateway at muc.de e.V. Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID:
<CAJ-Vmomx6p7y6e2CeXaniYuz=ar74q5q2Ao2Zkk2zris3HG_+w@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mailReferences:
<A0D65A6D-110F-47C0-B36F-DC03CA2E632A@cocito.eu>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Adrian Chadd <adrian@freebsd.org>
Newsgroups: muc.lists.freebsd.hackers
Subject: Re: FemtoFS
Date: Thu, 15 Oct 2026 14:22:52 -0700
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-hackers@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAJ-Vmomx6p7y6e2CeXaniYuz=ar74q5q2Ao2Zkk2zris3HG_+w@mail.gmail.com>
References: <A0D65A6D-110F-47C0-B36F-DC03CA2E632A@cocito.eu>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="0000000000002aaaed065de7a7a2"
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
logging-data="89147"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
t=1792099387; h=from:from:sender:sender:reply-to:subject:subject:date:date:
message-id:message-id:to:to:cc:cc:mime-version:mime-version:
content-type:content-type:in-reply-to:in-reply-to:
references:references:list-id:list-help:list-owner:list-unsubscribe:
list-subscribe:list-post; bh=Hs+3iqbF38UAnW4vLUsVar2byoLdXJRROIM4XJ1YLew=;
b=xlQErRjAphRlcDiaMwanENZl37Yek9XF13rsn+DyZ1TXcY7DpETCupTOyjIGMJ98D90jzk
1vQ3HPGlFGbLYXYvpbu4LJrvE1a4hC6wtdcA+BD9eYNfb3eCrOOtzJZwhAGWFCX8yM+4oh
fOjKmbteFHNr4wwp/suSJMmBe8kcMSXfVGWghSvgVwXJtoPNRTYoRC60yh/v9dgZ5ElXev
ft62IBw/ERemvfEEFpzXE5PNPUjoQw2Vms66vNEVDAgXyfMThjL8SiCFbe9K+aJTXRXco/
//SoGODM8nodp+GQeKgUqoqoh33+3dDXE2r74CnsKyBiMmdEjV0H+O5iHI/Jrw==
X-Original-To: freebsd-hackers@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
dkim=none;
arc=pass ("google.com:s=arc-20260327:i=1");
spf=pass (mx1.freebsd.org: domain of adrian.chadd@gmail.com designates 209.85.222.169 as permitted sender) smtp.mailfrom=adrian.chadd@gmail.com;
dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=freebsd.org (policy=none)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792099384; x=1792704184;
h=content-type:cc:to:subject:message-id:date:from:in-reply-to
:references:mime-version:x-gm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UFw+k0zGsB4S
s4mEeuoq5QO3ptM0T/nm4AaDmjAVg05PltMEWCXiR5pPMPujfnwcDrHmAQ
Precedence: list
In-Reply-To: <A0D65A6D-110F-47C0-B36F-DC03CA2E632A@cocito.eu>
X-Gm-Features: AclHuK9sPmz8DzLPXPpoNkxt5wnsf4020yMY7Y4kqA037UexH5n2fy9dptF-3qw
X-Spamd-Bar: /
X-Spamd-Result: default: False [-0.90 / 15.00];
ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1];
FORGED_SENDER(0.30)[adrian@freebsd.org,adrianchadd@gmail.com];
R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17];
DMARC_POLICY_SOFTFAIL(0.10)[freebsd.org : SPF not aligned (relaxed), No valid DKIM,none];
MIME_GOOD(-0.10)[multipart/alternative,text/plain];
RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.222.169:from];
MISSING_XM_UA(0.00)[];
MIME_TRACE(0.00)[0:+,1:+,2:~];
ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US];
MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org];
RCVD_COUNT_ONE(0.00)[1];
R_DKIM_NA(0.00)[];
RCPT_COUNT_TWO(0.00)[2];
ALIAS_RESOLVED(0.00)[];
FROM_NEQ_ENVFROM(0.00)[adrian@freebsd.org,adrianchadd@gmail.com];
FROM_HAS_DN(0.00)[];
FREEMAIL_ENVFROM(0.00)[gmail.com];
TO_DN_NONE(0.00)[];
PREVIOUSLY_DELIVERED(0.00)[freebsd-hackers@freebsd.org];
TO_MATCH_ENVRCPT_SOME(0.00)[];
RCVD_TLS_LAST(0.00)[];
RCVD_IN_DNSWL_NONE(0.00)[209.85.222.169:from]
X-Rspamd-Queue-Id: 4j5Ldh5nLwz3M8Y
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes