<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:31:52 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>Whamcloud Community JIRA</title>
    <link>https://jira.whamcloud.com</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.4.14</version>
        <build-number>940014</build-number>
        <build-date>05-12-2023</build-date>
    </build-info>


<item>
            <title>[LU-3204] clean up SET_BUT_UNUSED</title>
                <link>https://jira.whamcloud.com/browse/LU-3204</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;The SET_BUT_UNUSED macro seems to exist purely to silence compiler warnings:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;#define SET_BUT_UNUSED(a) do { } while(sizeof(a) - sizeof(a))
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;


&lt;p&gt;The hapless code reviewer cannot help but wonder &quot;why not just fix the code to get rid of the warning?&quot;.  Fixing the handful of places that use this macro would be a small but simple step toward making Lustre code more accessible.&lt;/p&gt;

&lt;p&gt;In some cases, particularly with functions built in kernel and user-space, the SET_BUT_UNUSED usage seems to be a matter of style preference.  That is, the original intent seemed to be to avoid #ifdef&apos;s around declarations of variables not used in user space.  If we want to uphold this convention, the practice at least deserves an explanatory comment.  I would argue that the code is already littered with #ifdef&apos;s, so one more around a variable declaration is less detrimental to readability than SET_BUT_UNSED is.&lt;/p&gt;

&lt;p&gt;In other cases, SET_BUT_UNUSED is used rather confusingly to let some unfinished bit of code build cleanly.  For example:&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeHeader panelHeader&quot; style=&quot;border-bottom-width: 1px;&quot;&gt;&lt;b&gt;lustre/llite/dcache.c:ll_revalidate_it()&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;462                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (it-&amp;gt;it_flags &amp;amp; FMODE_WRITE) {                               
463                         och_p = &amp;amp;lli-&amp;gt;lli_mds_write_och;                        
464                         och_usecount = &amp;amp;lli-&amp;gt;lli_open_fd_write_count;           
465                 } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (it-&amp;gt;it_flags &amp;amp; FMODE_EXEC) {                         
466                         och_p = &amp;amp;lli-&amp;gt;lli_mds_exec_och;                         
467                         och_usecount = &amp;amp;lli-&amp;gt;lli_open_fd_exec_count;            
468                 } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {                                                        
469                         och_p = &amp;amp;lli-&amp;gt;lli_mds_read_och;                         
470                         och_usecount = &amp;amp;lli-&amp;gt;lli_open_fd_read_count;            
471                 }                                                               
472                 &lt;span class=&quot;code-comment&quot;&gt;/* Check &lt;span class=&quot;code-keyword&quot;&gt;for&lt;/span&gt; the proper lock. */&lt;/span&gt;                                
473                 ibits = MDS_INODELOCK_LOOKUP;                                   
474                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (!ll_have_md_lock(inode, &amp;amp;ibits, LCK_MINMODE))               
475                         &lt;span class=&quot;code-keyword&quot;&gt;goto&lt;/span&gt; do_lock;                                           
476                 mutex_lock(&amp;amp;lli-&amp;gt;lli_och_mutex);                                
477                 &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; (*och_p) { &lt;span class=&quot;code-comment&quot;&gt;/* Everything is open already, &lt;span class=&quot;code-keyword&quot;&gt;do&lt;/span&gt; nothing */&lt;/span&gt;      
478                         /*(*och_usecount)++;  Do not let them steal our open    
479                           handle from under us */                               
480                         SET_BUT_UNUSED(och_usecount);                           
481                         /* XXX The code above was my original idea, but in &lt;span class=&quot;code-keyword&quot;&gt;case&lt;/span&gt; 
482                            we have the handle, but we cannot use it due to later
483                            checks (e.g. O_CREAT|O_EXCL flags set), nobody       
484                            would decrement counter increased here. So we just   
485                            hope the lock won&apos;t be invalidated in between. But   
486                            &lt;span class=&quot;code-keyword&quot;&gt;if&lt;/span&gt; it would be, we&apos;ll reopen the open request to     
487                            MDS later during file open path */                   
488                         mutex_unlock(&amp;amp;lli-&amp;gt;lli_och_mutex);                      
489                         RETURN(1);                                              
490                 } &lt;span class=&quot;code-keyword&quot;&gt;else&lt;/span&gt; {                                                        
491                         mutex_unlock(&amp;amp;lli-&amp;gt;lli_och_mutex);                      
492                 }                                                               
493         }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment></environment>
        <key id="18482">LU-3204</key>
            <summary>clean up SET_BUT_UNUSED</summary>
                <type id="1" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11303&amp;avatarType=issuetype">Bug</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="5" iconUrl="https://jira.whamcloud.com/images/icons/statuses/resolved.png" description="A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.">Resolved</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="1">Fixed</resolution>
                                        <assignee username="dmiter">Dmitry Eremin</assignee>
                                    <reporter username="nedbass">Ned Bass</reporter>
                        <labels>
                            <label>mn4</label>
                    </labels>
                <created>Mon, 22 Apr 2013 20:47:12 +0000</created>
                <updated>Fri, 16 May 2014 20:29:39 +0000</updated>
                            <resolved>Fri, 26 Jul 2013 18:20:17 +0000</resolved>
                                                    <fixVersion>Lustre 2.5.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>3</watches>
                                                                            <comments>
                            <comment id="56810" author="pjones" created="Tue, 23 Apr 2013 13:37:02 +0000"  >&lt;p&gt;Dmitry&lt;/p&gt;

&lt;p&gt;Could you please look into this ticket?&lt;/p&gt;

&lt;p&gt;Thanks&lt;/p&gt;

&lt;p&gt;Peter&lt;/p&gt;</comment>
                    </comments>
                    <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                            <customfield id="customfield_10890" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzvoon:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>7824</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10060" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Severity</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10022"><![CDATA[3]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>