On Thu, 01 Jun 2017 17:15:29 +0800, Yubin Ruan said: > Regarding to inode number, I notice that nearly every filesystem has tree > representation of the inode number: > 1. on-disk inode number > 2. in-memory inode number > 3. VFS inode number > How are these related? I mean, if they are all the same, then if filesystem A > and filesystem B both have some identical inode number, the VFS inode numbers > will conflict. What's tracked is the pair (filesystem, inode). So inode 3945 on /usr is different from inode 3945 on /home. (Strictly speaking, it tracks the major,minor number for the device that has the filesystem on it - so if /usr is on /dev/sda3, and /dev/sda3 looks like: ls -l /dev/sda3 brw-rw----. 1 root disk 8, 3 May 31 19:47 /dev/sda3 What's really tracked is ((8,3),3945). Although many places in the kernel will equate "a pointer to the in-memory copy of the superblock for the filesystem on 8,3" with the actual major/minor - mostly because if you're looking at the device node numbers for the filesystem, you're probably going to be needing that superblock *anyhow*. Similar games are played for the on-disk and in-memmory inode numbers - as long as the system keeps track of what the mapping is, there's no need for them to actually be identical...
Attachment:
pgpCsETqDqYLz.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies