Subject: Re: Item of future thought: disklabels
To: Scott Reynolds <scottr@Plexus.COM>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: current-users
Date: 07/26/1996 07:44:12
On Thu, 25 Jul 1996 23:53:05 -0500 (CDT) 
 Scott Reynolds <scottr@Plexus.COM> wrote:

 > On Fri, 26 Jul 1996, Brett Lymn wrote:
 > 
 > > Why not just noffs (network order ffs)?  That way you would not need
 > > to worry about be/le, you just mount it...
 > 
 > Aieeee!  And alienate the i386 user base?! (Among others...)
 > 
 > I hope I am misunderstanding you, and this is just an optional filesystem
 > in addition to the native byte order ffs. :-)

To throw some fuel on this fire, let me suggest an approach...

At USENIX, Christos, Charles, and myself discussed a way of doing 
this...  Namely, find and isolate _all_ the places in FFS where data is 
actually written to or read from disk.  Set up an ops vector - one for 
"native" and one for "swapped".  The "native" ordering is tried first, 
and, if the magic number is wrong, the "swapped" ops are tried.  If that 
fails, return an error like we currently do on bad magic number.

When the attempt to read the magic number is made, the ops vector pointer 
is already set up, so if it succeeds, you don't need to do any additional 
processing.  In the event you end up using the "swapped" ops, set a mount 
flag so that situation is visible to userland.

One problem with this is that it stand the chance of slowing down the 
filesystem; on some architectures, jumping through a function pointer can 
be relatively expensive (longer instruction timings, instruction cache 
misses, etc.)  However, it's worth noting that we already jump through a 
function pointer or three during any file system operation (the vnode and 
vfs ops vectors that each file system provides to the upper layers), so 
the effect of one more might not be noticeable at all.

Ciao.

 -- save the ancient forests - http://www.bayarea.net/~thorpej/forest/ -- 
Jason R. Thorpe                                       thorpej@nas.nasa.gov
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939