Re: File system Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: pgp_oU1nRzy9x.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux