[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCqrceu67F3rh3JM@debian>
Date: Mon, 19 May 2025 11:54:25 +0800
From: Gao Xiang <xiang@...nel.org>
To: Sheng Yong <shengyong2021@...il.com>
Cc: hsiangkao@...ux.alibaba.com, chao@...nel.org, zbestahu@...il.com,
jefflexu@...ux.alibaba.com, dhavale@...gle.com,
lihongbo22@...wei.com, linux-erofs@...ts.ozlabs.org,
linux-kernel@...r.kernel.org, Sheng Yong <shengyong1@...omi.com>,
Wang Shuai <wangshuai12@...omi.com>
Subject: Re: [PATCH v7] erofs: add 'fsoffset' mount option to specify
filesystem offset
Hi Yong,
On Sat, May 17, 2025 at 05:05:43PM +0800, Sheng Yong wrote:
> From: Sheng Yong <shengyong1@...omi.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@...omi.com>
> Signed-off-by: Wang Shuai <wangshuai12@...omi.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.
=================== =========================================================
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");
}
Powered by blists - more mailing lists