<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 03:09:40 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-14429] fid2path cache in liblustreapi</title>
                <link>https://jira.whamcloud.com/browse/LU-14429</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;If applications/tools that do frequent &lt;tt&gt;llapi_fid2path()&lt;/tt&gt; lookups then liblustreapi should cache the results to avoid repeated RPCs to the MDS to generate similar pathnames.&lt;/p&gt;

&lt;p&gt;My proposal is not about caching full path components, but more like keeping a cache of the linkEA FID to &amp;lt;parent,name&amp;gt;  components of each directory, along with a (potentially precomputed) &quot;match state&quot; for each pathname.&lt;/p&gt;

&lt;p&gt;This not only avoids repeated lookup and generation of the pathname for each entry, but also allows immediate decisions on whether a file matches the pathname rule(s) or not. This FID cache would best be accessed directly by the application, but could be used afterward for bulk &lt;tt&gt;llapi_fid2path()&lt;/tt&gt; lookups as well.&lt;/p&gt;

&lt;p&gt;In that case, we could do path2fid lookup of /scratch (or other leaf directory) and pin its FID into the &quot;match&quot; hash table, and pin &quot;&lt;tt&gt;ROOT/&lt;/tt&gt;&quot; (or other path component before the leaf directory) in the &quot;not-match&quot; hash table. There is a third hash table for &quot;waiting&quot; FIDs that we don&apos;t know the result for yet.&lt;/p&gt;

&lt;p&gt;As the filesystem is traversed, each directory creates an FID cache entry with FID from LMA and &amp;lt;parent FID, name&amp;gt; from linkEA. It checks for its own FID in the &quot;waiting&quot; hash first. If found, it uses that FID cache entry and fills in the name and pFID, otherwise a new one is allocated.&lt;/p&gt;

&lt;p&gt;It checks if its pFID is already in the cache in the &quot;waiting&quot;, &quot;match&quot;, &quot;not-match&quot; hash table, and if found and adds its FID entry to that list, links it&apos;s cache entry to its parent pFID entry, and marks its cache entry as &quot;match&quot; or &quot;not-match&quot;, or allocates and adds a dummy entry for pFID to &quot;waiting&quot; hash and links to that.&lt;/p&gt;

&lt;p&gt;If the self-FID entry was found in the &quot;waiting&quot; hash, but the pFID is in the &quot;(not-)matched&quot; hash, then it needs to recursively update all child FID entries to the correct state/hash. The list of child entries is walked recursively to mark and move the FID entries to the appropriate list.&lt;/p&gt;

&lt;p&gt;A shorter process is done with file entries. If their pFID is found in the cache, then they can immediately be discarded if pFID is in &quot;not-matched&quot; state, or output full pathname if pFID is in &quot;matched&quot; state by walking each pFID from cache to generate the pathname.&lt;/p&gt;

&lt;p&gt;For files/directories that have pFID in the &quot;waiting&quot; hash, we can do two things. Either add the child name/FID (file or directory) to the &quot;waiting&quot; parent pFID entry and resolve it later, or if the &quot;waiting&quot; hash is too large then we can do direct linkEA lookups for the pFID (recursively if needed) to attach the entry to a known &quot;match&quot; or &quot;not-match&quot; FID entry, and then resolve all of the waiting child entries immediately (dropping regular files from the parent entry, but keeping directories in the cache).&lt;/p&gt;

&lt;p&gt;Since ldiskfs normally allocates files in the same group as the parent, and after the parent is allocated, the on-disk inodes will typically be in &quot;parent, child, child, ...&quot; order. This means that pFID will normally already be in the cache, so regular file inodes can often be resolved immediately for their &quot;matched&quot; or &quot;not-matched&quot; state, and the full pathname generated from cache if needed.&lt;/p&gt;

&lt;p&gt;For DNE, the same process applies. Depending of what the initial &quot;match&quot; or &quot;not-match&quot; pathnames are, there may or may not yet be any entires in the &quot;match&quot; or &quot;not-match&quot; hashes for each MDT. In that case, rather than just accumulating all entries into &quot;waiting&quot; until the cache size limit is hit, it makes sense to do some initial direct &quot;pFID&quot; lookups to populate the cache with &quot;match&quot; and &quot;non-match&quot; entries. It makes sense to do this for all entries that are in the &lt;tt&gt;REMOTE_PARENT&lt;/tt&gt; directory, since we know the parent will not be found on this MDT.&lt;/p&gt;</description>
                <environment></environment>
        <key id="62857">LU-14429</key>
            <summary>fid2path cache in liblustreapi</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="bzzz">Alex Zhuravlev</assignee>
                                    <reporter username="bzzz">Alex Zhuravlev</reporter>
                        <labels>
                    </labels>
                <created>Fri, 12 Feb 2021 07:08:10 +0000</created>
                <updated>Mon, 22 Jan 2024 23:01:25 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                            <comments>
                            <comment id="292397" author="gerrit" created="Fri, 19 Feb 2021 12:25:11 +0000"  >&lt;p&gt;Alex Zhuravlev (bzzz@whamcloud.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/41696&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/41696&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-14429&quot; title=&quot;fid2path cache in liblustreapi&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-14429&quot;&gt;LU-14429&lt;/a&gt; liblustre: cached fid2path&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 587ec4edf1d5a551acec21d0b0ceb2c9731e852e&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10120">
                    <name>Blocker</name>
                                            <outwardlinks description="is blocking">
                                                        </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="53324">LU-11380</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <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|i01mhr:</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>