Can you control the inode a file is assigned?

Mark Pledger mpledger at cti1.UUCP
Sun Jul 29 03:23:07 AEST 1990


You really can't do this under program control.  And now the reasons ...

The unix kernel determines when and how to assign inodes for newly created
files.  A (normally) 100 inode buffer is kept in the super block, which
is used to speed up inode allocation requests.  When a program requests a
new file to be created, the creat() of fopen() call results in an internal
kernal call to allocate a new inode block.  The kernel first  attempts to
get this new inode from the super block inode buffer.  If all is well the 
kernel returns the new inode block number.  If there is not any more inodes
available, the the kernel goes out and reads through the inode linked list
on disk, loading up the super block buffer with unused inode numbers.  After
which the kernel returns a new inode number from the freshly created buffer
list in the super block.

I also don't quite understand why you would want to do this in the first
place??

Mark Pledger
cti1!mpledger at uunet.uu.net
uunet!cti1!mpledger



More information about the Comp.unix.questions mailing list