* [PATCH] blkid: allow up to 64k erofs block sizes
@ 2025-01-23 19:17 Eric Sandeen
2025-01-23 23:22 ` Gao Xiang
2025-01-24 14:37 ` [PATCH V2] " Eric Sandeen
0 siblings, 2 replies; 5+ messages in thread
From: Eric Sandeen @ 2025-01-23 19:17 UTC (permalink / raw)
To: util-linux; +Cc: xiang, Karel Zak
Today, mkfs.erofs defaults to page size for block size, but blkid
does not recognize this. Increase the limit to 64k.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
(There might be strange arches out there > 64k but I don't know if
erofs really works with blocks that big, so for now let's just
limit it to 64k?)
diff --git a/libblkid/src/superblocks/erofs.c b/libblkid/src/superblocks/erofs.c
index 05822460b..89620db47 100644
--- a/libblkid/src/superblocks/erofs.c
+++ b/libblkid/src/superblocks/erofs.c
@@ -73,8 +73,8 @@ static int probe_erofs(blkid_probe pr, const struct blkid_idmag *mag)
if (!sb)
return errno ? -errno : BLKID_PROBE_NONE;
- /* EROFS is restricted to 4KiB block size */
- if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 4096)
+ /* block size must be between 512 and 64k */
+ if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 65536)
return BLKID_PROBE_NONE;
if (!erofs_verify_checksum(pr, mag, sb))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] blkid: allow up to 64k erofs block sizes
2025-01-23 19:17 [PATCH] blkid: allow up to 64k erofs block sizes Eric Sandeen
@ 2025-01-23 23:22 ` Gao Xiang
2025-01-24 14:37 ` [PATCH V2] " Eric Sandeen
1 sibling, 0 replies; 5+ messages in thread
From: Gao Xiang @ 2025-01-23 23:22 UTC (permalink / raw)
To: Eric Sandeen; +Cc: util-linux, xiang, Karel Zak
Hi Eric,
On Thu, Jan 23, 2025 at 01:17:10PM -0600, Eric Sandeen wrote:
> Today, mkfs.erofs defaults to page size for block size, but blkid
> does not recognize this. Increase the limit to 64k.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> (There might be strange arches out there > 64k but I don't know if
> erofs really works with blocks that big, so for now let's just
> limit it to 64k?)
>
> diff --git a/libblkid/src/superblocks/erofs.c b/libblkid/src/superblocks/erofs.c
> index 05822460b..89620db47 100644
> --- a/libblkid/src/superblocks/erofs.c
> +++ b/libblkid/src/superblocks/erofs.c
> @@ -73,8 +73,8 @@ static int probe_erofs(blkid_probe pr, const struct blkid_idmag *mag)
> if (!sb)
> return errno ? -errno : BLKID_PROBE_NONE;
>
> - /* EROFS is restricted to 4KiB block size */
> - if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 4096)
> + /* block size must be between 512 and 64k */
> + if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 65536)
I think it should be
if (sb->blkszbits < 9 || ..
?
Also (1U << sb->blkszbits) might be overflowed, so just use
sb->blkszbits > 16.
Otherwise it looks good to me.
Thanks,
Gao Xiang
> return BLKID_PROBE_NONE;
>
> if (!erofs_verify_checksum(pr, mag, sb))
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2] blkid: allow up to 64k erofs block sizes
2025-01-23 19:17 [PATCH] blkid: allow up to 64k erofs block sizes Eric Sandeen
2025-01-23 23:22 ` Gao Xiang
@ 2025-01-24 14:37 ` Eric Sandeen
2025-01-25 15:19 ` Gao Xiang
1 sibling, 1 reply; 5+ messages in thread
From: Eric Sandeen @ 2025-01-24 14:37 UTC (permalink / raw)
To: util-linux; +Cc: xiang, Karel Zak
Today, mkfs.erofs defaults to page size for block size, but blkid
does not recognize this. Increase the limit to 64k.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
V2: Test for too-small blocksize, and simplify too-large blocksize
test. (the prior > 31 || <shift test> was probably just avoiding
a shift overflow but there's really no reason, so just look directly
at blkszbits)
(There might be strange arches out there > 64k but I don't know if
erofs really works with blocks that big, so for now let's just
limit it to 64k?)
diff --git a/libblkid/src/superblocks/erofs.c b/libblkid/src/superblocks/erofs.c
index 05822460b..89620db47 100644
--- a/libblkid/src/superblocks/erofs.c
+++ b/libblkid/src/superblocks/erofs.c
@@ -73,8 +73,8 @@ static int probe_erofs(blkid_probe pr, const struct blkid_idmag *mag)
if (!sb)
return errno ? -errno : BLKID_PROBE_NONE;
- /* EROFS is restricted to 4KiB block size */
- if (sb->blkszbits > 31 || (1U << sb->blkszbits) > 4096)
+ /* block size must be between 512 and 64k */
+ if (sb->blkszbits < 9 || sb->blkszbits > 16)
return BLKID_PROBE_NONE;
if (!erofs_verify_checksum(pr, mag, sb))
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blkid: allow up to 64k erofs block sizes
2025-01-24 14:37 ` [PATCH V2] " Eric Sandeen
@ 2025-01-25 15:19 ` Gao Xiang
2025-01-30 9:49 ` Karel Zak
0 siblings, 1 reply; 5+ messages in thread
From: Gao Xiang @ 2025-01-25 15:19 UTC (permalink / raw)
To: Eric Sandeen; +Cc: util-linux, xiang, Karel Zak
On Fri, Jan 24, 2025 at 08:37:12AM -0600, Eric Sandeen wrote:
> Today, mkfs.erofs defaults to page size for block size, but blkid
> does not recognize this. Increase the limit to 64k.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Thanks,
Gao Xiang
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] blkid: allow up to 64k erofs block sizes
2025-01-25 15:19 ` Gao Xiang
@ 2025-01-30 9:49 ` Karel Zak
0 siblings, 0 replies; 5+ messages in thread
From: Karel Zak @ 2025-01-30 9:49 UTC (permalink / raw)
To: Gao Xiang; +Cc: Eric Sandeen, util-linux
On Sat, Jan 25, 2025 at 11:19:59PM GMT, Gao Xiang wrote:
> On Fri, Jan 24, 2025 at 08:37:12AM -0600, Eric Sandeen wrote:
> > Today, mkfs.erofs defaults to page size for block size, but blkid
> > does not recognize this. Increase the limit to 64k.
> >
> > Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>
> Reviewed-by: Gao Xiang <xiang@kernel.org>
Applied, thanks!
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-30 9:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 19:17 [PATCH] blkid: allow up to 64k erofs block sizes Eric Sandeen
2025-01-23 23:22 ` Gao Xiang
2025-01-24 14:37 ` [PATCH V2] " Eric Sandeen
2025-01-25 15:19 ` Gao Xiang
2025-01-30 9:49 ` Karel Zak
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).