aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@linux.intel.com>2012-05-17 01:26:24 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-20 13:26:02 -0400
commit2c5ec5ce66c0170829c5c128b9235429936442ac (patch)
tree7010d8c62bcad3ce725096971cebdcd0289cd648 /drivers/mtd
parent55e93e55aaa9c38e45767bf3c963d03082f28978 (diff)
UBI: rename seb to aeb
After re-naming the 'struct ubi_scan_leb' we should adjust all variables named 'seb' to something else, because 'seb' stands for "scanning eraseblock". Let's rename it to 'aeb' which stands for "attaching eraseblock" which is a bit more consistend and has the same length. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/debug.c16
-rw-r--r--drivers/mtd/ubi/debug.h2
-rw-r--r--drivers/mtd/ubi/eba.c10
-rw-r--r--drivers/mtd/ubi/scan.c296
-rw-r--r--drivers/mtd/ubi/scan.h10
-rw-r--r--drivers/mtd/ubi/vtbl.c36
-rw-r--r--drivers/mtd/ubi/wl.c22
7 files changed, 196 insertions, 196 deletions
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c
index 4885fd2526bb..e73b1fef897d 100644
--- a/drivers/mtd/ubi/debug.c
+++ b/drivers/mtd/ubi/debug.c
@@ -188,19 +188,19 @@ void ubi_dump_sv(const struct ubi_ainf_volume *sv)
188} 188}
189 189
190/** 190/**
191 * ubi_dump_seb - dump a &struct ubi_ainf_peb object. 191 * ubi_dump_aeb - dump a &struct ubi_ainf_peb object.
192 * @seb: the object to dump 192 * @aeb: the object to dump
193 * @type: object type: 0 - not corrupted, 1 - corrupted 193 * @type: object type: 0 - not corrupted, 1 - corrupted
194 */ 194 */
195void ubi_dump_seb(const struct ubi_ainf_peb *seb, int type) 195void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type)
196{ 196{
197 printk(KERN_DEBUG "eraseblock scanning information dump:\n"); 197 printk(KERN_DEBUG "eraseblock scanning information dump:\n");
198 printk(KERN_DEBUG "\tec %d\n", seb->ec); 198 printk(KERN_DEBUG "\tec %d\n", aeb->ec);
199 printk(KERN_DEBUG "\tpnum %d\n", seb->pnum); 199 printk(KERN_DEBUG "\tpnum %d\n", aeb->pnum);
200 if (type == 0) { 200 if (type == 0) {
201 printk(KERN_DEBUG "\tlnum %d\n", seb->lnum); 201 printk(KERN_DEBUG "\tlnum %d\n", aeb->lnum);
202 printk(KERN_DEBUG "\tscrub %d\n", seb->scrub); 202 printk(KERN_DEBUG "\tscrub %d\n", aeb->scrub);
203 printk(KERN_DEBUG "\tsqnum %llu\n", seb->sqnum); 203 printk(KERN_DEBUG "\tsqnum %llu\n", aeb->sqnum);
204 } 204 }
205} 205}
206 206
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h
index 041ee4d43dec..a0911c0c1064 100644
--- a/drivers/mtd/ubi/debug.h
+++ b/drivers/mtd/ubi/debug.h
@@ -60,7 +60,7 @@ void ubi_dump_vid_hdr(const struct ubi_vid_hdr *vid_hdr);
60void ubi_dump_vol_info(const struct ubi_volume *vol); 60void ubi_dump_vol_info(const struct ubi_volume *vol);
61void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx); 61void ubi_dump_vtbl_record(const struct ubi_vtbl_record *r, int idx);
62void ubi_dump_sv(const struct ubi_ainf_volume *sv); 62void ubi_dump_sv(const struct ubi_ainf_volume *sv);
63void ubi_dump_seb(const struct ubi_ainf_peb *seb, int type); 63void ubi_dump_aeb(const struct ubi_ainf_peb *aeb, int type);
64void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req); 64void ubi_dump_mkvol_req(const struct ubi_mkvol_req *req);
65int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset, 65int ubi_self_check_all_ff(struct ubi_device *ubi, int pnum, int offset,
66 int len); 66 int len);
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 264482fc78a0..25095026617d 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -1217,7 +1217,7 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
1217 int i, j, err, num_volumes; 1217 int i, j, err, num_volumes;
1218 struct ubi_ainf_volume *sv; 1218 struct ubi_ainf_volume *sv;
1219 struct ubi_volume *vol; 1219 struct ubi_volume *vol;
1220 struct ubi_ainf_peb *seb; 1220 struct ubi_ainf_peb *aeb;
1221 struct rb_node *rb; 1221 struct rb_node *rb;
1222 1222
1223 dbg_eba("initialize EBA sub-system"); 1223 dbg_eba("initialize EBA sub-system");
@@ -1250,14 +1250,14 @@ int ubi_eba_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
1250 if (!sv) 1250 if (!sv)
1251 continue; 1251 continue;
1252 1252
1253 ubi_rb_for_each_entry(rb, seb, &sv->root, u.rb) { 1253 ubi_rb_for_each_entry(rb, aeb, &sv->root, u.rb) {
1254 if (seb->lnum >= vol->reserved_pebs) 1254 if (aeb->lnum >= vol->reserved_pebs)
1255 /* 1255 /*
1256 * This may happen in case of an unclean reboot 1256 * This may happen in case of an unclean reboot
1257 * during re-size. 1257 * during re-size.
1258 */ 1258 */
1259 ubi_scan_move_to_list(sv, seb, &si->erase); 1259 ubi_scan_move_to_list(sv, aeb, &si->erase);
1260 vol->eba_tbl[seb->lnum] = seb->pnum; 1260 vol->eba_tbl[aeb->lnum] = aeb->pnum;
1261 } 1261 }
1262 } 1262 }
1263 1263
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index c9891776eb27..c53ef5d9b134 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -113,7 +113,7 @@ static struct ubi_vid_hdr *vidh;
113static int add_to_list(struct ubi_attach_info *si, int pnum, int ec, 113static int add_to_list(struct ubi_attach_info *si, int pnum, int ec,
114 int to_head, struct list_head *list) 114 int to_head, struct list_head *list)
115{ 115{
116 struct ubi_ainf_peb *seb; 116 struct ubi_ainf_peb *aeb;
117 117
118 if (list == &si->free) { 118 if (list == &si->free) {
119 dbg_bld("add to free: PEB %d, EC %d", pnum, ec); 119 dbg_bld("add to free: PEB %d, EC %d", pnum, ec);
@@ -125,16 +125,16 @@ static int add_to_list(struct ubi_attach_info *si, int pnum, int ec,
125 } else 125 } else
126 BUG(); 126 BUG();
127 127
128 seb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL); 128 aeb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL);
129 if (!seb) 129 if (!aeb)
130 return -ENOMEM; 130 return -ENOMEM;
131 131
132 seb->pnum = pnum; 132 aeb->pnum = pnum;
133 seb->ec = ec; 133 aeb->ec = ec;
134 if (to_head) 134 if (to_head)
135 list_add(&seb->u.list, list); 135 list_add(&aeb->u.list, list);
136 else 136 else
137 list_add_tail(&seb->u.list, list); 137 list_add_tail(&aeb->u.list, list);
138 return 0; 138 return 0;
139} 139}
140 140
@@ -150,18 +150,18 @@ static int add_to_list(struct ubi_attach_info *si, int pnum, int ec,
150 */ 150 */
151static int add_corrupted(struct ubi_attach_info *si, int pnum, int ec) 151static int add_corrupted(struct ubi_attach_info *si, int pnum, int ec)
152{ 152{
153 struct ubi_ainf_peb *seb; 153 struct ubi_ainf_peb *aeb;
154 154
155 dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec); 155 dbg_bld("add to corrupted: PEB %d, EC %d", pnum, ec);
156 156
157 seb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL); 157 aeb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL);
158 if (!seb) 158 if (!aeb)
159 return -ENOMEM; 159 return -ENOMEM;
160 160
161 si->corr_peb_count += 1; 161 si->corr_peb_count += 1;
162 seb->pnum = pnum; 162 aeb->pnum = pnum;
163 seb->ec = ec; 163 aeb->ec = ec;
164 list_add(&seb->u.list, &si->corr); 164 list_add(&aeb->u.list, &si->corr);
165 return 0; 165 return 0;
166} 166}
167 167
@@ -293,7 +293,7 @@ static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *si,
293/** 293/**
294 * compare_lebs - find out which logical eraseblock is newer. 294 * compare_lebs - find out which logical eraseblock is newer.
295 * @ubi: UBI device description object 295 * @ubi: UBI device description object
296 * @seb: first logical eraseblock to compare 296 * @aeb: first logical eraseblock to compare
297 * @pnum: physical eraseblock number of the second logical eraseblock to 297 * @pnum: physical eraseblock number of the second logical eraseblock to
298 * compare 298 * compare
299 * @vid_hdr: volume identifier header of the second logical eraseblock 299 * @vid_hdr: volume identifier header of the second logical eraseblock
@@ -302,7 +302,7 @@ static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *si,
302 * case of success this function returns a positive value, in case of failure, a 302 * case of success this function returns a positive value, in case of failure, a
303 * negative error code is returned. The success return codes use the following 303 * negative error code is returned. The success return codes use the following
304 * bits: 304 * bits:
305 * o bit 0 is cleared: the first PEB (described by @seb) is newer than the 305 * o bit 0 is cleared: the first PEB (described by @aeb) is newer than the
306 * second PEB (described by @pnum and @vid_hdr); 306 * second PEB (described by @pnum and @vid_hdr);
307 * o bit 0 is set: the second PEB is newer; 307 * o bit 0 is set: the second PEB is newer;
308 * o bit 1 is cleared: no bit-flips were detected in the newer LEB; 308 * o bit 1 is cleared: no bit-flips were detected in the newer LEB;
@@ -310,7 +310,7 @@ static struct ubi_ainf_volume *add_volume(struct ubi_attach_info *si,
310 * o bit 2 is cleared: the older LEB is not corrupted; 310 * o bit 2 is cleared: the older LEB is not corrupted;
311 * o bit 2 is set: the older LEB is corrupted. 311 * o bit 2 is set: the older LEB is corrupted.
312 */ 312 */
313static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb, 313static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *aeb,
314 int pnum, const struct ubi_vid_hdr *vid_hdr) 314 int pnum, const struct ubi_vid_hdr *vid_hdr)
315{ 315{
316 void *buf; 316 void *buf;
@@ -319,7 +319,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb,
319 struct ubi_vid_hdr *vh = NULL; 319 struct ubi_vid_hdr *vh = NULL;
320 unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum); 320 unsigned long long sqnum2 = be64_to_cpu(vid_hdr->sqnum);
321 321
322 if (sqnum2 == seb->sqnum) { 322 if (sqnum2 == aeb->sqnum) {
323 /* 323 /*
324 * This must be a really ancient UBI image which has been 324 * This must be a really ancient UBI image which has been
325 * created before sequence numbers support has been added. At 325 * created before sequence numbers support has been added. At
@@ -333,7 +333,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb,
333 } 333 }
334 334
335 /* Obviously the LEB with lower sequence counter is older */ 335 /* Obviously the LEB with lower sequence counter is older */
336 second_is_newer = (sqnum2 > seb->sqnum); 336 second_is_newer = (sqnum2 > aeb->sqnum);
337 337
338 /* 338 /*
339 * Now we know which copy is newer. If the copy flag of the PEB with 339 * Now we know which copy is newer. If the copy flag of the PEB with
@@ -352,7 +352,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb,
352 return 1; 352 return 1;
353 } 353 }
354 } else { 354 } else {
355 if (!seb->copy_flag) { 355 if (!aeb->copy_flag) {
356 /* It is not a copy, so it is newer */ 356 /* It is not a copy, so it is newer */
357 dbg_bld("first PEB %d is newer, copy_flag is unset", 357 dbg_bld("first PEB %d is newer, copy_flag is unset",
358 pnum); 358 pnum);
@@ -363,7 +363,7 @@ static int compare_lebs(struct ubi_device *ubi, const struct ubi_ainf_peb *seb,
363 if (!vh) 363 if (!vh)
364 return -ENOMEM; 364 return -ENOMEM;
365 365
366 pnum = seb->pnum; 366 pnum = aeb->pnum;
367 err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0); 367 err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
368 if (err) { 368 if (err) {
369 if (err == UBI_IO_BITFLIPS) 369 if (err == UBI_IO_BITFLIPS)
@@ -447,7 +447,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
447 int err, vol_id, lnum; 447 int err, vol_id, lnum;
448 unsigned long long sqnum; 448 unsigned long long sqnum;
449 struct ubi_ainf_volume *sv; 449 struct ubi_ainf_volume *sv;
450 struct ubi_ainf_peb *seb; 450 struct ubi_ainf_peb *aeb;
451 struct rb_node **p, *parent = NULL; 451 struct rb_node **p, *parent = NULL;
452 452
453 vol_id = be32_to_cpu(vid_hdr->vol_id); 453 vol_id = be32_to_cpu(vid_hdr->vol_id);
@@ -473,9 +473,9 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
473 int cmp_res; 473 int cmp_res;
474 474
475 parent = *p; 475 parent = *p;
476 seb = rb_entry(parent, struct ubi_ainf_peb, u.rb); 476 aeb = rb_entry(parent, struct ubi_ainf_peb, u.rb);
477 if (lnum != seb->lnum) { 477 if (lnum != aeb->lnum) {
478 if (lnum < seb->lnum) 478 if (lnum < aeb->lnum)
479 p = &(*p)->rb_left; 479 p = &(*p)->rb_left;
480 else 480 else
481 p = &(*p)->rb_right; 481 p = &(*p)->rb_right;
@@ -487,8 +487,8 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
487 * logical eraseblock present. 487 * logical eraseblock present.
488 */ 488 */
489 489
490 dbg_bld("this LEB already exists: PEB %d, sqnum %llu, " 490 dbg_bld("this LEB already exists: PEB %d, sqnum %llu, EC %d",
491 "EC %d", seb->pnum, seb->sqnum, seb->ec); 491 aeb->pnum, aeb->sqnum, aeb->ec);
492 492
493 /* 493 /*
494 * Make sure that the logical eraseblocks have different 494 * Make sure that the logical eraseblocks have different
@@ -503,10 +503,10 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
503 * images, but refuse attaching old images with duplicated 503 * images, but refuse attaching old images with duplicated
504 * logical eraseblocks because there was an unclean reboot. 504 * logical eraseblocks because there was an unclean reboot.
505 */ 505 */
506 if (seb->sqnum == sqnum && sqnum != 0) { 506 if (aeb->sqnum == sqnum && sqnum != 0) {
507 ubi_err("two LEBs with same sequence number %llu", 507 ubi_err("two LEBs with same sequence number %llu",
508 sqnum); 508 sqnum);
509 ubi_dump_seb(seb, 0); 509 ubi_dump_aeb(aeb, 0);
510 ubi_dump_vid_hdr(vid_hdr); 510 ubi_dump_vid_hdr(vid_hdr);
511 return -EINVAL; 511 return -EINVAL;
512 } 512 }
@@ -515,7 +515,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
515 * Now we have to drop the older one and preserve the newer 515 * Now we have to drop the older one and preserve the newer
516 * one. 516 * one.
517 */ 517 */
518 cmp_res = compare_lebs(ubi, seb, pnum, vid_hdr); 518 cmp_res = compare_lebs(ubi, aeb, pnum, vid_hdr);
519 if (cmp_res < 0) 519 if (cmp_res < 0)
520 return cmp_res; 520 return cmp_res;
521 521
@@ -528,16 +528,16 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
528 if (err) 528 if (err)
529 return err; 529 return err;
530 530
531 err = add_to_list(si, seb->pnum, seb->ec, cmp_res & 4, 531 err = add_to_list(si, aeb->pnum, aeb->ec, cmp_res & 4,
532 &si->erase); 532 &si->erase);
533 if (err) 533 if (err)
534 return err; 534 return err;
535 535
536 seb->ec = ec; 536 aeb->ec = ec;
537 seb->pnum = pnum; 537 aeb->pnum = pnum;
538 seb->scrub = ((cmp_res & 2) || bitflips); 538 aeb->scrub = ((cmp_res & 2) || bitflips);
539 seb->copy_flag = vid_hdr->copy_flag; 539 aeb->copy_flag = vid_hdr->copy_flag;
540 seb->sqnum = sqnum; 540 aeb->sqnum = sqnum;
541 541
542 if (sv->highest_lnum == lnum) 542 if (sv->highest_lnum == lnum)
543 sv->last_data_size = 543 sv->last_data_size =
@@ -563,16 +563,16 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
563 if (err) 563 if (err)
564 return err; 564 return err;
565 565
566 seb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL); 566 aeb = kmem_cache_alloc(si->scan_leb_slab, GFP_KERNEL);
567 if (!seb) 567 if (!aeb)
568 return -ENOMEM; 568 return -ENOMEM;
569 569
570 seb->ec = ec; 570 aeb->ec = ec;
571 seb->pnum = pnum; 571 aeb->pnum = pnum;
572 seb->lnum = lnum; 572 aeb->lnum = lnum;
573 seb->scrub = bitflips; 573 aeb->scrub = bitflips;
574 seb->copy_flag = vid_hdr->copy_flag; 574 aeb->copy_flag = vid_hdr->copy_flag;
575 seb->sqnum = sqnum; 575 aeb->sqnum = sqnum;
576 576
577 if (sv->highest_lnum <= lnum) { 577 if (sv->highest_lnum <= lnum) {
578 sv->highest_lnum = lnum; 578 sv->highest_lnum = lnum;
@@ -580,8 +580,8 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
580 } 580 }
581 581
582 sv->leb_count += 1; 582 sv->leb_count += 1;
583 rb_link_node(&seb->u.rb, parent, p); 583 rb_link_node(&aeb->u.rb, parent, p);
584 rb_insert_color(&seb->u.rb, &sv->root); 584 rb_insert_color(&aeb->u.rb, &sv->root);
585 return 0; 585 return 0;
586} 586}
587 587
@@ -615,26 +615,26 @@ struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si,
615} 615}
616 616
617/** 617/**
618 * ubi_scan_find_seb - find LEB in the volume scanning information. 618 * ubi_scan_find_aeb - find LEB in the volume scanning information.
619 * @sv: a pointer to the volume scanning information 619 * @sv: a pointer to the volume scanning information
620 * @lnum: the requested logical eraseblock 620 * @lnum: the requested logical eraseblock
621 * 621 *
622 * This function returns a pointer to the scanning logical eraseblock or %NULL 622 * This function returns a pointer to the scanning logical eraseblock or %NULL
623 * if there are no data about it in the scanning volume information. 623 * if there are no data about it in the scanning volume information.
624 */ 624 */
625struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv, 625struct ubi_ainf_peb *ubi_scan_find_aeb(const struct ubi_ainf_volume *sv,
626 int lnum) 626 int lnum)
627{ 627{
628 struct ubi_ainf_peb *seb; 628 struct ubi_ainf_peb *aeb;
629 struct rb_node *p = sv->root.rb_node; 629 struct rb_node *p = sv->root.rb_node;
630 630
631 while (p) { 631 while (p) {
632 seb = rb_entry(p, struct ubi_ainf_peb, u.rb); 632 aeb = rb_entry(p, struct ubi_ainf_peb, u.rb);
633 633
634 if (lnum == seb->lnum) 634 if (lnum == aeb->lnum)
635 return seb; 635 return aeb;
636 636
637 if (lnum > seb->lnum) 637 if (lnum > aeb->lnum)
638 p = p->rb_left; 638 p = p->rb_left;
639 else 639 else
640 p = p->rb_right; 640 p = p->rb_right;
@@ -651,14 +651,14 @@ struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv,
651void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv) 651void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
652{ 652{
653 struct rb_node *rb; 653 struct rb_node *rb;
654 struct ubi_ainf_peb *seb; 654 struct ubi_ainf_peb *aeb;
655 655
656 dbg_bld("remove scanning information about volume %d", sv->vol_id); 656 dbg_bld("remove scanning information about volume %d", sv->vol_id);
657 657
658 while ((rb = rb_first(&sv->root))) { 658 while ((rb = rb_first(&sv->root))) {
659 seb = rb_entry(rb, struct ubi_ainf_peb, u.rb); 659 aeb = rb_entry(rb, struct ubi_ainf_peb, u.rb);
660 rb_erase(&seb->u.rb, &sv->root); 660 rb_erase(&aeb->u.rb, &sv->root);
661 list_add_tail(&seb->u.list, &si->erase); 661 list_add_tail(&aeb->u.list, &si->erase);
662 } 662 }
663 663
664 rb_erase(&sv->rb, &si->volumes); 664 rb_erase(&sv->rb, &si->volumes);
@@ -729,13 +729,13 @@ struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
729 struct ubi_attach_info *si) 729 struct ubi_attach_info *si)
730{ 730{
731 int err = 0; 731 int err = 0;
732 struct ubi_ainf_peb *seb, *tmp_seb; 732 struct ubi_ainf_peb *aeb, *tmp_aeb;
733 733
734 if (!list_empty(&si->free)) { 734 if (!list_empty(&si->free)) {
735 seb = list_entry(si->free.next, struct ubi_ainf_peb, u.list); 735 aeb = list_entry(si->free.next, struct ubi_ainf_peb, u.list);
736 list_del(&seb->u.list); 736 list_del(&aeb->u.list);
737 dbg_bld("return free PEB %d, EC %d", seb->pnum, seb->ec); 737 dbg_bld("return free PEB %d, EC %d", aeb->pnum, aeb->ec);
738 return seb; 738 return aeb;
739 } 739 }
740 740
741 /* 741 /*
@@ -744,18 +744,18 @@ struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
744 * so forth. We don't want to take care about bad eraseblocks here - 744 * so forth. We don't want to take care about bad eraseblocks here -
745 * they'll be handled later. 745 * they'll be handled later.
746 */ 746 */
747 list_for_each_entry_safe(seb, tmp_seb, &si->erase, u.list) { 747 list_for_each_entry_safe(aeb, tmp_aeb, &si->erase, u.list) {
748 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 748 if (aeb->ec == UBI_SCAN_UNKNOWN_EC)
749 seb->ec = si->mean_ec; 749 aeb->ec = si->mean_ec;
750 750
751 err = ubi_scan_erase_peb(ubi, si, seb->pnum, seb->ec+1); 751 err = ubi_scan_erase_peb(ubi, si, aeb->pnum, aeb->ec+1);
752 if (err) 752 if (err)
753 continue; 753 continue;
754 754
755 seb->ec += 1; 755 aeb->ec += 1;
756 list_del(&seb->u.list); 756 list_del(&aeb->u.list);
757 dbg_bld("return PEB %d, EC %d", seb->pnum, seb->ec); 757 dbg_bld("return PEB %d, EC %d", aeb->pnum, aeb->ec);
758 return seb; 758 return aeb;
759 } 759 }
760 760
761 ubi_err("no free eraseblocks"); 761 ubi_err("no free eraseblocks");
@@ -1076,7 +1076,7 @@ adjust_mean_ec:
1076static int check_what_we_have(struct ubi_device *ubi, 1076static int check_what_we_have(struct ubi_device *ubi,
1077 struct ubi_attach_info *si) 1077 struct ubi_attach_info *si)
1078{ 1078{
1079 struct ubi_ainf_peb *seb; 1079 struct ubi_ainf_peb *aeb;
1080 int max_corr, peb_count; 1080 int max_corr, peb_count;
1081 1081
1082 peb_count = ubi->peb_count - si->bad_peb_count - si->alien_peb_count; 1082 peb_count = ubi->peb_count - si->bad_peb_count - si->alien_peb_count;
@@ -1091,8 +1091,8 @@ static int check_what_we_have(struct ubi_device *ubi,
1091 ubi_err("%d PEBs are corrupted and preserved", 1091 ubi_err("%d PEBs are corrupted and preserved",
1092 si->corr_peb_count); 1092 si->corr_peb_count);
1093 printk(KERN_ERR "Corrupted PEBs are:"); 1093 printk(KERN_ERR "Corrupted PEBs are:");
1094 list_for_each_entry(seb, &si->corr, u.list) 1094 list_for_each_entry(aeb, &si->corr, u.list)
1095 printk(KERN_CONT " %d", seb->pnum); 1095 printk(KERN_CONT " %d", aeb->pnum);
1096 printk(KERN_CONT "\n"); 1096 printk(KERN_CONT "\n");
1097 1097
1098 /* 1098 /*
@@ -1149,7 +1149,7 @@ struct ubi_attach_info *ubi_scan(struct ubi_device *ubi)
1149 int err, pnum; 1149 int err, pnum;
1150 struct rb_node *rb1, *rb2; 1150 struct rb_node *rb1, *rb2;
1151 struct ubi_ainf_volume *sv; 1151 struct ubi_ainf_volume *sv;
1152 struct ubi_ainf_peb *seb; 1152 struct ubi_ainf_peb *aeb;
1153 struct ubi_attach_info *si; 1153 struct ubi_attach_info *si;
1154 1154
1155 si = kzalloc(sizeof(struct ubi_attach_info), GFP_KERNEL); 1155 si = kzalloc(sizeof(struct ubi_attach_info), GFP_KERNEL);
@@ -1201,23 +1201,23 @@ struct ubi_attach_info *ubi_scan(struct ubi_device *ubi)
1201 * value. 1201 * value.
1202 */ 1202 */
1203 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) { 1203 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) {
1204 ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb) 1204 ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb)
1205 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 1205 if (aeb->ec == UBI_SCAN_UNKNOWN_EC)
1206 seb->ec = si->mean_ec; 1206 aeb->ec = si->mean_ec;
1207 } 1207 }
1208 1208
1209 list_for_each_entry(seb, &si->free, u.list) { 1209 list_for_each_entry(aeb, &si->free, u.list) {
1210 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 1210 if (aeb->ec == UBI_SCAN_UNKNOWN_EC)
1211 seb->ec = si->mean_ec; 1211 aeb->ec = si->mean_ec;
1212 } 1212 }
1213 1213
1214 list_for_each_entry(seb, &si->corr, u.list) 1214 list_for_each_entry(aeb, &si->corr, u.list)
1215 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 1215 if (aeb->ec == UBI_SCAN_UNKNOWN_EC)
1216 seb->ec = si->mean_ec; 1216 aeb->ec = si->mean_ec;
1217 1217
1218 list_for_each_entry(seb, &si->erase, u.list) 1218 list_for_each_entry(aeb, &si->erase, u.list)
1219 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 1219 if (aeb->ec == UBI_SCAN_UNKNOWN_EC)
1220 seb->ec = si->mean_ec; 1220 aeb->ec = si->mean_ec;
1221 1221
1222 err = self_check_si(ubi, si); 1222 err = self_check_si(ubi, si);
1223 if (err) 1223 if (err)
@@ -1247,7 +1247,7 @@ out_si:
1247 */ 1247 */
1248static void destroy_sv(struct ubi_attach_info *si, struct ubi_ainf_volume *sv) 1248static void destroy_sv(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
1249{ 1249{
1250 struct ubi_ainf_peb *seb; 1250 struct ubi_ainf_peb *aeb;
1251 struct rb_node *this = sv->root.rb_node; 1251 struct rb_node *this = sv->root.rb_node;
1252 1252
1253 while (this) { 1253 while (this) {
@@ -1256,16 +1256,16 @@ static void destroy_sv(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
1256 else if (this->rb_right) 1256 else if (this->rb_right)
1257 this = this->rb_right; 1257 this = this->rb_right;
1258 else { 1258 else {
1259 seb = rb_entry(this, struct ubi_ainf_peb, u.rb); 1259 aeb = rb_entry(this, struct ubi_ainf_peb, u.rb);
1260 this = rb_parent(this); 1260 this = rb_parent(this);
1261 if (this) { 1261 if (this) {
1262 if (this->rb_left == &seb->u.rb) 1262 if (this->rb_left == &aeb->u.rb)
1263 this->rb_left = NULL; 1263 this->rb_left = NULL;
1264 else 1264 else
1265 this->rb_right = NULL; 1265 this->rb_right = NULL;
1266 } 1266 }
1267 1267
1268 kmem_cache_free(si->scan_leb_slab, seb); 1268 kmem_cache_free(si->scan_leb_slab, aeb);
1269 } 1269 }
1270 } 1270 }
1271 kfree(sv); 1271 kfree(sv);
@@ -1277,25 +1277,25 @@ static void destroy_sv(struct ubi_attach_info *si, struct ubi_ainf_volume *sv)
1277 */ 1277 */
1278void ubi_scan_destroy_si(struct ubi_attach_info *si) 1278void ubi_scan_destroy_si(struct ubi_attach_info *si)
1279{ 1279{
1280 struct ubi_ainf_peb *seb, *seb_tmp; 1280 struct ubi_ainf_peb *aeb, *aeb_tmp;
1281 struct ubi_ainf_volume *sv; 1281 struct ubi_ainf_volume *sv;
1282 struct rb_node *rb; 1282 struct rb_node *rb;
1283 1283
1284 list_for_each_entry_safe(seb, seb_tmp, &si->alien, u.list) { 1284 list_for_each_entry_safe(aeb, aeb_tmp, &si->alien, u.list) {
1285 list_del(&seb->u.list); 1285 list_del(&aeb->u.list);
1286 kmem_cache_free(si->scan_leb_slab, seb); 1286 kmem_cache_free(si->scan_leb_slab, aeb);
1287 } 1287 }
1288 list_for_each_entry_safe(seb, seb_tmp, &si->erase, u.list) { 1288 list_for_each_entry_safe(aeb, aeb_tmp, &si->erase, u.list) {
1289 list_del(&seb->u.list); 1289 list_del(&aeb->u.list);
1290 kmem_cache_free(si->scan_leb_slab, seb); 1290 kmem_cache_free(si->scan_leb_slab, aeb);
1291 } 1291 }
1292 list_for_each_entry_safe(seb, seb_tmp, &si->corr, u.list) { 1292 list_for_each_entry_safe(aeb, aeb_tmp, &si->corr, u.list) {
1293 list_del(&seb->u.list); 1293 list_del(&aeb->u.list);
1294 kmem_cache_free(si->scan_leb_slab, seb); 1294 kmem_cache_free(si->scan_leb_slab, aeb);
1295 } 1295 }
1296 list_for_each_entry_safe(seb, seb_tmp, &si->free, u.list) { 1296 list_for_each_entry_safe(aeb, aeb_tmp, &si->free, u.list) {
1297 list_del(&seb->u.list); 1297 list_del(&aeb->u.list);
1298 kmem_cache_free(si->scan_leb_slab, seb); 1298 kmem_cache_free(si->scan_leb_slab, aeb);
1299 } 1299 }
1300 1300
1301 /* Destroy the volume RB-tree */ 1301 /* Destroy the volume RB-tree */
@@ -1339,7 +1339,7 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1339 int pnum, err, vols_found = 0; 1339 int pnum, err, vols_found = 0;
1340 struct rb_node *rb1, *rb2; 1340 struct rb_node *rb1, *rb2;
1341 struct ubi_ainf_volume *sv; 1341 struct ubi_ainf_volume *sv;
1342 struct ubi_ainf_peb *seb, *last_seb; 1342 struct ubi_ainf_peb *aeb, *last_aeb;
1343 uint8_t *buf; 1343 uint8_t *buf;
1344 1344
1345 if (!ubi->dbg->chk_gen) 1345 if (!ubi->dbg->chk_gen)
@@ -1390,51 +1390,51 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1390 goto bad_sv; 1390 goto bad_sv;
1391 } 1391 }
1392 1392
1393 last_seb = NULL; 1393 last_aeb = NULL;
1394 ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb) { 1394 ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) {
1395 cond_resched(); 1395 cond_resched();
1396 1396
1397 last_seb = seb; 1397 last_aeb = aeb;
1398 leb_count += 1; 1398 leb_count += 1;
1399 1399
1400 if (seb->pnum < 0 || seb->ec < 0) { 1400 if (aeb->pnum < 0 || aeb->ec < 0) {
1401 ubi_err("negative values"); 1401 ubi_err("negative values");
1402 goto bad_seb; 1402 goto bad_aeb;
1403 } 1403 }
1404 1404
1405 if (seb->ec < si->min_ec) { 1405 if (aeb->ec < si->min_ec) {
1406 ubi_err("bad si->min_ec (%d), %d found", 1406 ubi_err("bad si->min_ec (%d), %d found",
1407 si->min_ec, seb->ec); 1407 si->min_ec, aeb->ec);
1408 goto bad_seb; 1408 goto bad_aeb;
1409 } 1409 }
1410 1410
1411 if (seb->ec > si->max_ec) { 1411 if (aeb->ec > si->max_ec) {
1412 ubi_err("bad si->max_ec (%d), %d found", 1412 ubi_err("bad si->max_ec (%d), %d found",
1413 si->max_ec, seb->ec); 1413 si->max_ec, aeb->ec);
1414 goto bad_seb; 1414 goto bad_aeb;
1415 } 1415 }
1416 1416
1417 if (seb->pnum >= ubi->peb_count) { 1417 if (aeb->pnum >= ubi->peb_count) {
1418 ubi_err("too high PEB number %d, total PEBs %d", 1418 ubi_err("too high PEB number %d, total PEBs %d",
1419 seb->pnum, ubi->peb_count); 1419 aeb->pnum, ubi->peb_count);
1420 goto bad_seb; 1420 goto bad_aeb;
1421 } 1421 }
1422 1422
1423 if (sv->vol_type == UBI_STATIC_VOLUME) { 1423 if (sv->vol_type == UBI_STATIC_VOLUME) {
1424 if (seb->lnum >= sv->used_ebs) { 1424 if (aeb->lnum >= sv->used_ebs) {
1425 ubi_err("bad lnum or used_ebs"); 1425 ubi_err("bad lnum or used_ebs");
1426 goto bad_seb; 1426 goto bad_aeb;
1427 } 1427 }
1428 } else { 1428 } else {
1429 if (sv->used_ebs != 0) { 1429 if (sv->used_ebs != 0) {
1430 ubi_err("non-zero used_ebs"); 1430 ubi_err("non-zero used_ebs");
1431 goto bad_seb; 1431 goto bad_aeb;
1432 } 1432 }
1433 } 1433 }
1434 1434
1435 if (seb->lnum > sv->highest_lnum) { 1435 if (aeb->lnum > sv->highest_lnum) {
1436 ubi_err("incorrect highest_lnum or lnum"); 1436 ubi_err("incorrect highest_lnum or lnum");
1437 goto bad_seb; 1437 goto bad_aeb;
1438 } 1438 }
1439 } 1439 }
1440 1440
@@ -1444,14 +1444,14 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1444 goto bad_sv; 1444 goto bad_sv;
1445 } 1445 }
1446 1446
1447 if (!last_seb) 1447 if (!last_aeb)
1448 continue; 1448 continue;
1449 1449
1450 seb = last_seb; 1450 aeb = last_aeb;
1451 1451
1452 if (seb->lnum != sv->highest_lnum) { 1452 if (aeb->lnum != sv->highest_lnum) {
1453 ubi_err("bad highest_lnum"); 1453 ubi_err("bad highest_lnum");
1454 goto bad_seb; 1454 goto bad_aeb;
1455 } 1455 }
1456 } 1456 }
1457 1457
@@ -1463,15 +1463,15 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1463 1463
1464 /* Check that scanning information is correct */ 1464 /* Check that scanning information is correct */
1465 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) { 1465 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) {
1466 last_seb = NULL; 1466 last_aeb = NULL;
1467 ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb) { 1467 ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) {
1468 int vol_type; 1468 int vol_type;
1469 1469
1470 cond_resched(); 1470 cond_resched();
1471 1471
1472 last_seb = seb; 1472 last_aeb = aeb;
1473 1473
1474 err = ubi_io_read_vid_hdr(ubi, seb->pnum, vidh, 1); 1474 err = ubi_io_read_vid_hdr(ubi, aeb->pnum, vidh, 1);
1475 if (err && err != UBI_IO_BITFLIPS) { 1475 if (err && err != UBI_IO_BITFLIPS) {
1476 ubi_err("VID header is not OK (%d)", err); 1476 ubi_err("VID header is not OK (%d)", err);
1477 if (err > 0) 1477 if (err > 0)
@@ -1486,8 +1486,8 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1486 goto bad_vid_hdr; 1486 goto bad_vid_hdr;
1487 } 1487 }
1488 1488
1489 if (seb->sqnum != be64_to_cpu(vidh->sqnum)) { 1489 if (aeb->sqnum != be64_to_cpu(vidh->sqnum)) {
1490 ubi_err("bad sqnum %llu", seb->sqnum); 1490 ubi_err("bad sqnum %llu", aeb->sqnum);
1491 goto bad_vid_hdr; 1491 goto bad_vid_hdr;
1492 } 1492 }
1493 1493
@@ -1501,8 +1501,8 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1501 goto bad_vid_hdr; 1501 goto bad_vid_hdr;
1502 } 1502 }
1503 1503
1504 if (seb->lnum != be32_to_cpu(vidh->lnum)) { 1504 if (aeb->lnum != be32_to_cpu(vidh->lnum)) {
1505 ubi_err("bad lnum %d", seb->lnum); 1505 ubi_err("bad lnum %d", aeb->lnum);
1506 goto bad_vid_hdr; 1506 goto bad_vid_hdr;
1507 } 1507 }
1508 1508
@@ -1517,7 +1517,7 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1517 } 1517 }
1518 } 1518 }
1519 1519
1520 if (!last_seb) 1520 if (!last_aeb)
1521 continue; 1521 continue;
1522 1522
1523 if (sv->highest_lnum != be32_to_cpu(vidh->lnum)) { 1523 if (sv->highest_lnum != be32_to_cpu(vidh->lnum)) {
@@ -1549,20 +1549,20 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1549 } 1549 }
1550 1550
1551 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) 1551 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb)
1552 ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb) 1552 ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb)
1553 buf[seb->pnum] = 1; 1553 buf[aeb->pnum] = 1;
1554 1554
1555 list_for_each_entry(seb, &si->free, u.list) 1555 list_for_each_entry(aeb, &si->free, u.list)
1556 buf[seb->pnum] = 1; 1556 buf[aeb->pnum] = 1;
1557 1557
1558 list_for_each_entry(seb, &si->corr, u.list) 1558 list_for_each_entry(aeb, &si->corr, u.list)
1559 buf[seb->pnum] = 1; 1559 buf[aeb->pnum] = 1;
1560 1560
1561 list_for_each_entry(seb, &si->erase, u.list) 1561 list_for_each_entry(aeb, &si->erase, u.list)
1562 buf[seb->pnum] = 1; 1562 buf[aeb->pnum] = 1;
1563 1563
1564 list_for_each_entry(seb, &si->alien, u.list) 1564 list_for_each_entry(aeb, &si->alien, u.list)
1565 buf[seb->pnum] = 1; 1565 buf[aeb->pnum] = 1;
1566 1566
1567 err = 0; 1567 err = 0;
1568 for (pnum = 0; pnum < ubi->peb_count; pnum++) 1568 for (pnum = 0; pnum < ubi->peb_count; pnum++)
@@ -1576,9 +1576,9 @@ static int self_check_si(struct ubi_device *ubi, struct ubi_attach_info *si)
1576 goto out; 1576 goto out;
1577 return 0; 1577 return 0;
1578 1578
1579bad_seb: 1579bad_aeb:
1580 ubi_err("bad scanning information about LEB %d", seb->lnum); 1580 ubi_err("bad scanning information about LEB %d", aeb->lnum);
1581 ubi_dump_seb(seb, 0); 1581 ubi_dump_aeb(aeb, 0);
1582 ubi_dump_sv(sv); 1582 ubi_dump_sv(sv);
1583 goto out; 1583 goto out;
1584 1584
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h
index 9ba00c8f453a..7e20a85b8c31 100644
--- a/drivers/mtd/ubi/scan.h
+++ b/drivers/mtd/ubi/scan.h
@@ -146,15 +146,15 @@ struct ubi_vid_hdr;
146 * ubi_scan_move_to_list - move a PEB from the volume tree to a list. 146 * ubi_scan_move_to_list - move a PEB from the volume tree to a list.
147 * 147 *
148 * @sv: volume scanning information 148 * @sv: volume scanning information
149 * @seb: scanning eraseblock information 149 * @aeb: scanning eraseblock information
150 * @list: the list to move to 150 * @list: the list to move to
151 */ 151 */
152static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *sv, 152static inline void ubi_scan_move_to_list(struct ubi_ainf_volume *sv,
153 struct ubi_ainf_peb *seb, 153 struct ubi_ainf_peb *aeb,
154 struct list_head *list) 154 struct list_head *list)
155{ 155{
156 rb_erase(&seb->u.rb, &sv->root); 156 rb_erase(&aeb->u.rb, &sv->root);
157 list_add_tail(&seb->u.list, list); 157 list_add_tail(&aeb->u.list, list);
158} 158}
159 159
160int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si, 160int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
@@ -162,7 +162,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_attach_info *si,
162 int bitflips); 162 int bitflips);
163struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si, 163struct ubi_ainf_volume *ubi_scan_find_sv(const struct ubi_attach_info *si,
164 int vol_id); 164 int vol_id);
165struct ubi_ainf_peb *ubi_scan_find_seb(const struct ubi_ainf_volume *sv, 165struct ubi_ainf_peb *ubi_scan_find_aeb(const struct ubi_ainf_volume *sv,
166 int lnum); 166 int lnum);
167void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv); 167void ubi_scan_rm_volume(struct ubi_attach_info *si, struct ubi_ainf_volume *sv);
168struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi, 168struct ubi_ainf_peb *ubi_scan_get_free_peb(struct ubi_device *ubi,
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index fbe2d7ff6cda..800958de64e8 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -303,7 +303,7 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *si,
303{ 303{
304 int err, tries = 0; 304 int err, tries = 0;
305 struct ubi_vid_hdr *vid_hdr; 305 struct ubi_vid_hdr *vid_hdr;
306 struct ubi_ainf_peb *new_seb; 306 struct ubi_ainf_peb *new_aeb;
307 307
308 ubi_msg("create volume table (copy #%d)", copy + 1); 308 ubi_msg("create volume table (copy #%d)", copy + 1);
309 309
@@ -312,9 +312,9 @@ static int create_vtbl(struct ubi_device *ubi, struct ubi_attach_info *si,
312 return -ENOMEM; 312 return -ENOMEM;
313 313
314retry: 314retry:
315 new_seb = ubi_scan_get_free_peb(ubi, si); 315 new_aeb = ubi_scan_get_free_peb(ubi, si);
316 if (IS_ERR(new_seb)) { 316 if (IS_ERR(new_aeb)) {
317 err = PTR_ERR(new_seb); 317 err = PTR_ERR(new_aeb);
318 goto out_free; 318 goto out_free;
319 } 319 }
320 320
@@ -327,12 +327,12 @@ retry:
327 vid_hdr->sqnum = cpu_to_be64(++si->max_sqnum); 327 vid_hdr->sqnum = cpu_to_be64(++si->max_sqnum);
328 328
329 /* The EC header is already there, write the VID header */ 329 /* The EC header is already there, write the VID header */
330 err = ubi_io_write_vid_hdr(ubi, new_seb->pnum, vid_hdr); 330 err = ubi_io_write_vid_hdr(ubi, new_aeb->pnum, vid_hdr);
331 if (err) 331 if (err)
332 goto write_error; 332 goto write_error;
333 333
334 /* Write the layout volume contents */ 334 /* Write the layout volume contents */
335 err = ubi_io_write_data(ubi, vtbl, new_seb->pnum, 0, ubi->vtbl_size); 335 err = ubi_io_write_data(ubi, vtbl, new_aeb->pnum, 0, ubi->vtbl_size);
336 if (err) 336 if (err)
337 goto write_error; 337 goto write_error;
338 338
@@ -340,9 +340,9 @@ retry:
340 * And add it to the scanning information. Don't delete the old version 340 * And add it to the scanning information. Don't delete the old version
341 * of this LEB as it will be deleted and freed in 'ubi_scan_add_used()'. 341 * of this LEB as it will be deleted and freed in 'ubi_scan_add_used()'.
342 */ 342 */
343 err = ubi_scan_add_used(ubi, si, new_seb->pnum, new_seb->ec, 343 err = ubi_scan_add_used(ubi, si, new_aeb->pnum, new_aeb->ec,
344 vid_hdr, 0); 344 vid_hdr, 0);
345 kfree(new_seb); 345 kfree(new_aeb);
346 ubi_free_vid_hdr(ubi, vid_hdr); 346 ubi_free_vid_hdr(ubi, vid_hdr);
347 return err; 347 return err;
348 348
@@ -352,10 +352,10 @@ write_error:
352 * Probably this physical eraseblock went bad, try to pick 352 * Probably this physical eraseblock went bad, try to pick
353 * another one. 353 * another one.
354 */ 354 */
355 list_add(&new_seb->u.list, &si->erase); 355 list_add(&new_aeb->u.list, &si->erase);
356 goto retry; 356 goto retry;
357 } 357 }
358 kfree(new_seb); 358 kfree(new_aeb);
359out_free: 359out_free:
360 ubi_free_vid_hdr(ubi, vid_hdr); 360 ubi_free_vid_hdr(ubi, vid_hdr);
361 return err; 361 return err;
@@ -378,7 +378,7 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
378{ 378{
379 int err; 379 int err;
380 struct rb_node *rb; 380 struct rb_node *rb;
381 struct ubi_ainf_peb *seb; 381 struct ubi_ainf_peb *aeb;
382 struct ubi_vtbl_record *leb[UBI_LAYOUT_VOLUME_EBS] = { NULL, NULL }; 382 struct ubi_vtbl_record *leb[UBI_LAYOUT_VOLUME_EBS] = { NULL, NULL };
383 int leb_corrupted[UBI_LAYOUT_VOLUME_EBS] = {1, 1}; 383 int leb_corrupted[UBI_LAYOUT_VOLUME_EBS] = {1, 1};
384 384
@@ -410,14 +410,14 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
410 dbg_gen("check layout volume"); 410 dbg_gen("check layout volume");
411 411
412 /* Read both LEB 0 and LEB 1 into memory */ 412 /* Read both LEB 0 and LEB 1 into memory */
413 ubi_rb_for_each_entry(rb, seb, &sv->root, u.rb) { 413 ubi_rb_for_each_entry(rb, aeb, &sv->root, u.rb) {
414 leb[seb->lnum] = vzalloc(ubi->vtbl_size); 414 leb[aeb->lnum] = vzalloc(ubi->vtbl_size);
415 if (!leb[seb->lnum]) { 415 if (!leb[aeb->lnum]) {
416 err = -ENOMEM; 416 err = -ENOMEM;
417 goto out_free; 417 goto out_free;
418 } 418 }
419 419
420 err = ubi_io_read_data(ubi, leb[seb->lnum], seb->pnum, 0, 420 err = ubi_io_read_data(ubi, leb[aeb->lnum], aeb->pnum, 0,
421 ubi->vtbl_size); 421 ubi->vtbl_size);
422 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err)) 422 if (err == UBI_IO_BITFLIPS || mtd_is_eccerr(err))
423 /* 423 /*
@@ -425,12 +425,12 @@ static struct ubi_vtbl_record *process_lvol(struct ubi_device *ubi,
425 * uncorrectable ECC error, but we have our own CRC and 425 * uncorrectable ECC error, but we have our own CRC and
426 * the data will be checked later. If the data is OK, 426 * the data will be checked later. If the data is OK,
427 * the PEB will be scrubbed (because we set 427 * the PEB will be scrubbed (because we set
428 * seb->scrub). If the data is not OK, the contents of 428 * aeb->scrub). If the data is not OK, the contents of
429 * the PEB will be recovered from the second copy, and 429 * the PEB will be recovered from the second copy, and
430 * seb->scrub will be cleared in 430 * aeb->scrub will be cleared in
431 * 'ubi_scan_add_used()'. 431 * 'ubi_scan_add_used()'.
432 */ 432 */
433 seb->scrub = 1; 433 aeb->scrub = 1;
434 else if (err) 434 else if (err)
435 goto out_free; 435 goto out_free;
436 } 436 }
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 12a85d5372cd..fb870f4fc924 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -1385,7 +1385,7 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
1385 int err, i; 1385 int err, i;
1386 struct rb_node *rb1, *rb2; 1386 struct rb_node *rb1, *rb2;
1387 struct ubi_ainf_volume *sv; 1387 struct ubi_ainf_volume *sv;
1388 struct ubi_ainf_peb *seb, *tmp; 1388 struct ubi_ainf_peb *aeb, *tmp;
1389 struct ubi_wl_entry *e; 1389 struct ubi_wl_entry *e;
1390 1390
1391 ubi->used = ubi->erroneous = ubi->free = ubi->scrub = RB_ROOT; 1391 ubi->used = ubi->erroneous = ubi->free = ubi->scrub = RB_ROOT;
@@ -1406,15 +1406,15 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
1406 INIT_LIST_HEAD(&ubi->pq[i]); 1406 INIT_LIST_HEAD(&ubi->pq[i]);
1407 ubi->pq_head = 0; 1407 ubi->pq_head = 0;
1408 1408
1409 list_for_each_entry_safe(seb, tmp, &si->erase, u.list) { 1409 list_for_each_entry_safe(aeb, tmp, &si->erase, u.list) {
1410 cond_resched(); 1410 cond_resched();
1411 1411
1412 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); 1412 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1413 if (!e) 1413 if (!e)
1414 goto out_free; 1414 goto out_free;
1415 1415
1416 e->pnum = seb->pnum; 1416 e->pnum = aeb->pnum;
1417 e->ec = seb->ec; 1417 e->ec = aeb->ec;
1418 ubi->lookuptbl[e->pnum] = e; 1418 ubi->lookuptbl[e->pnum] = e;
1419 if (schedule_erase(ubi, e, 0)) { 1419 if (schedule_erase(ubi, e, 0)) {
1420 kmem_cache_free(ubi_wl_entry_slab, e); 1420 kmem_cache_free(ubi_wl_entry_slab, e);
@@ -1422,32 +1422,32 @@ int ubi_wl_init_scan(struct ubi_device *ubi, struct ubi_attach_info *si)
1422 } 1422 }
1423 } 1423 }
1424 1424
1425 list_for_each_entry(seb, &si->free, u.list) { 1425 list_for_each_entry(aeb, &si->free, u.list) {
1426 cond_resched(); 1426 cond_resched();
1427 1427
1428 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); 1428 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1429 if (!e) 1429 if (!e)
1430 goto out_free; 1430 goto out_free;
1431 1431
1432 e->pnum = seb->pnum; 1432 e->pnum = aeb->pnum;
1433 e->ec = seb->ec; 1433 e->ec = aeb->ec;
1434 ubi_assert(e->ec >= 0); 1434 ubi_assert(e->ec >= 0);
1435 wl_tree_add(e, &ubi->free); 1435 wl_tree_add(e, &ubi->free);
1436 ubi->lookuptbl[e->pnum] = e; 1436 ubi->lookuptbl[e->pnum] = e;
1437 } 1437 }
1438 1438
1439 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) { 1439 ubi_rb_for_each_entry(rb1, sv, &si->volumes, rb) {
1440 ubi_rb_for_each_entry(rb2, seb, &sv->root, u.rb) { 1440 ubi_rb_for_each_entry(rb2, aeb, &sv->root, u.rb) {
1441 cond_resched(); 1441 cond_resched();
1442 1442
1443 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL); 1443 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1444 if (!e) 1444 if (!e)
1445 goto out_free; 1445 goto out_free;
1446 1446
1447 e->pnum = seb->pnum; 1447 e->pnum = aeb->pnum;
1448 e->ec = seb->ec; 1448 e->ec = aeb->ec;
1449 ubi->lookuptbl[e->pnum] = e; 1449 ubi->lookuptbl[e->pnum] = e;
1450 if (!seb->scrub) { 1450 if (!aeb->scrub) {
1451 dbg_wl("add PEB %d EC %d to the used tree", 1451 dbg_wl("add PEB %d EC %d to the used tree",
1452 e->pnum, e->ec); 1452 e->pnum, e->ec);
1453 wl_tree_add(e, &ubi->used); 1453 wl_tree_add(e, &ubi->used);