How does the kernel setup the file system
hi folks, I'm looking the source code about linux file system recently. I have scanned over ext2, and now I'm very curious about how does the kernel setup the ext2 up, but I couldn't locate the corresponding code. Could anybody give any advice for me? Thanks, owr
On Fri, Jan 7, 2011 at 11:10 AM, Fu Kai <kapenware@gmail.com> wrote:
hi folks, I'm looking the source code about linux file system recently. I have scanned over ext2, and now I'm very curious about how does the kernel setup the ext2 up, but I couldn't locate the corresponding code. Could anybody give any advice for me?
Thanks, owr
You mean how does a partition get formatted? If so, from userspace. A lot of filesystem support logic is in userspace. So you have to look at those tools as well. They are maintained by the same developers as the kernel. Remember, in general if a job can be done in userspace as well as it can in the kernel, then it is not allowed into the kernel. The goal is to keep the kernel small. Greg
On Fri, Jan 7, 2011 at 8:10 AM, Fu Kai <kapenware@gmail.com> wrote:
hi folks, I'm looking the source code about linux file system recently. I have scanned over ext2, and now I'm very curious about how does the kernel setup the ext2 up, but I couldn't locate the corresponding code. Could anybody give any advice for me?
Something like... do_initcalls() do_one_initcall() fs_initcall() module_init(init_ext2_fs) HTH
Thanks, owr
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thanks - Manish ================================== [$\*.^ -- I miss being one of them ==================================
Hello, I think you are looking for following: fs/ext2/super.c: init_ext2_fs()-> register_filesystem(&ext2_fs_type)-> ext2_get_sb()->ext2_fill_super() For every file system in linux kernel, first it register itself with register_filesystem(). Here this call is called when ext2 module is loaded. Then when file system is mount it will call ext2_fill_super() which will read the on disk super block and load it into memory. The on disk super block is written when user format the device with given file system. I hope that will help. - Rahul On Fri, Jan 7, 2011 at 9:40 PM, Fu Kai <kapenware@gmail.com> wrote:
hi folks, I'm looking the source code about linux file system recently. I have scanned over ext2, and now I'm very curious about how does the kernel setup the ext2 up, but I couldn't locate the corresponding code. Could anybody give any advice for me?
Thanks, owr
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
hi, thanks you all, Rahul's suggestion really helps me. On 1/8/11, Rahul Deshmukh <rahul.deshmukh@gmail.com> wrote:
Hello,
I think you are looking for following:
fs/ext2/super.c:
init_ext2_fs()-> register_filesystem(&ext2_fs_type)-> ext2_get_sb()->ext2_fill_super()
For every file system in linux kernel, first it register itself with register_filesystem(). Here this call is called when ext2 module is loaded. Then when file system is mount it will call ext2_fill_super() which will read the on disk super block and load it into memory.
The on disk super block is written when user format the device with given file system.
I hope that will help.
- Rahul
On Fri, Jan 7, 2011 at 9:40 PM, Fu Kai <kapenware@gmail.com> wrote:
hi folks, I'm looking the source code about linux file system recently. I have scanned over ext2, and now I'm very curious about how does the kernel setup the ext2 up, but I couldn't locate the corresponding code. Could anybody give any advice for me?
Thanks, owr
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Thanks, Fu Kai
participants (4)
-
Fu Kai -
Greg Freemyer -
Manish Katiyar -
Rahul Deshmukh