Skip to content

Commit 2567747

Browse files
ubi: Initialize Fastmap checkmapping correctly
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]>
1 parent 5996559 commit 2567747

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

drivers/mtd/ubi/vtbl.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,16 @@ static int init_volumes(struct ubi_device *ubi,
578578
vol->ubi = ubi;
579579
reserved_pebs += vol->reserved_pebs;
580580

581+
/*
582+
* We use ubi->peb_count and not vol->reserved_pebs because
583+
* we want to keep the code simple. Otherwise we'd have to
584+
* resize/check the bitmap upon volume resize too.
585+
* Allocating a few bytes more does not hurt.
586+
*/
587+
err = ubi_fastmap_init_checkmap(vol, ubi->peb_count);
588+
if (err)
589+
return err;
590+
581591
/*
582592
* In case of dynamic volume UBI knows nothing about how many
583593
* data is stored there. So assume the whole volume is used.
@@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi,
620630
(long long)(vol->used_ebs - 1) * vol->usable_leb_size;
621631
vol->used_bytes += av->last_data_size;
622632
vol->last_eb_bytes = av->last_data_size;
623-
624-
/*
625-
* We use ubi->peb_count and not vol->reserved_pebs because
626-
* we want to keep the code simple. Otherwise we'd have to
627-
* resize/check the bitmap upon volume resize too.
628-
* Allocating a few bytes more does not hurt.
629-
*/
630-
err = ubi_fastmap_init_checkmap(vol, ubi->peb_count);
631-
if (err)
632-
return err;
633633
}
634634

635635
/* And add the layout volume */

0 commit comments

Comments
 (0)