[CVALE] How do you design a file system?

Landon Blake lblake at ksninc.com
Tue May 8 13:52:17 PDT 2007


David,

 

 You have answered a lot of my questions, perhaps unintentionally. :]

 

You wrote: "The Linux file systems (XFS, ext2/3, ReiserFS, etc) are
almost all written in C,  I know some file systems are written in C++
but I don't believe any that are included with Linux."

 

O.K. - So like most of Linux file systems are written in C.

 

You wrote: "Most file systems are written so they are compatible across
architectures so while you don't have to write a complete version for
each architecture there are some coding differences that you need to
take into account to make it cross platform compatible (don't ask me
exactly what these are)."

 

This makes sense too. I'm beginning to realize that: C Programming
Language = Global Assembly Language. Basically, you can run C programs
on any processor that has a C compiler. Why mess with assembly language
unless you are implementing a language compiler?

 

You wrote: "As for utilities,  it depends on which ones.  Things like
fsck have to be built for each file system,  other tools like mv and cp
run on top of the OS and make OS level calls which your file system has
to know how to handle."

 

This makes sense as well. 

 

I think I sometimes confuse the basic C functions with C functions
provided by the operating system. Do all C functions have to go through
the "door" controlled by the operating system before they are executed
by the computer's processor, or are they executed "directly"? I think a
lot of C functions are executed directly by the processor.

 

It makes sense that operating systems like Linux would provide C
functions as part of the operating system that are really an abstraction
to the different file systems. This way a client program wouldn't have
to know how to open a file on each type of file system. The client
program can just use the operating system function openfile(filename,
initial_size) or something similar. But this would mean that the
implementers of the file system would likely need to make their design
"fit" into the operating system.

 

Thanks for the explanation.

 

Landon

 

________________________________

From: cvale-bounces at lists.fire2wire.com
[mailto:cvale-bounces at lists.fire2wire.com] On Behalf Of Dennis Baker
Sent: Tuesday, May 08, 2007 1:41 PM
To: cvale at cvale.org
Subject: Re: [CVALE] How do you design a file system?

 

Isn't there a userspace filesystem kernel module now?  I seem to recall
reading about being able to write a file system in Python... a little
crazy there.

The Linux file systems (XFS, ext2/3, ReiserFS, etc) are almost all
written in C,  I know some file systems are written in C++ but I don't
believe any that are included with Linux.  None that I know of currently
are written in assembly.  Most filesystems are written so they are
compatible across architectures so while you don't have to write a
complete version for each architecture there are some coding differences
that you need to take into account to make it cross platform compatible
(don't ask me exactly what these are). 

As for utilities,  it depends on which ones.  Things like fsck have to
be built for each file system,  other tools like mv and cp run on top of
the OS and make OS level calls which your file system has to know how to
handle. 

All current Linux file systems are available as either kernel modules or
can be compiled into the kernel.

00 Dennis

On 5/8/07, Landon Blake <lblake at ksninc.com> wrote:

Its time for one of my really ignorant and purely theoretical questions:
How do you design a computer file system?

 

Some common file systems are FAT16, FAT32, Ext2, and Ext3. I know they
all do basically the same thing, store files on some sort of storage
medium. 

 

If you wanted to design a new file system, how would you go about it?
Would it have to be written specifically for each processor type? Could
it be written in a programming language like C, or would it have to be
implemented at a lower level by using some sort of assembly language? Is
a file system simply a format specification? (For example, the name of
the file goes in this 50 bytes, the length of the file in the next 10
bytes...) Or does a file system contain tools, utilities and functions?

 

How would one add support for a new file system to Linux? Could you do
this with what is called a kernel  "module"?

 

I'm not saying I'd actually want to implement a new file system, since
there is already a lot of existing file systems that work just fine, but
I'm curious as to how this would work. 

 

What is on the cutting edge of computer file system design? What new
concepts are they exploring?

 

Landon

 



Warning:
Information provided via electronic media is not guaranteed against
defects including translation and transmission errors. If the reader is
not the intended recipient, you are hereby notified that any
dissemination, distribution or copying of this communication is strictly
prohibited.  If you have received this information in error, please
notify the sender immediately. 


_______________________________________________
cvale mailing list
cvale at lists.fire2wire.com
http://lists.fire2wire.com/mailman/listinfo.cgi/cvale




-- 
Dennis Da-Ogre http://ogrehut.com 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fire2wire.com/pipermail/cvale/attachments/20070508/c5987c20/attachment.html


More information about the cvale mailing list