<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 01:21:39 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-2016] Layout swapping, MDD part</title>
                <link>https://jira.whamcloud.com/browse/LU-2016</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&lt;p&gt;Add the possibility to swap the layouts between to files.&lt;br/&gt;
This feature will be used to migrate files inside Lustre (eg for rebalance) and by HSM to restore files from archive&lt;br/&gt;
This patch is the mdd part of the feature, the high level design is:&lt;br/&gt;
&#8211;  Start transaction&lt;br/&gt;
&#8211;  Read LOV EA from obj1 &amp;amp; obj 2&lt;br/&gt;
&#8211;  Run xattr_set(obj1, layout2) &amp;amp; xattr_set(obj2, layout1)&lt;br/&gt;
   (LOD should not take any action)&lt;br/&gt;
&#8211;  Stop transaction&lt;/p&gt;</description>
                <environment></environment>
        <key id="16089">LU-2016</key>
            <summary>Layout swapping, MDD part</summary>
                <type id="2" iconUrl="https://jira.whamcloud.com/secure/viewavatar?size=xsmall&amp;avatarId=11311&amp;avatarType=issuetype">New Feature</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="jlevi">Jodi Levi</assignee>
                                    <reporter username="cealustre">CEA</reporter>
                        <labels>
                            <label>HSM</label>
                    </labels>
                <created>Mon, 24 Sep 2012 04:49:23 +0000</created>
                <updated>Wed, 5 Aug 2020 13:32:55 +0000</updated>
                            <resolved>Sat, 13 Apr 2013 15:44:22 +0000</resolved>
                                    <version>Lustre 2.4.0</version>
                                    <fixVersion>Lustre 2.4.0</fixVersion>
                                        <due></due>
                            <votes>0</votes>
                                    <watches>7</watches>
                                                                            <comments>
                            <comment id="45480" author="pjones" created="Mon, 24 Sep 2012 23:13:09 +0000"  >&lt;p&gt;Jodi will see that this ticket is appropriately assigned&lt;/p&gt;</comment>
                            <comment id="46020" author="jcl" created="Thu, 4 Oct 2012 16:21:41 +0000"  >&lt;p&gt;Patch is at  &lt;a href=&quot;http://review.whamcloud.com/4189&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://review.whamcloud.com/4189&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="47346" author="adilger" created="Fri, 2 Nov 2012 21:55:44 +0000"  >&lt;p&gt;I was thinking that a good sanityt test for the layout swap and layout lock code would be to implement an &quot;lfs swap&quot; command and hook this into the &quot;lfs_migrate&quot; script instead of using &quot;mv&quot;.  The core &quot;lfs swap&quot;/&quot;lfs_swap&quot; command functionality should be implemented via new llapi helpers:&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-object&quot;&gt;int&lt;/span&gt; llapi_fd_layout_swap(&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; src_fd, &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; tgt_fd, __u64 flags)
{
        struct ll_layout_swap lls = { .lls_tgt = tgt_fd, .lls_flags = flags };

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; ioctl(fd, LL_IOC_LOV_LAYOUT_SWAP, (void *)&amp;amp;lls)
}

&lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; llapi_file_layout_swap(&lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *src_path, &lt;span class=&quot;code-keyword&quot;&gt;const&lt;/span&gt; &lt;span class=&quot;code-object&quot;&gt;char&lt;/span&gt; *tgt_path, __u64 flags)
{
        &lt;span class=&quot;code-object&quot;&gt;int&lt;/span&gt; src_fd, tgt_fd;

        src_fd = open(src_path, O_RDONLY);
        tgt_fd = open(tgt_path, O_RDONLY);
        &lt;span class=&quot;code-comment&quot;&gt;/* error handling and such */&lt;/span&gt;

        &lt;span class=&quot;code-keyword&quot;&gt;return&lt;/span&gt; llapi_fd_layout_swap(src_fd, tgt_fd, flags);
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Where ll_file_ioctl(LL_IOC_LOV_LAYOUT_SWAP) triggers an MDS RPC to call mdd_swap_layouts().&lt;/p&gt;

&lt;p&gt;&quot;lfs swap&quot; wouldn&apos;t be 100% atomic yet, since the copy + swap would not yet be safe from other thread modifying the original object during the copy, but it would at least fix the problem of preserving open file handles on the original file and would be a good step toward implementing a full atomic &quot;lfs migrate&quot;.&lt;/p&gt;

&lt;p&gt;A test script for this code could look like:&lt;/p&gt;

&lt;ol&gt;
	&lt;li&gt;generate 10s of verifiable IO data&lt;br/&gt;
        dd if=/dev/urandom of=$DIR/$tfile.orig bs=1M &amp;amp;&lt;br/&gt;
        DD_PID=$?&lt;br/&gt;
        sleep 10&lt;br/&gt;
        kill $DD_PID&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;copy the data, while swapping the layout repeatedly and&lt;/li&gt;
	&lt;li&gt;changing the stripe count to exercise the IO/LOV code&lt;br/&gt;
        dd if=$DIR/$tfile.orig of=$DIR/$tfile.copy bs=1M &amp;amp;&lt;br/&gt;
        DD_PID=$?&lt;br/&gt;
        sleep 0.5&lt;br/&gt;
        while kill -STOP $DD_PID; do&lt;br/&gt;
                lfs_migrate -y -c $((RANDOM % OSTCOUNT)) $DIR/$tfile.copy&lt;br/&gt;
                kill -CONT $DD_PID&lt;br/&gt;
                sleep 1&lt;br/&gt;
        done&lt;/li&gt;
&lt;/ol&gt;


&lt;ol&gt;
	&lt;li&gt;verify that the migrated file matches the original&lt;/li&gt;
	&lt;li&gt;lfs_migrate itself verifies each copy after it is made&lt;br/&gt;
        cmp $DIR/$tfile.orig $DIR/$tfile.copy || error &quot;compare failed&quot;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;At some later point (or immediately, if someone is ambitious) lfs_migrate would be implemented with &quot;lfs migrate&quot;, which calls lfs_setstripe() internally to process the arguments to create the target object(s), then gets the group lock and does the data copy internally before calling llapi_fd_layout_swap() to do the swap (like an HSM copytool does).  At this point, the above &quot;kill -STOP&quot; can be replaced with &quot;kill -0&quot; (just to check that &quot;dd&quot; is still running) and should be able to migrate the file while it is being written.&lt;/p&gt;</comment>
                            <comment id="47362" author="jcl" created="Sat, 3 Nov 2012 07:17:58 +0000"  >&lt;p&gt;I am implementing lfs swap_layouts in &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-2017&quot; title=&quot;Layout swapping, client  and MDT parts&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-2017&quot;&gt;&lt;del&gt;LU-2017&lt;/del&gt;&lt;/a&gt;, I should push a first version next week.&lt;br/&gt;
I have made a simple test without concurrent access, I will add the concurrent access test.&lt;/p&gt;

&lt;p&gt;About the open, today I open with O_WRONLY in place of O_RDONLY because swaping is changing file content.&lt;br/&gt;
With O_RDONLY someone can swap file it should not be able to modify.&lt;/p&gt;</comment>
                            <comment id="56251" author="adilger" created="Sat, 13 Apr 2013 10:00:07 +0000"  >&lt;p&gt;Change 4189 is landed, can this be closed?&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Related</name>
                                            <outwardlinks description="is related to ">
                                        <issuelink>
            <issuekey id="16090">LU-2017</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="19879">LU-3608</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_10070" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                        <customfieldname>Project</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10040"><![CDATA[HSM]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10390" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|hzv3of:</customfieldvalue>

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