file system design
Posted: Fri Apr 18, 2008 3:59 am
Hi all
If my file system design like these, any problem?
1) everthing is not linked to everything, eg. directory is not linked to file. If you want to read a file, just use a hash function to hash the file path with the content offset, it will return a LBA to you, then you can use this LBA number to read fom the harddisk
if i want to read a file, with a offset 1000, here is the pousedo code:
int lba=hash('/path/to/file', 1000)
char *a=read(lba)
2) if you want to ls a directory, just hash the directory path and get the LBA number, read the directory block, and it will tell you how many file are in that directory
advantage of this design:
1) no need to lookup where is the file located on the harddisk
2) easy to implement, *only i guess*
thanks
from Peter ([email protected])
http://pos.petersoft.com
http://www.KingOfCoders.com[/url]
If my file system design like these, any problem?
1) everthing is not linked to everything, eg. directory is not linked to file. If you want to read a file, just use a hash function to hash the file path with the content offset, it will return a LBA to you, then you can use this LBA number to read fom the harddisk
if i want to read a file, with a offset 1000, here is the pousedo code:
int lba=hash('/path/to/file', 1000)
char *a=read(lba)
2) if you want to ls a directory, just hash the directory path and get the LBA number, read the directory block, and it will tell you how many file are in that directory
advantage of this design:
1) no need to lookup where is the file located on the harddisk
2) easy to implement, *only i guess*
thanks
from Peter ([email protected])
http://pos.petersoft.com
http://www.KingOfCoders.com[/url]