Commit 19fc795
maple_tree: simplify split calculation
commit 4f6a6be upstream.
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: 54a611b ("Maple Tree: add new data structure")
Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>1 parent aab2bc4 commit 19fc795
1 file changed
+6
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1849 | 1849 | | |
1850 | 1850 | | |
1851 | 1851 | | |
1852 | | - | |
| 1852 | + | |
1853 | 1853 | | |
1854 | 1854 | | |
1855 | 1855 | | |
1856 | | - | |
| 1856 | + | |
1857 | 1857 | | |
1858 | 1858 | | |
1859 | 1859 | | |
| |||
1886 | 1886 | | |
1887 | 1887 | | |
1888 | 1888 | | |
1889 | | - | |
1890 | | - | |
1891 | 1889 | | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
1896 | | - | |
1897 | | - | |
1898 | | - | |
1899 | | - | |
1900 | | - | |
1901 | 1890 | | |
1902 | 1891 | | |
1903 | 1892 | | |
| |||
2366 | 2355 | | |
2367 | 2356 | | |
2368 | 2357 | | |
2369 | | - | |
| 2358 | + | |
2370 | 2359 | | |
2371 | 2360 | | |
2372 | 2361 | | |
| |||
2379 | 2368 | | |
2380 | 2369 | | |
2381 | 2370 | | |
2382 | | - | |
| 2371 | + | |
2383 | 2372 | | |
2384 | 2373 | | |
2385 | 2374 | | |
| |||
2866 | 2855 | | |
2867 | 2856 | | |
2868 | 2857 | | |
2869 | | - | |
| 2858 | + | |
2870 | 2859 | | |
2871 | 2860 | | |
2872 | 2861 | | |
| |||
3357 | 3346 | | |
3358 | 3347 | | |
3359 | 3348 | | |
3360 | | - | |
| 3349 | + | |
3361 | 3350 | | |
3362 | 3351 | | |
3363 | 3352 | | |
| |||
0 commit comments