<!-- 
RSS generated by JIRA (9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c) at Sat Feb 10 02:58:24 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-13103] e2fsprogs has problem when calculation block number</title>
                <link>https://jira.whamcloud.com/browse/LU-13103</link>
                <project id="10000" key="LU">Lustre</project>
                    <description>&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 blkcnt_t blocks_from_inode(ext2_filsys fs,
				  struct ext2_inode_large *inode)
{
	blkcnt_t b;

	b = inode-&amp;gt;i_blocks;
	if (ext2fs_has_feature_huge_file(fs-&amp;gt;super))
		b += ((long long) inode-&amp;gt;osd2.linux2.l_i_blocks_hi) &amp;lt;&amp;lt; 32;

	if (!ext2fs_has_feature_huge_file(fs-&amp;gt;super) ||
	    !(inode-&amp;gt;i_flags &amp;amp; EXT4_HUGE_FILE_FL))
		b *= fs-&amp;gt;blocksize / 512;
	b *= EXT2FS_CLUSTER_RATIO(fs);

	return b;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is wrong, it should be something like&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 blkcnt_t blocks_from_inode(ext2_filsys fs, struct ext2_inode *inode)
{
	blkcnt_t b;

	b = inode-&amp;gt;i_blocks;
	if (ext2fs_has_feature_huge_file(fs-&amp;gt;super)) {
		b += ((long long) inode-&amp;gt;osd2.linux2.l_i_blocks_hi) &amp;lt;&amp;lt; 32;
		if (inode-&amp;gt;i_flags &amp;amp; EXT4_HUGE_FILE_FL)
			b *= fs-&amp;gt;blocksize / 512;
	}
	b *= EXT2FS_CLUSTER_RATIO(fs);

	return b;
}
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;ext2fs_iblk_add_blocks(), ext2fs_iblk_sub_blocks() and ext2fs_iblk_set() has similar problems.&lt;/p&gt;</description>
                <environment></environment>
        <key id="57707">LU-13103</key>
            <summary>e2fsprogs has problem when calculation block number</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="wshilong">Wang Shilong</assignee>
                                    <reporter username="lixi_wc">Li Xi</reporter>
                        <labels>
                    </labels>
                <created>Fri, 27 Dec 2019 02:31:28 +0000</created>
                <updated>Mon, 20 Apr 2020 01:43:05 +0000</updated>
                            <resolved>Mon, 20 Apr 2020 01:43:05 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>4</watches>
                                                                            <comments>
                            <comment id="260419" author="adilger" created="Fri, 27 Dec 2019 10:36:21 +0000"  >&lt;p&gt;It looks to me that the existing code is correct. &lt;/p&gt;

&lt;p&gt;There are two parts to the huge file support. One part is the high 16 bits of the block number. The second part is whether the blocks are in 512-byte sector units (old code) or blocksize units (new code).  Only if both the HUGE_FILE feature is enabled in the superblock is the high-bits field available. and only if the  inode flag is set is it in units of blocksize. Otherwise it has to be converted from sectors to blocks. &lt;/p&gt;</comment>
                            <comment id="260421" author="lixi_wc" created="Fri, 27 Dec 2019 12:58:18 +0000"  >&lt;p&gt;Dongyang found following:&lt;/p&gt;

&lt;p&gt;Lower 32-bits of &quot;block&quot; count. If the huge_file feature flag is not set on the filesystem, the file consumes i_blocks_lo 512-byte blocks on disk. If huge_file is set and EXT4_HUGE_FILE_FL is NOT set in inode.i_flags, then the file consumes i_blocks_lo + (i_blocks_hi &amp;lt;&amp;lt; 32) 512-byte blocks on disk. If huge_file is set and EXT4_HUGE_FILE_FL IS set in inode.i_flags, then this file consumes (i_blocks_lo + i_blocks_hi &amp;lt;&amp;lt; 32) filesystem blocks on disk.&lt;/p&gt;</comment>
                            <comment id="260422" author="lixi_wc" created="Fri, 27 Dec 2019 13:00:49 +0000"  >&lt;p&gt;The problem with current code is, if file system has no huge file feature, or if the file has no huge file flag, the block saved in i_blocks will be consider to having the unit of block size. That is not correct, and causes different values between the 512 block number got from stat(2) and from e2fsprogs utilities.&lt;/p&gt;</comment>
                            <comment id="260423" author="wshilong" created="Fri, 27 Dec 2019 13:38:57 +0000"  >&lt;p&gt;btw, above codes have another problem that it b *= EXT2FS_CLUSTER_RATIO(fs), this is not right for i_blocks.&lt;/p&gt;</comment>
                            <comment id="260438" author="adilger" created="Sat, 28 Dec 2019 10:44:34 +0000"  >&lt;p&gt;Please post an email to linux-ext4@vger.kernel.org with bug report and/or patch.  It looks like the code in &lt;tt&gt;blocks_from_inode()&lt;/tt&gt; is specific to FUSE, and that may never have been tested with files over 16TB (since that isn&apos;t possible with x86 systems, only with PAGE_SIZE over 4KB).  The other places where &lt;tt&gt;EXT4_HUGE_FILE_FL&lt;/tt&gt; are used is converting from a blocks count to store into the inode, while the &lt;tt&gt;blocks_from_inode()&lt;/tt&gt; is converting from &lt;tt&gt;inode-&amp;gt;i_blocks&lt;/tt&gt; to the 512-byte sector count, so the logic should be reversed.&lt;/p&gt;

&lt;p&gt;I also see that &lt;tt&gt;ext2fs_inode_i_blocks()&lt;/tt&gt; is not taking &lt;tt&gt;EXT4_HUGE_FILE_FL&lt;/tt&gt; into account at all, which is likely confusing/broken as well.&lt;/p&gt;</comment>
                            <comment id="260443" author="gerrit" created="Sun, 29 Dec 2019 14:18:16 +0000"  >&lt;p&gt;Wang Shilong (wshilong@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37109&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37109&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13103&quot; title=&quot;e2fsprogs has problem when calculation block number&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13103&quot;&gt;&lt;del&gt;LU-13103&lt;/del&gt;&lt;/a&gt; e2fsprogs: fix to use inode i_blocks correctly&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 9450605fc9053d553f7f5980bc747c58d70f9483&lt;/p&gt;</comment>
                            <comment id="260444" author="gerrit" created="Sun, 29 Dec 2019 14:20:59 +0000"  >&lt;p&gt;Wang Shilong (wshilong@ddn.com) uploaded a new patch: &lt;a href=&quot;https://review.whamcloud.com/37110&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://review.whamcloud.com/37110&lt;/a&gt;&lt;br/&gt;
Subject: &lt;a href=&quot;https://jira.whamcloud.com/browse/LU-13103&quot; title=&quot;e2fsprogs has problem when calculation block number&quot; class=&quot;issue-link&quot; data-issue-key=&quot;LU-13103&quot;&gt;&lt;del&gt;LU-13103&lt;/del&gt;&lt;/a&gt; e2fsprogs: fix to use inode i_blocks correctly&lt;br/&gt;
Project: tools/e2fsprogs&lt;br/&gt;
Branch: master-lustre&lt;br/&gt;
Current Patch Set: 1&lt;br/&gt;
Commit: 5bdf73f1a7055b97342c92d256923a4b32c8ec97&lt;/p&gt;</comment>
                            <comment id="268010" author="wshilong" created="Mon, 20 Apr 2020 01:43:05 +0000"  >&lt;p&gt;DY is rebasing e2fsprogs, supposing we will include it soon.&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|i00rfz:</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>
                                                                                            <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>