hi all:<div>      In the function of link_path_walk() , it counts the hash value of the compoent of the pathname.</div><div>Why &quot;(prevhash + (c &lt;&lt;4) + (c &gt;&gt; 4))*11;&quot;?</div><div><br></div><div>Thank you.</div>
<div><br></div><div><br></div><div><br></div><div><a href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L779">http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L779</a></div><div><pre class="prettyprint lang-c" style="font-family:Monaco,&#39;Courier New&#39;,Courier,monospace;font-size:1.1em;padding:1em;color:rgb(0,12,0);background-color:rgb(51,51,51);overflow:auto;border:1px solid rgb(136,136,136)">
<a name="L809" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L809" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">809</span></a><span class="pln" style="color:rgb(255,255,255)">                 </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">=</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*(</span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">const</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">unsigned</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">char</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*)</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=name" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">name</span></a><span class="pun" style="color:rgb(255,255,255)">;</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L810" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L810" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">810</span></a><span class="pln" style="color:rgb(255,255,255)"> 
</span><a name="L811" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L811" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">811</span></a><span class="pln" style="color:rgb(255,255,255)">                 </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">hash</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">=</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=init_name_hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">init_name_hash</span></a><span class="pun" style="color:rgb(255,255,255)">();</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L812" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L812" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">812</span></a><span class="pln" style="color:rgb(255,255,255)">                 </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">do</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">{</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L813" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L813" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">813</span></a><span class="pln" style="color:rgb(255,255,255)">                         </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=name" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">name</span></a><span class="pun" style="color:rgb(255,255,255)">++;</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L814" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L814" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">814</span></a><span class="pln" style="color:rgb(255,255,255)">                         </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">hash</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">=</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=partial_name_hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">partial_name_hash</span></a><span class="pun" style="color:rgb(255,255,255)">(</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pun" style="color:rgb(255,255,255)">,</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">hash</span></a><span class="pun" style="color:rgb(255,255,255)">);</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L815" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L815" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">815</span></a><span class="pln" style="color:rgb(255,255,255)">                         </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">=</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*(</span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">const</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">unsigned</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">char</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*)</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=name" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">name</span></a><span class="pun" style="color:rgb(255,255,255)">;</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L816" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L816" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">816</span></a><span class="pln" style="color:rgb(255,255,255)">                 </span><span class="pun" style="color:rgb(255,255,255)">}</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">while</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">&amp;&amp;</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">!=</span><span class="pln" style="color:rgb(255,255,255)"> </span><i><span class="str" style="color:rgb(255,160,160)">&#39;/&#39;</span></i><span class="pun" style="color:rgb(255,255,255)">));</span><span class="pln" style="color:rgb(255,255,255)">
</span><a name="L817" href="http://lxr.oss.org.cn/source/fs/namei.c?v=2.6.16#L817" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">817</span></a><span class="pln" style="color:rgb(255,255,255)">                 </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">this</span><span class="pun" style="color:rgb(255,255,255)">.</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=len" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">len</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">=</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=name" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">name</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">-</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">const</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">char</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*)</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">this</span><span class="pun" style="color:rgb(255,255,255)">.</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=name" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">name</span></a><span class="pun" style="color:rgb(255,255,255)">;</span></pre>
</div><div><br></div><div><pre class="prettyprint lang-c" style="font-family:Monaco,&#39;Courier New&#39;,Courier,monospace;font-size:1.1em;padding:1em;color:rgb(0,12,0);background-color:rgb(51,51,51);overflow:auto;border:1px solid rgb(136,136,136)">
<b><i><span class="com" style="color:rgb(135,206,235)">/* Name hashing routines. Initial hash value */</span></i></b><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L49" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L49" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">49</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><b><i><span class="com" style="color:rgb(135,206,235)">/* Hash courtesy of the R5 hash in reiserfs modulo sign bits */</span></i></b><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L50" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L50" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">50</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="com" style="color:rgb(135,206,235)">#define</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=init_name_hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">init_name_hash</span></a><span class="pun" style="color:rgb(255,255,255)">()</span><span class="pln" style="color:rgb(255,255,255)">                </span><span class="lit" style="color:rgb(205,92,92)">0</span><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L51" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L51" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">51</span></a><span class="pln" style="color:rgb(255,255,255)"> 
 </span><a name="L52" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L52" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">52</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><b><i><span class="com" style="color:rgb(135,206,235)">/* partial hash update function. Assume roughly 4 bits per character */</span></i></b><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L53" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L53" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">53</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">static</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">inline</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">unsigned</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">long</span><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L54" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L54" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">54</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=partial_name_hash" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">partial_name_hash</span></a><span class="pun" style="color:rgb(255,255,255)">(</span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">unsigned</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">long</span><span class="pln" style="color:rgb(255,255,255)"> </span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pun" style="color:rgb(255,255,255)">,</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">unsigned</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">long</span><span class="pln" style="color:rgb(255,255,255)"> prevhash</span><span class="pun" style="color:rgb(255,255,255)">)</span><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L55" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L55" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">55</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">{</span><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L56" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L56" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">56</span></a><span class="pln" style="color:rgb(255,255,255)">         </span><span class="kwd" style="color:rgb(240,230,140);font-weight:bold">return</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><span class="pln" style="color:rgb(255,255,255)">prevhash </span><span class="pun" style="color:rgb(255,255,255)">+</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">&lt;&lt;</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="lit" style="color:rgb(205,92,92)">4</span><span class="pun" style="color:rgb(255,255,255)">)</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">+</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">(</span><a href="http://lxr.oss.org.cn/ident?v=2.6.16;i=c" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="pln">c</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">&gt;&gt;</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="lit" style="color:rgb(205,92,92)">4</span><span class="pun" style="color:rgb(255,255,255)">))</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">*</span><span class="pln" style="color:rgb(255,255,255)"> </span><span class="lit" style="color:rgb(205,92,92)">11</span><span class="pun" style="color:rgb(255,255,255)">;</span><span class="pln" style="color:rgb(255,255,255)">
 </span><a name="L57" href="http://lxr.oss.org.cn/source/include/linux/dcache.h?v=2.6.16#L57" style="text-decoration:initial;border-bottom-width:1px;border-bottom-style:dotted;border-bottom-color:rgb(153,153,153);color:white"><span class="lit" style="color:rgb(205,92,92)">57</span></a><span class="pln" style="color:rgb(255,255,255)"> </span><span class="pun" style="color:rgb(255,255,255)">}</span></pre>
</div>