diff options
author | Richard Weinberger <richard@nod.at> | 2014-10-28 11:24:27 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2015-03-26 17:47:35 -0400 |
commit | c5c3f3cf969e45c53345283fce0ba11fae7abd32 (patch) | |
tree | 264f422dcafbf358bef151808a7d20b9e1c7d8e7 | |
parent | 23c482ef7b7611225f70efe46a3627b889cab1a4 (diff) |
UBI: Fastmap: Wire up WL accessor functions
Use the new WL accessor functions in fastmap.
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | drivers/mtd/ubi/fastmap.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 13492fef6471..02a6de2f53ee 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c | |||
@@ -1087,11 +1087,11 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1087 | struct ubi_fm_ec *fec; | 1087 | struct ubi_fm_ec *fec; |
1088 | struct ubi_fm_volhdr *fvh; | 1088 | struct ubi_fm_volhdr *fvh; |
1089 | struct ubi_fm_eba *feba; | 1089 | struct ubi_fm_eba *feba; |
1090 | struct rb_node *node; | ||
1091 | struct ubi_wl_entry *wl_e; | 1090 | struct ubi_wl_entry *wl_e; |
1092 | struct ubi_volume *vol; | 1091 | struct ubi_volume *vol; |
1093 | struct ubi_vid_hdr *avhdr, *dvhdr; | 1092 | struct ubi_vid_hdr *avhdr, *dvhdr; |
1094 | struct ubi_work *ubi_wrk; | 1093 | struct ubi_work *ubi_wrk; |
1094 | struct rb_node *tmp_rb; | ||
1095 | int ret, i, j, free_peb_count, used_peb_count, vol_count; | 1095 | int ret, i, j, free_peb_count, used_peb_count, vol_count; |
1096 | int scrub_peb_count, erase_peb_count; | 1096 | int scrub_peb_count, erase_peb_count; |
1097 | int *seen_pebs = NULL; | 1097 | int *seen_pebs = NULL; |
@@ -1163,8 +1163,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1163 | set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs); | 1163 | set_seen(ubi, ubi->fm_wl_pool.pebs[i], seen_pebs); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | for (node = rb_first(&ubi->free); node; node = rb_next(node)) { | 1166 | ubi_for_each_free_peb(ubi, wl_e, tmp_rb) { |
1167 | wl_e = rb_entry(node, struct ubi_wl_entry, u.rb); | ||
1168 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); | 1167 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); |
1169 | 1168 | ||
1170 | fec->pnum = cpu_to_be32(wl_e->pnum); | 1169 | fec->pnum = cpu_to_be32(wl_e->pnum); |
@@ -1177,8 +1176,7 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1177 | } | 1176 | } |
1178 | fmh->free_peb_count = cpu_to_be32(free_peb_count); | 1177 | fmh->free_peb_count = cpu_to_be32(free_peb_count); |
1179 | 1178 | ||
1180 | for (node = rb_first(&ubi->used); node; node = rb_next(node)) { | 1179 | ubi_for_each_used_peb(ubi, wl_e, tmp_rb) { |
1181 | wl_e = rb_entry(node, struct ubi_wl_entry, u.rb); | ||
1182 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); | 1180 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); |
1183 | 1181 | ||
1184 | fec->pnum = cpu_to_be32(wl_e->pnum); | 1182 | fec->pnum = cpu_to_be32(wl_e->pnum); |
@@ -1190,22 +1188,20 @@ static int ubi_write_fastmap(struct ubi_device *ubi, | |||
1190 | ubi_assert(fm_pos <= ubi->fm_size); | 1188 | ubi_assert(fm_pos <= ubi->fm_size); |
1191 | } | 1189 | } |
1192 | 1190 | ||
1193 | for (i = 0; i < UBI_PROT_QUEUE_LEN; i++) { | 1191 | ubi_for_each_protected_peb(ubi, i, wl_e) { |
1194 | list_for_each_entry(wl_e, &ubi->pq[i], u.list) { | 1192 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); |
1195 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); | ||
1196 | 1193 | ||
1197 | fec->pnum = cpu_to_be32(wl_e->pnum); | 1194 | fec->pnum = cpu_to_be32(wl_e->pnum); |
1198 | fec->ec = cpu_to_be32(wl_e->ec); | 1195 | set_seen(ubi, wl_e->pnum, seen_pebs); |
1196 | fec->ec = cpu_to_be32(wl_e->ec); | ||
1199 | 1197 | ||
1200 | used_peb_count++; | 1198 | used_peb_count++; |
1201 | fm_pos += sizeof(*fec); | 1199 | fm_pos += sizeof(*fec); |
1202 | ubi_assert(fm_pos <= ubi->fm_size); | 1200 | ubi_assert(fm_pos <= ubi->fm_size); |
1203 | } | ||
1204 | } | 1201 | } |
1205 | fmh->used_peb_count = cpu_to_be32(used_peb_count); | 1202 | fmh->used_peb_count = cpu_to_be32(used_peb_count); |
1206 | 1203 | ||
1207 | for (node = rb_first(&ubi->scrub); node; node = rb_next(node)) { | 1204 | ubi_for_each_scrub_peb(ubi, wl_e, tmp_rb) { |
1208 | wl_e = rb_entry(node, struct ubi_wl_entry, u.rb); | ||
1209 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); | 1205 | fec = (struct ubi_fm_ec *)(fm_raw + fm_pos); |
1210 | 1206 | ||
1211 | fec->pnum = cpu_to_be32(wl_e->pnum); | 1207 | fec->pnum = cpu_to_be32(wl_e->pnum); |