<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:57:34 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-13007] WBC: Add cache aging to flush dirty cache in the background</title>
                <link>https://jira.whamcloud.com/browse/LU-13007</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;On a client, WBC borrows the design and implementation from Linux/tmpfs a lot. Our implementation of Lustre WBC is called MemFS.&lt;/p&gt;

&lt;p&gt;WBC needs to add cache aging mechanism so that it will automatically start to flush dirty cache in the background when it gets old (normal VFS/VM dirty inode writeback), instead of the current code that doesn&apos;t do any writeback to the MDS until the DLM lock is cancelled, which might be minutes or hours later.&lt;/p&gt;
&lt;h2&gt;&lt;a name=&quot;%C2%A0Cacheagingimplementation&quot;&gt;&lt;/a&gt;&#160;Cache aging implementation&lt;/h2&gt;

&lt;p&gt;This can be implemented via super block VFS interface -&amp;gt;write_inode() in the background when it gets old.&lt;/p&gt;

&lt;p&gt;However, when flush a dirty directory triggered by the revocation of the WBC EX lock or -&amp;gt;write_inode() call, it needs to hold the WBC EX lock until push all its children directories or files to MDT, acquire the WBC EX lock back on the children directories, and then can we drop the parent WBC EX lock.&lt;br/&gt;
 The reasons are:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;It need to block any newly creation under a directory protected by the WBC EX lock which is being revoked.&lt;/li&gt;
	&lt;li&gt;readdir().&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;&lt;a name=&quot;readdir%28%29&quot;&gt;&lt;/a&gt;readdir()&lt;/h2&gt;
&lt;ul&gt;
	&lt;li&gt;Currently the mechanism adopted by WBC (similar tmpfs) is to simply scan the in-memory sub dentries of the directory in dcache to fill the content returned to readdir call.&lt;/li&gt;
	&lt;li&gt;Lustre new readdir implementation is much complex. It does readdir in hash order and uses hash of a file name as a telldir/seekdir cookie.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;How to bridge the two implementations is a challenge. &lt;br/&gt;
 &lt;b&gt;Solution&lt;/b&gt;: sub dirs or files in a directory &lt;b&gt;all&lt;/b&gt;&#160;flush to MDT or&#160;&lt;b&gt;all&lt;/b&gt; cache on client-side MemFS.&lt;/p&gt;

&lt;p&gt;To distinguish different states of a dentry and take different actions accordingly, several flags of an dentry are defined as follows:&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Protect(P):
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;The file or directory is under the protection of subtree WBC EX lock;&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Sync(S):
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;The file or directory has been flushed to the metadata server (MDT).&lt;/li&gt;
		&lt;li&gt;For directory:
		&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
			&lt;li&gt;Its top-level directory must be flushed to MDT; exclusively lock new subdirs, drop parent lock;&lt;/li&gt;
			&lt;li&gt;The directory must obtain EX lock;&lt;/li&gt;
			&lt;li&gt;Its parent directory should also sync to MDT, and drop the EX lock;&lt;/li&gt;
		&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Complete (C) for a directory:
	&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
		&lt;li&gt;Cached in client-side cache or in Sync(S) state;&lt;/li&gt;
		&lt;li&gt;Under the protection of EX lock: Protect(P) state;&lt;/li&gt;
		&lt;li&gt;Contains the complete sub dirs and files in dcache (MemFS);&lt;/li&gt;
		&lt;li&gt;Results of readdir() and lookup() operations under the directory can directly be obtained from client-side cache. All file operations can be performed on the client-side cache without communication with the server.&lt;/li&gt;
		&lt;li&gt;Otherwise read dentries from MDT (Not (C) state).&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;&lt;a name=&quot;Dataassimilation&quot;&gt;&lt;/a&gt;Data assimilation&lt;/h2&gt;

&lt;p&gt;When flushing the data of a regular file under the protection of WBC EX lock, it needs to write the dirty cached pages in MemFS into Lustre clio (called data assimilation phase). Before that, the metadata object has already created on MDT and the layout of the file is also instantiated and returned to the client.&lt;/p&gt;

&lt;p&gt;Here there are two methods to assimilate file data.&lt;/p&gt;
&lt;ul&gt;
	&lt;li&gt;Before data assimilation, pin the WBC EX lock by increasing its reference. And then acquire all the extent locks for data IO. After that, it is&#160;safe to unpin WBC EX lock that guards the layout by decreasing the reference. Then perform data assimilation.&lt;/li&gt;
&lt;/ul&gt;


&lt;ul&gt;
	&lt;li&gt;The client does not acquire any extent locks for data IO, and could hold WBC EX lock that guards the layout until 1)finished data assimilation, 2) sync&#160;the data to OSTs and 3) discard the cached data on the client. if the file size is small, this method should be more efficient.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;During data assimilation, it needs to ensure that new ongoing generic IO, which needs to switch from MemFS to Lustre clio engine (this should be solved in the JIRA ticket: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13010&quot; title=&quot;WBC: Reopen the file when WBC EX lock revoking&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13010&quot;&gt;LU-13010&lt;/a&gt; reopen the files when EX WBC lock is cancelled), must be blocked in this phase until finished data assimilation.&lt;/p&gt;</description>
                <environment></environment>
        <key id="57457">LU-13007</key>
            <summary>WBC: Add cache aging to flush dirty cache in the background</summary>
                <type id="7" iconUrl="https://jira.whamcloud.com/images/icons/issuetypes/task_agile.png">Technical task</type>
                            <parent id="51932">LU-10938</parent>
                                    <priority id="2" iconUrl="https://jira.whamcloud.com/images/icons/priorities/critical.svg">Critical</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="qian_wc">Qian Yingjin</assignee>
                                    <reporter username="qian_wc">Qian Yingjin</reporter>
                        <labels>
                    </labels>
                <created>Tue, 26 Nov 2019 09:14:08 +0000</created>
                <updated>Mon, 10 Jan 2022 01:17:58 +0000</updated>
                                                                                <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                            <comments>
                            <comment id="260382" author="gerrit" created="Wed, 25 Dec 2019 02:51:04 +0000"  >&lt;p&gt;Yingjin Qian (qian@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37094&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37094&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13007&quot; title=&quot;WBC: Add cache aging to flush dirty cache in the background&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13007&quot;&gt;LU-13007&lt;/a&gt; wbc: add cache aging flush mode in the background&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 9b112b45034a8c9c6956b405fe447b17ccc67426&lt;/p&gt;</comment>
                            <comment id="260396" author="gerrit" created="Thu, 26 Dec 2019 04:10:50 +0000"  >&lt;p&gt;Yingjin Qian (qian@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37100&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37100&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13007&quot; title=&quot;WBC: Add cache aging to flush dirty cache in the background&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13007&quot;&gt;LU-13007&lt;/a&gt; wbc: handle setattr() on the root WBC file&lt;br/&gt;
Project: fs/lustre-release&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 53e3411bafaac4dc4aafdf63c48eed4d4ea7e23e&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="51932">LU-10938</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </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|i00pwn:</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>