VFS: mount_bdev and fill_super

Rohan Puri rohan.puri15 at gmail.com
Mon Jun 19 01:42:57 EDT 2017


On 19-Jun-2017 10:38 AM, "Shrikant Giridhar" <shrikantgiridhar at gmail.com>
wrote:

On Fri, 16 Jun 2017, Rohan Puri wrote:

> If s_root is set it means the superblock is already filled up so call
> fill_super() only if s_root is NULL meaning superblock is not filled yet.

I tried looking at the d_name of the s_root dentry when mounting a device
and
its always '/'. I presume this is due to it being the root dentry of the
subtree we're attaching to the main file hierarchy.

Yes.


Can the dentry of a superblock be something other than '/' on mounting it?

Are you talking about s_root field of struct super_block ? Then it ideally
should be of root. I checked some file systems implementation of
fill_super().

fill_super() is the method that sets the s_root field of super_block. I
found all of those file systems *rightly* calling d_make_root() API which
actually makes root dentry with name '/'.

So the question you should ask yourself is which file systems code are you
referring too, how is it setting the s_root field of super_block in their
fill_super method. You will get your answer. Unless some file system is
doing some very weird thing, I believe it would be calling d_make_root()
VFS API only which does the task for you.



Apologies if my question is a little vague. Any documentation about this
would
help too.

---
Shrikant


- Rohan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20170619/f7f46931/attachment.html 


More information about the Kernelnewbies mailing list