LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how VFS works ? (https://www.linuxquestions.org/questions/linux-newbie-8/how-vfs-works-4175423252/)

ashish061291 08-21-2012 11:25 AM

how VFS works ?
 
Hi,

How does VFS gets to know to which file-system it has received the read() or write() call ?

We know that VFS trasnfers the call in File-system specific format,but how it will get to know whether it has to transfer the call to ext2 or ntfs ?

Kindly help
Thanks in advance

zwitterion-241920 08-22-2012 11:34 AM

I am not an expert on kernel internals but I think when the partition is mounted the file system type is remembered, so the when a read() or write() call is issued, the kernel starts at the end of the filename and strips it until it finds a mountpoint
(/home/foo/bar/baz/qux.c is in
/home/foo/bar/baz, not a mounted fs,
/home/foo/bar, not a mounted fs,
/home/foo, not a mounted fs,
/home, hey that's a mount point for a partition)
,then it looks up the partition or loopback connected to that mount point, looks up the filesystem and issues the right command.

You might be interested in this and this.
IBM has a lot of good articles on the structure of Linux in its 'Anatomy of' series, so try looking there and in Google before asking.


All times are GMT -5. The time now is 06:13 PM.