Commit 25677478 authored by Richard Weinberger's avatar Richard Weinberger

ubi: Initialize Fastmap checkmapping correctly

We cannot do it last, otherwithse it will be skipped for dynamic
volumes.
Reported-by: default avatarLachmann, Juergen <juergen.lachmann@harman.com>
Fixes: 34653fd8 ("ubi: fastmap: Check each mapping only once")
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent 59965593
...@@ -578,6 +578,16 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -578,6 +578,16 @@ static int init_volumes(struct ubi_device *ubi,
vol->ubi = ubi; vol->ubi = ubi;
reserved_pebs += vol->reserved_pebs; reserved_pebs += vol->reserved_pebs;
/*
* We use ubi->peb_count and not vol->reserved_pebs because
* we want to keep the code simple. Otherwise we'd have to
* resize/check the bitmap upon volume resize too.
* Allocating a few bytes more does not hurt.
*/
err = ubi_fastmap_init_checkmap(vol, ubi->peb_count);
if (err)
return err;
/* /*
* In case of dynamic volume UBI knows nothing about how many * In case of dynamic volume UBI knows nothing about how many
* data is stored there. So assume the whole volume is used. * data is stored there. So assume the whole volume is used.
...@@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi, ...@@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi,
(long long)(vol->used_ebs - 1) * vol->usable_leb_size; (long long)(vol->used_ebs - 1) * vol->usable_leb_size;
vol->used_bytes += av->last_data_size; vol->used_bytes += av->last_data_size;
vol->last_eb_bytes = av->last_data_size; vol->last_eb_bytes = av->last_data_size;
/*
* We use ubi->peb_count and not vol->reserved_pebs because
* we want to keep the code simple. Otherwise we'd have to
* resize/check the bitmap upon volume resize too.
* Allocating a few bytes more does not hurt.
*/
err = ubi_fastmap_init_checkmap(vol, ubi->peb_count);
if (err)
return err;
} }
/* And add the layout volume */ /* And add the layout volume */
......
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