Page 1 of 1

BFS filesystem help

Posted: Mon May 02, 2005 2:40 am
by ManOfSteel
Hello,
I have some questions about the BFS filesystem (UnixWare Boot FileSystem) to the people who might be familiar with it.
- Why does every i-node need the i-node number in its first 32-bits value? After all, aren't i-nodes written in order and/or re-ordered with compaction? So if every i-node is occupying 64 bytes each, the fourth storage block of the root directory, for example, will point to the fourth 64 bytes of the i-node table (256-512), making this 32-bits value redundant. Am I wrong?
- The 4th 32-bits value of every BFS i-node is the size of the file in bytes, right?
- The 9th 32-bits value of every BFS i-node is the "nlinks" or "Hard link count". What is it used for?
- I read that "the superblock is at the beginning of disk, block 0". Does it mean that it is really at sector 0 (the boot sector - and the disk cannot be used for booting) or at the first sector after the boot sector (sector 1)?
- How can the number of i-nodes be calculated? How does "mkfs" decide how many i-nodes to reserve on a new disk?
- How are the sanity words used to recover a filesystem damaged after an interrupted compaction?
Thank you in advance.

Re:BFS filesystem help

Posted: Mon May 02, 2005 4:27 am
by Ushma
Since I'm not familiar specifically with that filesystem (and I doubt very many people know it in the detail you're asking, without reference material), I'll answer the question that's common to inode filesystems.
- The 9th 32-bits value of every BFS i-node is the "nlinks" or "Hard link count". What is it used for?
It is used to keep track of the number of hard links that refer to the inode. When you unlink one, it is decremented. When it reaches 0, the inode is freed.

Re:BFS filesystem help

Posted: Mon May 02, 2005 11:52 am
by ManOfSteel
Ok, thank you. So it's like "i_links_count" and is only used when a file is linked, right? But I wonder, how would it be so useful in a filesystem that officially only supports one directory, the root directory?

Re:BFS filesystem help

Posted: Mon May 02, 2005 1:03 pm
by Ushma
A file is always hard linked at least once, otherwise its hard link count would be zero, and its inode and blocks would have been freed. The hard link is a named entry in the directory that points to an inode.

Re:BFS filesystem help

Posted: Tue May 03, 2005 12:33 am
by Pype.Clicker
<googlebot>
Bfs for Linux
The BFS structure
</googlebot>

Re:BFS filesystem help

Posted: Tue May 03, 2005 5:13 am
by ManOfSteel
Hello,
thank you for the information, Ushma. It's clearer now.
Pype.Clicker, I already know these two websites. Do you know any other site or book or document where I could find more information about BFS?

Re:BFS filesystem help

Posted: Tue May 03, 2005 5:56 am
by Pype.Clicker
I unfortunately don't have more BFS links (actually, i never heard of BFS before), but it looks like any good description of Unix filesystems (include A. Tanenbaum books or "practical design of a file system") would help you alot, since BFS seems to be just an "odd and KISS" implementation of those concepts.
ManOfSteel wrote: Hello,
I have some questions about the BFS filesystem (UnixWare Boot FileSystem) to the people who might be familiar with it.
- Why does every i-node need the i-node number in its first 32-bits value? After all, aren't i-nodes written in order and/or re-ordered with compaction? So if every i-node is occupying 64 bytes each, the fourth storage block of the root directory, for example, will point to the fourth 64 bytes of the i-node table (256-512), making this 32-bits value redundant. Am I wrong?
You sounds right. I suppose this is just here for paranoia purpose.
- The 4th 32-bits value of every BFS i-node is the size of the file in bytes, right?
Yes, though i fail to find a clear confirmation for it.
- The 9th 32-bits value of every BFS i-node is the "nlinks" or "Hard link count". What is it used for?
As explained above, unix files may have several directory entries pointing towards their inodes. regular files have just 1 and regular directories have usually 2+#subdirectories (one for '.' and one for the parent directory pointing towards the directory). Since BFS has no hierarchy, i'd expect nlinks==1 for all the files.
- I read that "the superblock is at the beginning of disk, block 0". Does it mean that it is really at sector 0 (the boot sector - and the disk cannot be used for booting) or at the first sector after the boot sector (sector 1)?
that means it's the very first block of the partition. FS designers usually talk in terms of "logical blocks" rather than sectors. I can't tell for a floppy ...
- How can the number of i-nodes be calculated? How does "mkfs" decide how many i-nodes to reserve on a new disk?
User input
NAME
mkfs.bfs - make an SCO bfs filesystem

OPTIONS
-N Specify the desired number of inodes (at most 512). If noth?
ing is specified some default number in the range 48-512 is
picked depending on the size of the partition.
- How are the sanity words used to recover a filesystem damaged after an interrupted compaction?
Thank you in advance.
In the linux implementation, they're called "s_from", "s_to", "s_bfrom" and "s_bto". I assume they maintain pointers of the block being moved down, but it looks like there's no reference to those items in linux kernel (maybe fsck.bfs will contain more things)

Re:BFS filesystem help

Posted: Wed May 04, 2005 12:23 pm
by ManOfSteel
Thank you very much.
One last thing. In the superblock, there is the "size of filesystem (in bytes)". What is meant by "filesystem", exactly? The i-node table + superblock or the entire disk/partition (i-node table + superblock + data blocks).