Look inline for comments.<br><br><div class="gmail_quote">On Tue, Oct 23, 2012 at 7:30 PM, Abhijit Chandrakant Pawar <span dir="ltr">&lt;<a href="mailto:abhi.c.pawar@gmail.com" target="_blank">abhi.c.pawar@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>


  
  

<div>
Hi Rohan,<div><div class="h5"><br>
<br>
On Tue, 2012-10-23 at 18:47 +0530, Rohan Puri wrote:<br>
<blockquote type="CITE">
    <br>
    <br>
    On Tue, Oct 23, 2012 at 6:33 PM, Abhijit Chandrakant Pawar &lt;<a href="mailto:abhi.c.pawar@gmail.com" target="_blank">abhi.c.pawar@gmail.com</a>&gt; wrote:<br>
    <blockquote>
        I am working on the layered file systems. I came across a function called set_super_anon. <br>
        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. <br>

        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. <br>
        <br>
        If it is never used then why its added to the function param list?  Is there any historical reason during the older kernel days? <br>
        <br>
        Regards,<br>
        Abhijit Pawar <br>
        <br>
        _______________________________________________<br>
        Kernelnewbies mailing list<br>
        <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
        <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
        <br>
    </blockquote>
    <br>
    Hi Abhijit,<br>
    <br>
    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 &amp; for that they need data argument where they usually pass mount-related data<br>

    <br>
    For eg. see the definition and usage of function nfs_set_super(). <br>
    <br>
    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.<br>

    <br>
</blockquote></div></div>
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. <br></div></blockquote><div>
Do you mean to say, each fs&#39;s own set_super function makes a call to set_anon_super() with data parameter as their specific data, but set_anon_super makes no use of it? <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<br>
Wouldnt that cause stack to store the value un-necessarily? It would be good if everybody passes NULL as second param.<br>
<br></div></blockquote><div>Yes, each fs&#39;s set_super, if makes a call to anon_super() should pass NULL as the second parameter(void *data) since anon_super doesnt make use of this parameter, need for this parameter just arises to match the prototype of sget()&#39;s function ptr agrument. Also do remember the pointer to this data is passed, so only a word-size of extra stack is utilized when a call to this function is made. <br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
<blockquote type="CITE">
    - Rohan
</blockquote>
</div>

</blockquote></div><br>- Rohan<br>