Commit 31da107f authored by Yue Hu's avatar Yue Hu Committed by Gao Xiang

erofs: fold in z_erofs_reload_indexes()

The name of this function looks not very accurate compared to it's
implementation and it's only a wrapper to erofs_read_metabuf(). So,
let's fold it directly instead.
Signed-off-by: default avatarYue Hu <huyue2@coolpad.com>
Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20220927032518.25266-1-zbestahu@gmail.comSigned-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
parent 5c2a6425
...@@ -166,18 +166,6 @@ struct z_erofs_maprecorder { ...@@ -166,18 +166,6 @@ struct z_erofs_maprecorder {
bool partialref; bool partialref;
}; };
static int z_erofs_reload_indexes(struct z_erofs_maprecorder *m,
erofs_blk_t eblk)
{
struct super_block *const sb = m->inode->i_sb;
m->kaddr = erofs_read_metabuf(&m->map->buf, sb, eblk,
EROFS_KMAP_ATOMIC);
if (IS_ERR(m->kaddr))
return PTR_ERR(m->kaddr);
return 0;
}
static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,
unsigned long lcn) unsigned long lcn)
{ {
...@@ -190,11 +178,11 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m, ...@@ -190,11 +178,11 @@ static int legacy_load_cluster_from_disk(struct z_erofs_maprecorder *m,
lcn * sizeof(struct z_erofs_vle_decompressed_index); lcn * sizeof(struct z_erofs_vle_decompressed_index);
struct z_erofs_vle_decompressed_index *di; struct z_erofs_vle_decompressed_index *di;
unsigned int advise, type; unsigned int advise, type;
int err;
err = z_erofs_reload_indexes(m, erofs_blknr(pos)); m->kaddr = erofs_read_metabuf(&m->map->buf, inode->i_sb,
if (err) erofs_blknr(pos), EROFS_KMAP_ATOMIC);
return err; if (IS_ERR(m->kaddr))
return PTR_ERR(m->kaddr);
m->nextpackoff = pos + sizeof(struct z_erofs_vle_decompressed_index); m->nextpackoff = pos + sizeof(struct z_erofs_vle_decompressed_index);
m->lcn = lcn; m->lcn = lcn;
...@@ -393,7 +381,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, ...@@ -393,7 +381,6 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
unsigned int compacted_4b_initial, compacted_2b; unsigned int compacted_4b_initial, compacted_2b;
unsigned int amortizedshift; unsigned int amortizedshift;
erofs_off_t pos; erofs_off_t pos;
int err;
if (lclusterbits != 12) if (lclusterbits != 12)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -430,9 +417,10 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m, ...@@ -430,9 +417,10 @@ static int compacted_load_cluster_from_disk(struct z_erofs_maprecorder *m,
amortizedshift = 2; amortizedshift = 2;
out: out:
pos += lcn * (1 << amortizedshift); pos += lcn * (1 << amortizedshift);
err = z_erofs_reload_indexes(m, erofs_blknr(pos)); m->kaddr = erofs_read_metabuf(&m->map->buf, inode->i_sb,
if (err) erofs_blknr(pos), EROFS_KMAP_ATOMIC);
return err; if (IS_ERR(m->kaddr))
return PTR_ERR(m->kaddr);
return unpack_compacted_index(m, amortizedshift, pos, lookahead); return unpack_compacted_index(m, amortizedshift, pos, lookahead);
} }
......
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