<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:28:15 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-9676] mgc config code cleanup</title>
                <link>https://jira.whamcloud.com/browse/LU-9676</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;There are several easy cleanups that can be done in the mgc config code and its interfaces.&lt;/p&gt;

&lt;p&gt;As noted on &lt;a href=&quot;https://review.whamcloud.com/#/c/27320/:&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/#/c/27320/:&lt;/a&gt;&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;his looks like it will fix the problem, but the code here could be further improved to avoid potential errors in the future.
lustre/mgc/mgc_request.c
Line 300:

(style) would be better to do this in one check:

        if (cfg-&amp;gt;cfg_sub_clds &amp;amp; CONFIG_T_SPTLRPC)
                lcfg.cfg_instance = NULL;
        else if (sb != NULL)
                lcfg.cfg_instance = sb;
        else
                lcfg.cfg_instance = obd;

no need to cast the pointers to void.

Also, blech on having CONFIG_T_{PARAMS,SPTLRPC,BARRIER,...} and CONFIG_SUB_{PARAMS,...}.  This is obviously very error prone.

Since CONFIG_T_is part of lustre_idl.h and is an enum, what about adding:

 enum config_sub_mask {
        CONFIG_SUB_SPTLRPC = BIT(CONFIG_T_SPTLRPC),
        CONFIG_SUB_RECOVER = BIT(CONFIG_T_PARAMS),
        CONFIG_SUB_PARAMS  = BIT(CONFIG_T_PARAMS),
        CONFIG_SUB_NODEMAP = BIT(CONFIG_T_NODEMAP),
        CONFIG_SUB_BARRIER = BIT(CONFIG_T_BARRIER),
 };

and naming the CONFIG_T_* enum, and adding the enums as arguments where they are used so that it is clear which one is intended,
and/or renaming these a bit so that &quot;T&quot; and &quot;SUB&quot; are more self-explanatory?
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The definition of &lt;tt&gt;struct config_llog_data&lt;/tt&gt; can be moved to &lt;tt&gt;mgc_request.c&lt;/tt&gt;. Same for &lt;tt&gt;cld_is_*()&lt;/tt&gt; and the declaration of &lt;tt&gt;mgc_process_log()&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;The declarations &lt;tt&gt;mgc_fsname2resid()&lt;/tt&gt; and &lt;tt&gt;mgc_logname2resid()&lt;/tt&gt; can be moved to &lt;tt&gt;mgc_internal.h&lt;/tt&gt; and neither function needs to be exported.&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;mgc_process_log()&lt;/tt&gt; can be made static.&lt;/p&gt;

&lt;p&gt;The data and datalen parameters of &lt;tt&gt;obd_process_config()&lt;/tt&gt; should be replaces with a &lt;tt&gt;struct lustre_cfg *&lt;/tt&gt; parameter:&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; static inline int
-obd_process_config(struct obd_device *obd, int datalen, void *data)
+obd_process_config(struct obd_device *obd, struct lustre_cfg *lcfg)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Most of the &lt;tt&gt;char *logname&lt;/tt&gt; or &lt;tt&gt;char *fsname&lt;/tt&gt; parameters in &lt;tt&gt;lustre/mgc/&lt;/tt&gt; should be converted to &lt;tt&gt;const char *&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Similarly, most of the &lt;tt&gt;struct config_llog_instance *&lt;/tt&gt; parameters should be const qualified.&lt;/p&gt;

&lt;p&gt;The &lt;tt&gt;void *cfg_instance&lt;/tt&gt; member of &lt;tt&gt;struct config_llog_instance&lt;/tt&gt; should be const qualified.&lt;/p&gt;

&lt;p&gt;The ordering of parameters is inconsistent:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; struct config_llog_data *config_log_find_or_add(struct obd_device *obd,
                                &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *logname, struct super_block *sb, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; type,
                                struct config_llog_instance *cfg)

&lt;span class=&quot;code-keyword&quot;&gt;static&lt;/span&gt; struct config_llog_data *
config_log_add(struct obd_device *obd, &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *logname,
               struct config_llog_instance *cfg, struct super_block *sb)

&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Several functions can be simplified if we use a &lt;tt&gt;const void *instance&lt;/tt&gt; parameter (pointing to the sb or obd device) rather than a &lt;tt&gt;struct config_llog_instance *&lt;/tt&gt; parameter. These include &lt;tt&gt;config_log_find()&lt;/tt&gt; and &lt;tt&gt;config_log_end()&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;After this is done, the &lt;tt&gt;lustre_cfg&lt;/tt&gt; for &lt;tt&gt;LCFG_LOG_END&lt;/tt&gt; can be simplified to pass just the sb or obd pointer instead of a whole &lt;tt&gt;struct config_llog_instance&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;We should also consider removing &lt;tt&gt;LCFG_LOG_START&lt;/tt&gt; and &lt;tt&gt;LCFG_LOG_END&lt;/tt&gt; and replacing their uses with calls to new obd methods. There&apos;s no reason to pack in kernel objects into a &lt;tt&gt;lustre_cfg&lt;/tt&gt; for this and it obscures analysis of these functions.&lt;/p&gt;</description>
                <environment></environment>
        <key id="46748">LU-9676</key>
            <summary>mgc config code cleanup</summary>
                <type id="4" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11310&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.whamcloud.com/images/icons/priorities/minor.svg">Minor</priority>
                        <status id="1" iconUrl="https://jira.whamcloud.com/images/icons/statuses/open.png" description="The issue is open and ready for the assignee to start work on it.">Open</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="wc-triage">WC Triage</assignee>
                                    <reporter username="jhammond">John Hammond</reporter>
                        <labels>
                            <label>easy</label>
                            <label>mgc</label>
                    </labels>
                <created>Fri, 16 Jun 2017 14:51:41 +0000</created>
                <updated>Fri, 16 Jun 2017 14:51:41 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                                    <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|hzzfaf:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10090" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                </customfields>
    </item>
</channel>
</rss>