Skip to content

Commit

Permalink
ubi: Initialize Fastmap checkmapping correctly
Browse files Browse the repository at this point in the history
We cannot do it last, otherwithse it will be skipped for dynamic
volumes.

Reported-by: Lachmann, Juergen <[email protected]>
Fixes: 34653fd ("ubi: fastmap: Check each mapping only once")
Signed-off-by: Richard Weinberger <[email protected]>
  • Loading branch information
richardweinberger committed Aug 14, 2018
1 parent 5996559 commit 2567747
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions drivers/mtd/ubi/vtbl.c
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,16 @@ static int init_volumes(struct ubi_device *ubi,
vol->ubi = ubi;
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
* data is stored there. So assume the whole volume is used.
Expand Down Expand Up @@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi,
(long long)(vol->used_ebs - 1) * vol->usable_leb_size;
vol->used_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 */
Expand Down

0 comments on commit 2567747

Please sign in to comment.