ext2 fs

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Sourcer
Member
Member
Posts: 58
Joined: Fri Jun 17, 2016 11:29 pm
Libera.chat IRC: WalterPinkman

ext2 fs

Post by Sourcer »

Hey i'm kinda stuck in implementing this bloody fs.

I've researched and read alot of sources, most of them do something like:

mount -> search the super block -> gather information about the fs.

But my brain is in a paradox, when i'm implementing a mount function, should i be the one who writes the superblock in the first place?
Why all of the fs drivers search for ext2 information on drives?

My kernel flow is:
Bootloader loads the initrd as a grub module -> kernel gets the initrd address(which is in ext2 format) -> now i need to copy the ext2 initrd to the root device

I can't think about a good API that will help my kernel copy the initrd to the root device.

Also, i'm desinging my fs to be device independent, which means that every function the driver provides will work on a "device" object. So i'm having a hard time designing it; Should i keep information about each ext2 that is mounted on every device? every inode, every block?
Thanks.
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: ext2 fs

Post by SpyderTL »

Sourcer wrote:But my brain is in a paradox, when i'm implementing a mount function, should i be the one who writes the superblock in the first place?
Why all of the fs drivers search for ext2 information on drives?
"Mounting" a volume just means registering it in the Operating System. It doesn't actually (necessarily) modify the volume at all.

Sourcer wrote:My kernel flow is:
Bootloader loads the initrd as a grub module -> kernel gets the initrd address(which is in ext2 format) -> now i need to copy the ext2 initrd to the root device

I can't think about a good API that will help my kernel copy the initrd to the root device.
I'm not sure what you mean by "root device", and I don't know why you would want to copy your initrd to it.
Sourcer wrote:Should i keep information about each ext2 that is mounted on every device? every inode, every block?
It's up to you. The more information you keep in memory, the faster your system will be. But the more you fill up system memory, the more you will need to swap data to disk, which will make it much slower. So it's a matter of building a system that balances all of its resources in a way that maximizes overall performance.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Sourcer
Member
Member
Posts: 58
Joined: Fri Jun 17, 2016 11:29 pm
Libera.chat IRC: WalterPinkman

Re: ext2 fs

Post by Sourcer »

SpyderTL wrote:
Sourcer wrote:But my brain is in a paradox, when i'm implementing a mount function, should i be the one who writes the superblock in the first place?
Why all of the fs drivers search for ext2 information on drives?
"Mounting" a volume just means registering it in the Operating System. It doesn't actually (necessarily) modify the volume at all.

Sourcer wrote:My kernel flow is:
Bootloader loads the initrd as a grub module -> kernel gets the initrd address(which is in ext2 format) -> now i need to copy the ext2 initrd to the root device

I can't think about a good API that will help my kernel copy the initrd to the root device.
I'm not sure what you mean by "root device", and I don't know why you would want to copy your initrd to it.
Sourcer wrote:Should i keep information about each ext2 that is mounted on every device? every inode, every block?
It's up to you. The more information you keep in memory, the faster your system will be. But the more you fill up system memory, the more you will need to swap data to disk, which will make it much slower. So it's a matter of building a system that balances all of its resources in a way that maximizes overall performance.
My initrd contains all the OS's toolchain(userspace programs) and the base directories.(Unix directories like /bin, /dev). Maybe i misunderstood the purpose of the initrd, but isn't it supposed to be loaded first to the RAM, then to the root device for future booting?(root device is the device that the kernel is "installed" on)
User avatar
Roman
Member
Member
Posts: 568
Joined: Thu Mar 27, 2014 3:57 am
Location: Moscow, Russia
Contact:

Re: ext2 fs

Post by Roman »

The initial ramdisk is the disk image you initially mount on /, then you either continue with it or mount a new partition on / (aka switch_root and pivot_root on some UNIX(-like) systems).
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay
Post Reply