diff options
author | Richard Weinberger <richard@nod.at> | 2018-06-12 03:33:16 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2018-08-14 18:06:15 -0400 |
commit | 25677478474a91fa1b46f19a4a591a9848bca6fb (patch) | |
tree | 4931be3d9fb2173565d2bde087b84682cbf7eb4d | |
parent | 59965593205fa4044850d35ee3557cf0b7edcd14 (diff) |
ubi: Initialize Fastmap checkmapping correctly
We cannot do it last, otherwithse it will be skipped for dynamic
volumes.
Reported-by: Lachmann, Juergen <juergen.lachmann@harman.com>
Fixes: 34653fd8c46e ("ubi: fastmap: Check each mapping only once")
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | drivers/mtd/ubi/vtbl.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 94d7a865b135..7504f430c011 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c | |||
@@ -579,6 +579,16 @@ static int init_volumes(struct ubi_device *ubi, | |||
579 | reserved_pebs += vol->reserved_pebs; | 579 | reserved_pebs += vol->reserved_pebs; |
580 | 580 | ||
581 | /* | 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 | |||
591 | /* | ||
582 | * In case of dynamic volume UBI knows nothing about how many | 592 | * In case of dynamic volume UBI knows nothing about how many |
583 | * data is stored there. So assume the whole volume is used. | 593 | * data is stored there. So assume the whole volume is used. |
584 | */ | 594 | */ |
@@ -620,16 +630,6 @@ static int init_volumes(struct ubi_device *ubi, | |||
620 | (long long)(vol->used_ebs - 1) * vol->usable_leb_size; | 630 | (long long)(vol->used_ebs - 1) * vol->usable_leb_size; |
621 | vol->used_bytes += av->last_data_size; | 631 | vol->used_bytes += av->last_data_size; |
622 | vol->last_eb_bytes = av->last_data_size; | 632 | 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; | ||
633 | } | 633 | } |
634 | 634 | ||
635 | /* And add the layout volume */ | 635 | /* And add the layout volume */ |