md: reintroduce md-linear

THe md-linear is removed by commit 849d18e27b ("md: Remove deprecated
CONFIG_MD_LINEAR") because it has been marked as deprecated for a long
time.

However, md-linear is used widely for underlying disks with different size,
sadly we didn't know this until now, and it's true useful to create
partitions and assemble multiple raid and then append one to the other.

People have to use dm-linear in this case now, however, they will prefer
to minimize the number of involved modules.

Fixes: 849d18e27b ("md: Remove deprecated CONFIG_MD_LINEAR")
Cc: stable@vger.kernel.org
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Coly Li <colyli@kernel.org>
Acked-by: Mike Snitzer <snitzer@kernel.org>
Link: https://lore.kernel.org/r/20250102112841.1227111-1-yukuai1@huaweicloud.com
Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
Yu Kuai
2025-01-02 19:28:41 +08:00
committed by Song Liu
parent e494e45161
commit 127186cfb1
7 changed files with 379 additions and 4 deletions

View File

@@ -233,7 +233,7 @@ struct mdp_superblock_1 {
char set_name[32]; /* set and interpreted by user-space */
__le64 ctime; /* lo 40 bits are seconds, top 24 are microseconds or 0*/
__le32 level; /* 0,1,4,5 */
__le32 level; /* 0,1,4,5, -1 (linear) */
__le32 layout; /* only for raid5 and raid10 currently */
__le64 size; /* used size of component devices, in 512byte sectors */

View File

@@ -103,6 +103,8 @@ typedef struct mdu_array_info_s {
} mdu_array_info_t;
#define LEVEL_LINEAR (-1)
/* we need a value for 'no level specified' and 0
* means 'raid0', so we need something else. This is
* for internal use only