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).

Attachment: pgpntM6AdLu6M.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to