<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p><br>
</p>
<div class="moz-cite-prefix">On 2024/10/15 15:52, Gao Xiang wrote:<br>
</div>
<blockquote type="cite"
cite="mid:b0c38bac-a682-45ae-8991-b73991ae6ddb@linux.alibaba.com">
<br>
<br>
On 2024/10/15 15:07, Hongzhen Luo wrote:
<br>
<blockquote type="cite">Adjust sb->s_blocksize{,_bits} directly
for file-backed
<br>
mounts when the fs block size is smaller than PAGE_SIZE.
<br>
<br>
Previously, EROFS used sb_set_blocksize(), which caused
<br>
a panic if bdev-backed mounts is not used.
<br>
<br>
Fixes: fb176750266a ("erofs: add file-backed mount support")
<br>
Signed-off-by: Hongzhen Luo <a class="moz-txt-link-rfc2396E" href="mailto:hongzhen@linux.alibaba.com"><hongzhen@linux.alibaba.com></a>
<br>
---
<br>
v3: Fix trivial typos.
<br>
v2:
<a class="moz-txt-link-freetext" href="https://lore.kernel.org/linux-erofs/20241015064007.3449582-1-hongzhen@linux.alibaba.com/">https://lore.kernel.org/linux-erofs/20241015064007.3449582-1-hongzhen@linux.alibaba.com/</a><br>
v1:
<a class="moz-txt-link-freetext" href="https://lore.kernel.org/linux-erofs/20241015033601.3206952-1-hongzhen@linux.alibaba.com/">https://lore.kernel.org/linux-erofs/20241015033601.3206952-1-hongzhen@linux.alibaba.com/</a><br>
---
<br>
fs/erofs/super.c | 6 +++++-
<br>
1 file changed, 5 insertions(+), 1 deletion(-)
<br>
<br>
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
<br>
index 320d586c3896..ca45dfb17d7c 100644
<br>
--- a/fs/erofs/super.c
<br>
+++ b/fs/erofs/super.c
<br>
@@ -631,7 +631,11 @@ static int erofs_fc_fill_super(struct
super_block *sb, struct fs_context *fc)
<br>
errorfc(fc, "unsupported blksize for fscache
mode");
<br>
return -EINVAL;
<br>
}
<br>
- if (!sb_set_blocksize(sb, 1 <<
sbi->blkszbits)) {
<br>
+
<br>
+ if (erofs_is_fileio_mode(sbi)) {
<br>
+ sb->s_blocksize = (1 <<
sbi->blkszbits);
<br>
</blockquote>
<br>
Why needing parentheses here?
<br>
<br>
Thanks,
<br>
Gao Xiang
<br>
</blockquote>
<p>I will resend a version without the parentheses soon.<span
style="color: rgb(51, 51, 51); font-family: PingFangSC-Regular; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; white-space: pre-line; background-color: rgb(249, 250, 255); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;"></span></p>
<p>---</p>
<p>Thanks,</p>
<p>Hongzhen<br>
</p>
<blockquote type="cite"
cite="mid:b0c38bac-a682-45ae-8991-b73991ae6ddb@linux.alibaba.com">
<br>
<blockquote type="cite">+ sb->s_blocksize_bits =
sbi->blkszbits;
<br>
+ } else if (!sb_set_blocksize(sb, 1 <<
sbi->blkszbits)) {
<br>
errorfc(fc, "failed to set erofs blksize");
<br>
return -EINVAL;
<br>
}
<br>
</blockquote>
</blockquote>
</body>
</html>