[PATCH] erofs-utils: mkfs: support flatdev for multi-blob images

Jingbo Xu jefflexu at linux.alibaba.com
Fri Sep 15 16:59:36 AEST 2023



On 9/15/23 2:35 PM, Gao Xiang wrote:
> 
> 
> On 2023/9/15 14:27, Jingbo Xu wrote:
>> Since kernel commit 8b465fecc35a ("erofs: support flattened block device
>> for multi-blob images"), flatdev feature is introduced to support for
>> mounting multi-blobs container image as a single block device.
>>
>> Introduce "-Eflatdev" option to generate images in flatdev mode.
> 
> Why need introducing such an option
> 
> mapped_blkaddr cannot be filled/fixed up all the time?

Okay. Will be updated in the next version.

> 
>> Currently this can only work with rebuild mode, where the device tag is
>> filled with the uuid of the corresponding source image.
> 
> ...
> 
> 
>> +    if (cfg.c_flatdev && !rebuild_mode) {
>> +        erofs_err("--flatdev is supported only in rebuild mode
>> currently");
> 
> I don't think we need this, all multiple device mode can use this.
> 
> 
>> +        return -EINVAL;
>> +    }
>> +
>>       if (cfg.c_compr_alg[0] && erofs_blksiz(&sbi) != getpagesize())
>>           erofs_warn("Please note that subpage blocksize with
>> compression isn't yet supported in kernel. "
>>                  "This compressed image will only work with bs = ps =
>> %u bytes",
>> @@ -765,8 +774,15 @@ static void erofs_mkfs_default_options(void)
>>       sbi.feature_compat = EROFS_FEATURE_COMPAT_SB_CHKSUM |
>>                    EROFS_FEATURE_COMPAT_MTIME;
>>   -    /* generate a default uuid first */
>> -    erofs_uuid_generate(sbi.uuid);
>> +    /*
>> +     * Generate a default uuid first.  In rebuild mode the uuid of the
>> +     * source image is used as the device slot's tag.  The kernel will
>> +     * identify the tag as empty and fail the mount if its first byte is
>> +     * zero.  Apply this constraint to uuid to work around it.
>> +     */
>> +    do {
>> +        erofs_uuid_generate(sbi.uuid);
>> +    } while (!sbi.uuid[0]);
> 
> why need a loop here?

To ensure the first byte of the device tag (i.e. the uuid of the source
image) is not zero, so that it won't block the mounting in flatdev mode.

-- 
Thanks,
Jingbo


More information about the Linux-erofs mailing list