The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Hongbo Li <lihongbo22@huawei.com>
To: linux-erofs mailing list <linux-erofs@lists.ozlabs.org>
Cc: Sheng Yong <shengyong2021@gmail.com>,
	<hsiangkao@linux.alibaba.com>, <chao@kernel.org>,
	<zbestahu@gmail.com>, <jefflexu@linux.alibaba.com>,
	<dhavale@google.com>, <linux-erofs@lists.ozlabs.org>,
	<linux-kernel@vger.kernel.org>,
	Wang Shuai <wangshuai12@xiaomi.com>
Subject: Re: [PATCH v7] erofs: add 'fsoffset' mount option to specify filesystem offset
Date: Mon, 19 May 2025 22:02:53 +0800	[thread overview]
Message-ID: <eaab881c-086d-47b0-993e-0312f0bbf1e2@huawei.com> (raw)
In-Reply-To: <aCqrceu67F3rh3JM@debian>



On 2025/5/19 11:54, Gao Xiang wrote:
> Hi Yong,
> 
> On Sat, May 17, 2025 at 05:05:43PM +0800, Sheng Yong wrote:
>> From: Sheng Yong <shengyong1@xiaomi.com>
>>
>> When attempting to use an archive file, such as APEX on android,
>> as a file-backed mount source, it fails because EROFS image within
>> the archive file does not start at offset 0. As a result, a loop
>> or a dm device is still needed to attach the image file at an
>> appropriate offset first. Similarly, if an EROFS image within a
>> block device does not start at offset 0, it cannot be mounted
>> directly either.
>>
>> To address this issue, this patch adds a new mount option `fsoffset=x'
>> to accept a start offset for the primary device. The offset should be
>> aligned to the block size. EROFS will add this offset before performing
>> read requests.
>>
>> Signed-off-by: Sheng Yong <shengyong1@xiaomi.com>
>> Signed-off-by: Wang Shuai <wangshuai12@xiaomi.com>
> 
> I applied the following diff to fulfill the Hongbo's previous suggestion
> and refine an error message:
> 
> diff --git a/Documentation/filesystems/erofs.rst b/Documentation/filesystems/erofs.rst
> index 11b0f8635f04..d93b30287110 100644
> --- a/Documentation/filesystems/erofs.rst
> +++ b/Documentation/filesystems/erofs.rst
> @@ -128,7 +128,7 @@ device=%s              Specify a path to an extra device to be used together.
>   fsid=%s                Specify a filesystem image ID for Fscache back-end.
>   domain_id=%s           Specify a domain ID in fscache mode so that different images
>                          with the same blobs under a given domain ID can share storage.
> -fsoffset=%lu           Specify image offset for the primary device.
> +fsoffset=%lu           Specify block-aligned filesystem offset for the primary device.

Thanks,

Reviewed-by: Hongbo Li <lihongbo22@huawei.com>

>   ===================    =========================================================
>   
>   Sysfs Entries
> diff --git a/fs/erofs/super.c b/fs/erofs/super.c
> index 3185bb90f549..e1e9f06e8342 100644
> --- a/fs/erofs/super.c
> +++ b/fs/erofs/super.c
> @@ -654,9 +654,9 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
>   	}
>   
>   	if (sbi->dif0.fsoff) {
> -		if (sbi->dif0.fsoff & ((1 << sbi->blkszbits) - 1))
> -			return invalfc(fc, "fsoffset %llu not aligned to block size",
> -				       sbi->dif0.fsoff);
> +		if (sbi->dif0.fsoff & (sb->s_blocksize - 1))
> +			return invalfc(fc, "fsoffset %llu is not aligned to block size %lu",
> +				       sbi->dif0.fsoff, sb->s_blocksize);
>   		if (erofs_is_fscache_mode(sb))
>   			return invalfc(fc, "cannot use fsoffset in fscache mode");
>   	}

      parent reply	other threads:[~2025-05-19 14:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-17  9:05 [PATCH v7] erofs: add 'fsoffset' mount option to specify filesystem offset Sheng Yong
2025-05-17 13:38 ` Gao Xiang
2025-05-19  3:54 ` Gao Xiang
2025-05-19  3:58   ` Sheng Yong
2025-05-19 14:02   ` Hongbo Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eaab881c-086d-47b0-993e-0312f0bbf1e2@huawei.com \
    --to=lihongbo22@huawei.com \
    --cc=chao@kernel.org \
    --cc=dhavale@google.com \
    --cc=hsiangkao@linux.alibaba.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shengyong2021@gmail.com \
    --cc=wangshuai12@xiaomi.com \
    --cc=zbestahu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox