Commit ed6e0401 authored by Jeffle Xu's avatar Jeffle Xu Committed by Gao Xiang

erofs: use meta buffers for erofs_read_superblock()

The only change is that, meta buffers read cache page without __GFP_FS
flag, which shall not matter.

Link: https://lore.kernel.org/r/20220209060108.43051-7-jefflexu@linux.alibaba.comSigned-off-by: default avatarJeffle Xu <jefflexu@linux.alibaba.com>
Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
parent ffb217a1
...@@ -281,21 +281,19 @@ static int erofs_init_devices(struct super_block *sb, ...@@ -281,21 +281,19 @@ static int erofs_init_devices(struct super_block *sb,
static int erofs_read_superblock(struct super_block *sb) static int erofs_read_superblock(struct super_block *sb)
{ {
struct erofs_sb_info *sbi; struct erofs_sb_info *sbi;
struct page *page; struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
struct erofs_super_block *dsb; struct erofs_super_block *dsb;
unsigned int blkszbits; unsigned int blkszbits;
void *data; void *data;
int ret; int ret;
page = read_mapping_page(sb->s_bdev->bd_inode->i_mapping, 0, NULL); data = erofs_read_metabuf(&buf, sb, 0, EROFS_KMAP);
if (IS_ERR(page)) { if (IS_ERR(data)) {
erofs_err(sb, "cannot read erofs superblock"); erofs_err(sb, "cannot read erofs superblock");
return PTR_ERR(page); return PTR_ERR(data);
} }
sbi = EROFS_SB(sb); sbi = EROFS_SB(sb);
data = kmap(page);
dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET); dsb = (struct erofs_super_block *)(data + EROFS_SUPER_OFFSET);
ret = -EINVAL; ret = -EINVAL;
...@@ -365,8 +363,7 @@ static int erofs_read_superblock(struct super_block *sb) ...@@ -365,8 +363,7 @@ static int erofs_read_superblock(struct super_block *sb)
if (erofs_sb_has_ztailpacking(sbi)) if (erofs_sb_has_ztailpacking(sbi))
erofs_info(sb, "EXPERIMENTAL compressed inline data feature in use. Use at your own risk!"); erofs_info(sb, "EXPERIMENTAL compressed inline data feature in use. Use at your own risk!");
out: out:
kunmap(page); erofs_put_metabuf(&buf);
put_page(page);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment