mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 06:20:54 +07:00
UBI: Fastmap: Rename variables to make them meaningful
s/fmpl1/fmpl s/fmpl2/fmpl_wl Add "WL" to the error message when wrong WL pool magic number is detected. Signed-off-by: Sheng Yong <shengyong1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
parent
a18fd67267
commit
f6e951af34
@ -601,7 +601,7 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
|
||||
struct ubi_ainf_peb *aeb, *tmp_aeb, *_tmp_aeb;
|
||||
struct ubi_fm_sb *fmsb;
|
||||
struct ubi_fm_hdr *fmhdr;
|
||||
struct ubi_fm_scan_pool *fmpl1, *fmpl2;
|
||||
struct ubi_fm_scan_pool *fmpl, *fmpl_wl;
|
||||
struct ubi_fm_ec *fmec;
|
||||
struct ubi_fm_volhdr *fmvhdr;
|
||||
struct ubi_fm_eba *fm_eba;
|
||||
@ -631,30 +631,30 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
|
||||
goto fail_bad;
|
||||
}
|
||||
|
||||
fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl1);
|
||||
fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl);
|
||||
if (fm_pos >= fm_size)
|
||||
goto fail_bad;
|
||||
if (be32_to_cpu(fmpl1->magic) != UBI_FM_POOL_MAGIC) {
|
||||
if (be32_to_cpu(fmpl->magic) != UBI_FM_POOL_MAGIC) {
|
||||
ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
|
||||
be32_to_cpu(fmpl1->magic), UBI_FM_POOL_MAGIC);
|
||||
be32_to_cpu(fmpl->magic), UBI_FM_POOL_MAGIC);
|
||||
goto fail_bad;
|
||||
}
|
||||
|
||||
fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl2);
|
||||
fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl_wl);
|
||||
if (fm_pos >= fm_size)
|
||||
goto fail_bad;
|
||||
if (be32_to_cpu(fmpl2->magic) != UBI_FM_POOL_MAGIC) {
|
||||
ubi_err(ubi, "bad fastmap pool magic: 0x%x, expected: 0x%x",
|
||||
be32_to_cpu(fmpl2->magic), UBI_FM_POOL_MAGIC);
|
||||
if (be32_to_cpu(fmpl_wl->magic) != UBI_FM_POOL_MAGIC) {
|
||||
ubi_err(ubi, "bad fastmap WL pool magic: 0x%x, expected: 0x%x",
|
||||
be32_to_cpu(fmpl_wl->magic), UBI_FM_POOL_MAGIC);
|
||||
goto fail_bad;
|
||||
}
|
||||
|
||||
pool_size = be16_to_cpu(fmpl1->size);
|
||||
wl_pool_size = be16_to_cpu(fmpl2->size);
|
||||
fm->max_pool_size = be16_to_cpu(fmpl1->max_size);
|
||||
fm->max_wl_pool_size = be16_to_cpu(fmpl2->max_size);
|
||||
pool_size = be16_to_cpu(fmpl->size);
|
||||
wl_pool_size = be16_to_cpu(fmpl_wl->size);
|
||||
fm->max_pool_size = be16_to_cpu(fmpl->max_size);
|
||||
fm->max_wl_pool_size = be16_to_cpu(fmpl_wl->max_size);
|
||||
|
||||
if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) {
|
||||
ubi_err(ubi, "bad pool size: %i", pool_size);
|
||||
@ -796,11 +796,11 @@ static int ubi_attach_fastmap(struct ubi_device *ubi,
|
||||
}
|
||||
}
|
||||
|
||||
ret = scan_pool(ubi, ai, fmpl1->pebs, pool_size, &max_sqnum, &free);
|
||||
ret = scan_pool(ubi, ai, fmpl->pebs, pool_size, &max_sqnum, &free);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
ret = scan_pool(ubi, ai, fmpl2->pebs, wl_pool_size, &max_sqnum, &free);
|
||||
ret = scan_pool(ubi, ai, fmpl_wl->pebs, wl_pool_size, &max_sqnum, &free);
|
||||
if (ret)
|
||||
goto fail;
|
||||
|
||||
@ -1083,7 +1083,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
|
||||
void *fm_raw;
|
||||
struct ubi_fm_sb *fmsb;
|
||||
struct ubi_fm_hdr *fmh;
|
||||
struct ubi_fm_scan_pool *fmpl1, *fmpl2;
|
||||
struct ubi_fm_scan_pool *fmpl, *fmpl_wl;
|
||||
struct ubi_fm_ec *fec;
|
||||
struct ubi_fm_volhdr *fvh;
|
||||
struct ubi_fm_eba *feba;
|
||||
@ -1141,25 +1141,25 @@ static int ubi_write_fastmap(struct ubi_device *ubi,
|
||||
erase_peb_count = 0;
|
||||
vol_count = 0;
|
||||
|
||||
fmpl1 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl1);
|
||||
fmpl1->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
|
||||
fmpl1->size = cpu_to_be16(ubi->fm_pool.size);
|
||||
fmpl1->max_size = cpu_to_be16(ubi->fm_pool.max_size);
|
||||
fmpl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl);
|
||||
fmpl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
|
||||
fmpl->size = cpu_to_be16(ubi->fm_pool.size);
|
||||
fmpl->max_size = cpu_to_be16(ubi->fm_pool.max_size);
|
||||
|
||||
for (i = 0; i < ubi->fm_pool.size; i++) {
|
||||
fmpl1->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]);
|
||||
fmpl->pebs[i] = cpu_to_be32(ubi->fm_pool.pebs[i]);
|
||||
set_seen(ubi, ubi->fm_pool.pebs[i], seen_pebs);
|
||||
}
|
||||
|
||||
fmpl2 = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl2);
|
||||
fmpl2->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
|
||||
fmpl2->size = cpu_to_be16(ubi->fm_wl_pool.size);
|
||||
fmpl2->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size);
|
||||
fmpl_wl = (struct ubi_fm_scan_pool *)(fm_raw + fm_pos);
|
||||
fm_pos += sizeof(*fmpl_wl);
|
||||
fmpl_wl->magic = cpu_to_be32(UBI_FM_POOL_MAGIC);
|
||||
fmpl_wl->size = cpu_to_be16(ubi->fm_wl_pool.size);
|
||||
fmpl_wl->max_size = cpu_to_be16(ubi->fm_wl_pool.max_size);
|
||||
|
||||
for (i = 0; i < ubi->fm_wl_pool.size; i++) {
|
||||
fmpl2->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]);
|
||||
fmpl_wl->pebs[i] = cpu_to_be32(ubi->fm_wl_pool.pebs[i]);
|
||||
set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user