Subject: Re: tmpfs: Internal representation of data
To: Matt Thomas <matt@3am-software.com>
From: Julio M. Merino Vidal <jmmv84@gmail.com>
List: tech-kern
Date: 07/19/2005 22:00:04
On 7/19/05, Matt Thomas <matt@3am-software.com> wrote:
> Julio M. Merino Vidal wrote:
>=20
> One thing you may want to consider is that eventually that the tmpfs
> maybe replace the current md-root mechanism but using an external tool
> to write a tmpfs into a kernel.

Good idea.

> > Suppressing the former (merging it with directory contents,
> > thus becoming something like the FAT) means that
> > implementing hard links becomes very complex, so the
> > separation is worth it.
>=20
> Directories are just files and should be kept in the format returned
> by getdents(2).

Aha.

> I would use pools, not malloc/free.

Oh.  I wasn't aware of these "pools", but as you say it, they seem
to be The Solution.  I'll take a look at them.

> You have the advantage of being able to storing the FS using
> simple native data structures without the need for indirection.
> Why not take advantage of them?  The hard part is noting the
> where the file data is stored since that's bound to be variably
> sized.

That's what I wanted to do at first, but after seeing what I described
in this mail (the memory management issues), I was a bit scared to
not be able to do it as wanted in the project proposal.

> > The code in the CVS did exactly this some revisions before
> > HEAD.  In a later change, I undid the separation explained
> > here and used blocks for everything.  But I'm starting to
> > regret that decision because it will be very complex to store
> > nodes if I don't want to waste much memory.
> >
> > What do you think?  Can you come up with better ideas or
> > suggestions?  Anything inherently wrong in this rationale?
>=20
> I think you need to spend more time on your data structures
> since that's what everything comes down to.

Certainly sure.  I reread my mail and it seems as if I said that this
was the final idea for implementation.  But it wasn't; it was just
one possible way to do it (the only way I'd see given what I
knew), and it popped up to be incorrect.

I must look at the pools and see how to use them.

Thanks for the comments!

--=20
Julio M. Merino Vidal <jmmv84@gmail.com>
http://www.livejournal.com/users/jmmv/
The NetBSD Project - http://www.NetBSD.org/