<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/lib/maple_tree.c, branch v6.15</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v6.15</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v6.15'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2025-03-17T05:06:15Z</updated>
<entry>
<title>maple_tree: remove a BUG_ON() in mas_alloc_nodes()</title>
<updated>2025-03-17T05:06:15Z</updated>
<author>
<name>Petr Tesarik</name>
<email>ptesarik@suse.com</email>
</author>
<published>2025-02-13T11:44:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=18ea595a07bcf931ec6efae5c1f8a0d9a440ed97'/>
<id>urn:sha1:18ea595a07bcf931ec6efae5c1f8a0d9a440ed97</id>
<content type='text'>
Remove a BUG_ON() right before a WARN_ON() with the same condition.

Calling WARN_ON() and BUG_ON() here is definitely wrong.  Since the goal is
generally to remove BUG_ON() invocations from the kernel, keep only the
WARN_ON().

Link: https://lkml.kernel.org/r/20250213114453.1078318-1-ptesarik@suse.com
Fixes: 067311d33e65 ("maple_tree: separate ma_state node from status")
Signed-off-by: Petr Tesarik &lt;ptesarik@suse.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: use ma_dead_node() in mte_dead_node()</title>
<updated>2025-03-17T05:06:13Z</updated>
<author>
<name>I Hsin Cheng</name>
<email>richard120310@gmail.com</email>
</author>
<published>2025-02-11T07:18:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6fbea85271c6764d512a5c5b6c1b44b762693a18'/>
<id>urn:sha1:6fbea85271c6764d512a5c5b6c1b44b762693a18</id>
<content type='text'>
Utilize ma_dead_node() in mte_dead_node().  It can prevent decoding the
maple enode for a second time.  Use the "node" to find parent for
comparison.

Link: https://lkml.kernel.org/r/20250211071850.330632-1-richard120310@gmail.com
Signed-off-by: I Hsin Cheng &lt;richard120310@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Ching-Chun (Jim) Huang &lt;jserv@ccns.ncku.edu.tw&gt;
Cc: Shuah khan &lt;skhan@linuxfoundation.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: correct comment for mas_start()</title>
<updated>2025-03-17T05:06:10Z</updated>
<author>
<name>I Hsin Cheng</name>
<email>richard120310@gmail.com</email>
</author>
<published>2025-02-09T18:10:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=67254c7d70b63797a54173fbe05cd6552aca11d4'/>
<id>urn:sha1:67254c7d70b63797a54173fbe05cd6552aca11d4</id>
<content type='text'>
There's no mas-&gt;status of "mas_start", what the function is checking is
whether mas-&gt;status equals to "ma_start".  Correct the comment for the
function.

Link: https://lkml.kernel.org/r/20250209181023.228856-1-richard120310@gmail.com
Signed-off-by: I Hsin Cheng &lt;richard120310@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;howlett@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: only root node could be deficient</title>
<updated>2025-01-14T06:40:41Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-13T03:16:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7318f95ba40bed454d1e20f27e821198d3def4e5'/>
<id>urn:sha1:7318f95ba40bed454d1e20f27e821198d3def4e5</id>
<content type='text'>
Each level's rightmost node should have (max == ULONG_MAX).  This means
current validation skips the right most node on each level.

Only the root node may be below the minimum data threshold.

Link: https://lkml.kernel.org/r/20241113031616.10530-4-richard.weiyang@gmail.com
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: simplify split calculation</title>
<updated>2025-01-14T06:40:41Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-13T03:16:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=4f6a6bed0bfef4b966f076f33eb4f5547226056a'/>
<id>urn:sha1:4f6a6bed0bfef4b966f076f33eb4f5547226056a</id>
<content type='text'>
Patch series "simplify split calculation", v3.


This patch (of 3):

The current calculation for splitting nodes tries to enforce a minimum
span on the leaf nodes.  This code is complex and never worked correctly
to begin with, due to the min value being passed as 0 for all leaves.

The calculation should just split the data as equally as possible
between the new nodes.  Note that b_end will be one more than the data,
so the left side is still favoured in the calculation.

The current code may also lead to a deficient node by not leaving enough
data for the right side of the split. This issue is also addressed with
the split calculation change.

[Liam.Howlett@Oracle.com: rephrase the change log]
Link: https://lkml.kernel.org/r/20241113031616.10530-1-richard.weiyang@gmail.com
Link: https://lkml.kernel.org/r/20241113031616.10530-2-richard.weiyang@gmail.com
Fixes: 54a611b60590 ("Maple Tree: add new data structure")
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: we don't set offset to MAPLE_NODE_SLOTS on error</title>
<updated>2025-01-14T06:40:39Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-16T01:48:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f2760364add9996b8937ae388c8035ea1f242440'/>
<id>urn:sha1:f2760364add9996b8937ae388c8035ea1f242440</id>
<content type='text'>
When mas_anode_descend() not find gap, it sets -EBUSY instead of setting
offset to MAPLE_NODE_SLOTS.

Link: https://lkml.kernel.org/r/20241116014805.11547-4-richard.weiyang@gmail.com
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: not possible to be a root node after loop</title>
<updated>2025-01-14T06:40:39Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-16T01:48:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f5bd418727856b104d6dcb43b144381c31250383'/>
<id>urn:sha1:f5bd418727856b104d6dcb43b144381c31250383</id>
<content type='text'>
Empty tree and single entry tree is handled else whether, so the maple
tree here must be a tree with nodes.

If the height is 1 and we found the gap, it will jump to *done* since it
is also a leaf.

If the height is more than one, and there may be an available range, we
will descend the tree, which is not root anymore.

If there is no available range, we will set error and return.

This means the check for root node here is not necessary.

Link: https://lkml.kernel.org/r/20241116014805.11547-3-richard.weiyang@gmail.com
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: index has been checked to be smaller than pivot</title>
<updated>2025-01-14T06:40:39Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-16T01:48:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=5f8db8d428807e52c816610e8acea576f856eb6d'/>
<id>urn:sha1:5f8db8d428807e52c816610e8acea576f856eb6d</id>
<content type='text'>
Patch series "mas_anode_descend() related cleanup".

Some cleanup related to mas_anode_descend().


This patch (of 3):

At the beginning of loop, it has checked the range is in lower bounds.

Link: https://lkml.kernel.org/r/20241116014805.11547-1-richard.weiyang@gmail.com
Link: https://lkml.kernel.org/r/20241116014805.11547-2-richard.weiyang@gmail.com
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: use mas_next_slot() directly</title>
<updated>2025-01-14T06:40:30Z</updated>
<author>
<name>Wei Yang</name>
<email>richard.weiyang@gmail.com</email>
</author>
<published>2024-11-25T02:41:56Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=002ebb925e2fcf150b0e346a960060ea4789ff01'/>
<id>urn:sha1:002ebb925e2fcf150b0e346a960060ea4789ff01</id>
<content type='text'>
The loop condition makes sure (mas.last &lt; max), so we can directly use
mas_next_slot() here.

Since no other use of mas_next_entry(), it is removed.

Link: https://lkml.kernel.org/r/20241125024156.26093-1-richard.weiyang@gmail.com
Signed-off-by: Wei Yang &lt;richard.weiyang@gmail.com&gt;
Reviewed-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Sidhartha Kumar &lt;sidhartha.kumar@oracle.com&gt;
Cc: Lorenzo Stoakes &lt;lorenzo.stoakes@oracle.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>maple_tree: reload mas before the second call for mas_empty_area</title>
<updated>2024-12-31T01:59:07Z</updated>
<author>
<name>Yang Erkun</name>
<email>yangerkun@huawei.com</email>
</author>
<published>2024-12-14T09:30:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=1fd8bc7cd889bd73d07a83cb32d674ac68f99153'/>
<id>urn:sha1:1fd8bc7cd889bd73d07a83cb32d674ac68f99153</id>
<content type='text'>
Change the LONG_MAX in simple_offset_add to 1024, and do latter:

[root@fedora ~]# mkdir /tmp/dir
[root@fedora ~]# for i in {1..1024}; do touch /tmp/dir/$i; done
touch: cannot touch '/tmp/dir/1024': Device or resource busy
[root@fedora ~]# rm /tmp/dir/123
[root@fedora ~]# touch /tmp/dir/1024
[root@fedora ~]# rm /tmp/dir/100
[root@fedora ~]# touch /tmp/dir/1025
touch: cannot touch '/tmp/dir/1025': Device or resource busy

After we delete file 100, actually this is a empty entry, but the latter
create failed unexpected.

mas_alloc_cyclic has two chance to find empty entry.  First find the entry
with range range_lo and range_hi, if no empty entry exist, and range_lo &gt;
min, retry find with range min and range_hi.  However, the first call
mas_empty_area may mark mas as EBUSY, and the second call for
mas_empty_area will return false directly.  Fix this by reload mas before
second call for mas_empty_area.

[Liam.Howlett@Oracle.com: fix mas_alloc_cyclic() second search]
  Link: https://lore.kernel.org/all/20241216060600.287B4C4CED0@smtp.kernel.org/
  Link: https://lkml.kernel.org/r/20241216190113.1226145-2-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20241214093005.72284-1-yangerkun@huaweicloud.com
Fixes: 9b6713cc7522 ("maple_tree: Add mtree_alloc_cyclic()")
Signed-off-by: Yang Erkun &lt;yangerkun@huawei.com&gt;
Signed-off-by: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: Chuck Lever &lt;chuck.lever@oracle.com&gt; says:
Cc: Liam R. Howlett &lt;Liam.Howlett@Oracle.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
</content>
</entry>
</feed>
