Re: set_super_anon in fs/super.c

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

 



Hi Rohan,

On Tue, 2012-10-23 at 18:47 +0530, Rohan Puri wrote:


On Tue, Oct 23, 2012 at 6:33 PM, Abhijit Chandrakant Pawar <abhi.c.pawar@xxxxxxxxx> wrote:
I am working on the layered file systems. I came across a function called set_super_anon.
This is a callback to the sget function to compare the superblock . This function accepts two parameters. first is superblock * and second is void *.  If you look at the definition of this function, the void* is never used.
Many filesystem uses this function when they are mounting the superblock. Some pass NULL and some pass actual data.I have looked till 2.6.31 but there isnt any trace of the usage of second parameter.

If it is never used then why its added to the function param list?  Is there any historical reason during the older kernel days?

Regards,
Abhijit Pawar

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


Hi Abhijit,

See the issue is this function is passed as an argument to sget(), now their are many other file-systems that defined their own set_super function & for that they need data argument where they usually pass mount-related data

For eg. see the definition and usage of function nfs_set_super().

So, the prototype of the sget() should contain function ptr (set_super()) and this function ptr should have data argument also. Now one usage can imply NO USE of the data parameter, which is set_super_anon, but other file-systems may require, so the sget() prototype should be generic to support, both the cases.

Yes... thats what I thought.   many are passing data un-necessarily to this function wherein they already have captured the required information for their purpose in their own defined function.

Wouldnt that cause stack to store the value un-necessarily? It would be good if everybody passes NULL as second param.

- Rohan
_______________________________________________
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