Hi, Please describe the functions of this function "mount_bdev()" defined in the header file "Linux/fs/super.c". I guess it somehow initiates a safe execution of the fill_super function passed as parameter but i want to know the actual steps performed by that function. -- With Regards Dibyayan Chakraborty
On Sat, 15 Jun 2013 11:02:46 +0530, Dibyayan Chakraborty said:
Please describe the functions of this function "mount_bdev()" defined in the header file "Linux/fs/super.c".
I guess it somehow initiates a safe execution of the fill_super function passed as parameter but i want to know the actual steps performed by that function.
Did you find the source of the function? Did you read the source of the function? Can you explain what you're still confused about even after reading it?
Hi, Yes. I found the source and read it. But I cant understand the following things. 1. Why mutex lock is used in the code ? I know it is used for process synchronisation but why that section of the code is critical ? 2. What is the purpose of the "sget()" function ? 3. And what is the job of the function mount_bdev() ? Thanking you, On Sat, Jun 15, 2013 at 6:24 PM, <Valdis.Kletnieks@vt.edu> wrote:
On Sat, 15 Jun 2013 11:02:46 +0530, Dibyayan Chakraborty said:
Please describe the functions of this function "mount_bdev()" defined in the header file "Linux/fs/super.c".
I guess it somehow initiates a safe execution of the fill_super function passed as parameter but i want to know the actual steps performed by that function.
Did you find the source of the function?
Did you read the source of the function?
Can you explain what you're still confused about even after reading it?
-- With Regards Dibyayan Chakraborty
On Sat, 15 Jun 2013 18:53:22 +0530, Dibyayan Chakraborty said:
But I cant understand the following things.
Thanks... Specific questions are *much* easier to answer. ;)
1. Why mutex lock is used in the code ? I know it is used for process synchronisation but why that section of the code is critical ?
I'll answer this in just a moment...
2. What is the purpose of the "sget()" function ?
It looks for a superblock for a filesystem, and if it doesn't find one that matches, it allocates it. The mutex is so that code executing on another CPU can't call put_super() or other code that screws around with the linked list (If you have a linked list A- -> B -> C, and smebody is removing B while you're finding the next one after A, you can end up going to where B *used* to be (and memory may be re-used for something totally different) instead of C.
3. And what is the job of the function mount_bdev() ?
It basically does a "given a block device and an indicator of what filesystem type, mount the filesystem" (Basically, the top-level routine for doing stuff like 'mount -t ext4 /dev/sdb5 /mnt" - if you look, you can see where all 3 parameters are passed to mount_bdev(). This is in contrast to mount_nodev(), which is called when a block device isn't involved (for instance, for procfs or other pseudo filesystems, and I think network FS like CIFS and NFS but I could be wrong on that last).
participants (2)
-
Dibyayan Chakraborty -
Valdis.Kletnieks@vt.edu