aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-16 11:29:54 -0400
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-05-20 13:26:00 -0400
commit7bf523ae252d654f1fa85c5e8759f221afe1c593 (patch)
treea3e9f207d18d2f3295896fd8b89baff4f07511fe /drivers/mtd
parent8056eb4ac451cdf4723ba22471899d3d18a7dcbb (diff)
UBI: more of clean-up terminology for self-checks
We have the "sefl-check" feature in UBI, but for historical reasons many corresponding functions and commentaries in the code use term "paranoid check" instead. Let's clean this up and use "self-check" everywhere. This patch renames functions, amends messages and kills several redundant debugging messages. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/scan.c8
-rw-r--r--drivers/mtd/ubi/vmt.c31
-rw-r--r--drivers/mtd/ubi/vtbl.c10
-rw-r--r--drivers/mtd/ubi/wl.c54
4 files changed, 49 insertions, 54 deletions
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c
index bcbfe498f415..17fc6e556b38 100644
--- a/drivers/mtd/ubi/scan.c
+++ b/drivers/mtd/ubi/scan.c
@@ -88,7 +88,7 @@
88#include <linux/random.h> 88#include <linux/random.h>
89#include "ubi.h" 89#include "ubi.h"
90 90
91static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si); 91static int self_check_si(struct ubi_device *ubi, struct ubi_scan_info *si);
92 92
93/* Temporary variables used during scanning */ 93/* Temporary variables used during scanning */
94static struct ubi_ec_hdr *ech; 94static struct ubi_ec_hdr *ech;
@@ -1218,7 +1218,7 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
1218 if (seb->ec == UBI_SCAN_UNKNOWN_EC) 1218 if (seb->ec == UBI_SCAN_UNKNOWN_EC)
1219 seb->ec = si->mean_ec; 1219 seb->ec = si->mean_ec;
1220 1220
1221 err = paranoid_check_si(ubi, si); 1221 err = self_check_si(ubi, si);
1222 if (err) 1222 if (err)
1223 goto out_vidh; 1223 goto out_vidh;
1224 1224
@@ -1326,14 +1326,14 @@ void ubi_scan_destroy_si(struct ubi_scan_info *si)
1326} 1326}
1327 1327
1328/** 1328/**
1329 * paranoid_check_si - check the scanning information. 1329 * self_check_si - check the scanning information.
1330 * @ubi: UBI device description object 1330 * @ubi: UBI device description object
1331 * @si: scanning information 1331 * @si: scanning information
1332 * 1332 *
1333 * This function returns zero if the scanning information is all right, and a 1333 * This function returns zero if the scanning information is all right, and a
1334 * negative error code if not or if an error occurred. 1334 * negative error code if not or if an error occurred.
1335 */ 1335 */
1336static int paranoid_check_si(struct ubi_device *ubi, struct ubi_scan_info *si) 1336static int self_check_si(struct ubi_device *ubi, struct ubi_scan_info *si)
1337{ 1337{
1338 int pnum, err, vols_found = 0; 1338 int pnum, err, vols_found = 0;
1339 struct rb_node *rb1, *rb2; 1339 struct rb_node *rb1, *rb2;
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index b38ab92094fd..1bfd4b6ac407 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -29,7 +29,7 @@
29#include <linux/export.h> 29#include <linux/export.h>
30#include "ubi.h" 30#include "ubi.h"
31 31
32static int paranoid_check_volumes(struct ubi_device *ubi); 32static int self_check_volumes(struct ubi_device *ubi);
33 33
34static ssize_t vol_attribute_show(struct device *dev, 34static ssize_t vol_attribute_show(struct device *dev,
35 struct device_attribute *attr, char *buf); 35 struct device_attribute *attr, char *buf);
@@ -356,8 +356,7 @@ int ubi_create_volume(struct ubi_device *ubi, struct ubi_mkvol_req *req)
356 spin_unlock(&ubi->volumes_lock); 356 spin_unlock(&ubi->volumes_lock);
357 357
358 ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED); 358 ubi_volume_notify(ubi, vol, UBI_VOLUME_ADDED);
359 if (paranoid_check_volumes(ubi)) 359 self_check_volumes(ubi);
360 dbg_err("check failed while creating volume %d", vol_id);
361 return err; 360 return err;
362 361
363out_sysfs: 362out_sysfs:
@@ -457,8 +456,8 @@ int ubi_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
457 spin_unlock(&ubi->volumes_lock); 456 spin_unlock(&ubi->volumes_lock);
458 457
459 ubi_volume_notify(ubi, vol, UBI_VOLUME_REMOVED); 458 ubi_volume_notify(ubi, vol, UBI_VOLUME_REMOVED);
460 if (!no_vtbl && paranoid_check_volumes(ubi)) 459 if (!no_vtbl)
461 dbg_err("check failed while removing volume %d", vol_id); 460 self_check_volumes(ubi);
462 461
463 return err; 462 return err;
464 463
@@ -584,8 +583,7 @@ int ubi_resize_volume(struct ubi_volume_desc *desc, int reserved_pebs)
584 } 583 }
585 584
586 ubi_volume_notify(ubi, vol, UBI_VOLUME_RESIZED); 585 ubi_volume_notify(ubi, vol, UBI_VOLUME_RESIZED);
587 if (paranoid_check_volumes(ubi)) 586 self_check_volumes(ubi);
588 dbg_err("check failed while re-sizing volume %d", vol_id);
589 return err; 587 return err;
590 588
591out_acc: 589out_acc:
@@ -634,8 +632,8 @@ int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
634 } 632 }
635 } 633 }
636 634
637 if (!err && paranoid_check_volumes(ubi)) 635 if (!err)
638 ; 636 self_check_volumes(ubi);
639 return err; 637 return err;
640} 638}
641 639
@@ -682,8 +680,7 @@ int ubi_add_volume(struct ubi_device *ubi, struct ubi_volume *vol)
682 return err; 680 return err;
683 } 681 }
684 682
685 if (paranoid_check_volumes(ubi)) 683 self_check_volumes(ubi);
686 dbg_err("check failed while adding volume %d", vol_id);
687 return err; 684 return err;
688 685
689out_cdev: 686out_cdev:
@@ -709,13 +706,13 @@ void ubi_free_volume(struct ubi_device *ubi, struct ubi_volume *vol)
709} 706}
710 707
711/** 708/**
712 * paranoid_check_volume - check volume information. 709 * self_check_volume - check volume information.
713 * @ubi: UBI device description object 710 * @ubi: UBI device description object
714 * @vol_id: volume ID 711 * @vol_id: volume ID
715 * 712 *
716 * Returns zero if volume is all right and a a negative error code if not. 713 * Returns zero if volume is all right and a a negative error code if not.
717 */ 714 */
718static int paranoid_check_volume(struct ubi_device *ubi, int vol_id) 715static int self_check_volume(struct ubi_device *ubi, int vol_id)
719{ 716{
720 int idx = vol_id2idx(ubi, vol_id); 717 int idx = vol_id2idx(ubi, vol_id);
721 int reserved_pebs, alignment, data_pad, vol_type, name_len, upd_marker; 718 int reserved_pebs, alignment, data_pad, vol_type, name_len, upd_marker;
@@ -847,7 +844,7 @@ static int paranoid_check_volume(struct ubi_device *ubi, int vol_id)
847 return 0; 844 return 0;
848 845
849fail: 846fail:
850 ubi_err("paranoid check failed for volume %d", vol_id); 847 ubi_err("self-check failed for volume %d", vol_id);
851 if (vol) 848 if (vol)
852 ubi_dump_vol_info(vol); 849 ubi_dump_vol_info(vol);
853 ubi_dump_vtbl_record(&ubi->vtbl[vol_id], vol_id); 850 ubi_dump_vtbl_record(&ubi->vtbl[vol_id], vol_id);
@@ -857,12 +854,12 @@ fail:
857} 854}
858 855
859/** 856/**
860 * paranoid_check_volumes - check information about all volumes. 857 * self_check_volumes - check information about all volumes.
861 * @ubi: UBI device description object 858 * @ubi: UBI device description object
862 * 859 *
863 * Returns zero if volumes are all right and a a negative error code if not. 860 * Returns zero if volumes are all right and a a negative error code if not.
864 */ 861 */
865static int paranoid_check_volumes(struct ubi_device *ubi) 862static int self_check_volumes(struct ubi_device *ubi)
866{ 863{
867 int i, err = 0; 864 int i, err = 0;
868 865
@@ -870,7 +867,7 @@ static int paranoid_check_volumes(struct ubi_device *ubi)
870 return 0; 867 return 0;
871 868
872 for (i = 0; i < ubi->vtbl_slots; i++) { 869 for (i = 0; i < ubi->vtbl_slots; i++) {
873 err = paranoid_check_volume(ubi, i); 870 err = self_check_volume(ubi, i);
874 if (err) 871 if (err)
875 break; 872 break;
876 } 873 }
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 277f1546cb9e..befe6f888d57 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -62,7 +62,7 @@
62#include <asm/div64.h> 62#include <asm/div64.h>
63#include "ubi.h" 63#include "ubi.h"
64 64
65static void paranoid_vtbl_check(const struct ubi_device *ubi); 65static void self_vtbl_check(const struct ubi_device *ubi);
66 66
67/* Empty volume table record */ 67/* Empty volume table record */
68static struct ubi_vtbl_record empty_vtbl_record; 68static struct ubi_vtbl_record empty_vtbl_record;
@@ -107,7 +107,7 @@ int ubi_change_vtbl_record(struct ubi_device *ubi, int idx,
107 return err; 107 return err;
108 } 108 }
109 109
110 paranoid_vtbl_check(ubi); 110 self_vtbl_check(ubi);
111 return 0; 111 return 0;
112} 112}
113 113
@@ -855,16 +855,16 @@ out_free:
855} 855}
856 856
857/** 857/**
858 * paranoid_vtbl_check - check volume table. 858 * self_vtbl_check - check volume table.
859 * @ubi: UBI device description object 859 * @ubi: UBI device description object
860 */ 860 */
861static void paranoid_vtbl_check(const struct ubi_device *ubi) 861static void self_vtbl_check(const struct ubi_device *ubi)
862{ 862{
863 if (!ubi->dbg->chk_gen) 863 if (!ubi->dbg->chk_gen)
864 return; 864 return;
865 865
866 if (vtbl_check(ubi, ubi->vtbl)) { 866 if (vtbl_check(ubi, ubi->vtbl)) {
867 ubi_err("paranoid check failed"); 867 ubi_err("self-check failed");
868 BUG(); 868 BUG();
869 } 869 }
870} 870}
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index f99dbd084838..75d2c1f7c3a8 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -155,12 +155,11 @@ struct ubi_work {
155 int torture; 155 int torture;
156}; 156};
157 157
158static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec); 158static int self_check_ec(struct ubi_device *ubi, int pnum, int ec);
159static int paranoid_check_in_wl_tree(const struct ubi_device *ubi, 159static int self_check_in_wl_tree(const struct ubi_device *ubi,
160 struct ubi_wl_entry *e, 160 struct ubi_wl_entry *e, struct rb_root *root);
161 struct rb_root *root); 161static int self_check_in_pq(const struct ubi_device *ubi,
162static int paranoid_check_in_pq(const struct ubi_device *ubi, 162 struct ubi_wl_entry *e);
163 struct ubi_wl_entry *e);
164 163
165/** 164/**
166 * wl_tree_add - add a wear-leveling entry to a WL RB-tree. 165 * wl_tree_add - add a wear-leveling entry to a WL RB-tree.
@@ -404,7 +403,7 @@ retry:
404 else 403 else
405 e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF/2); 404 e = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF/2);
406 405
407 paranoid_check_in_wl_tree(ubi, e, &ubi->free); 406 self_check_in_wl_tree(ubi, e, &ubi->free);
408 407
409 /* 408 /*
410 * Move the physical eraseblock to the protection queue where it will 409 * Move the physical eraseblock to the protection queue where it will
@@ -441,7 +440,7 @@ static int prot_queue_del(struct ubi_device *ubi, int pnum)
441 if (!e) 440 if (!e)
442 return -ENODEV; 441 return -ENODEV;
443 442
444 if (paranoid_check_in_pq(ubi, e)) 443 if (self_check_in_pq(ubi, e))
445 return -ENODEV; 444 return -ENODEV;
446 445
447 list_del(&e->u.list); 446 list_del(&e->u.list);
@@ -467,7 +466,7 @@ static int sync_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
467 466
468 dbg_wl("erase PEB %d, old EC %llu", e->pnum, ec); 467 dbg_wl("erase PEB %d, old EC %llu", e->pnum, ec);
469 468
470 err = paranoid_check_ec(ubi, e->pnum, e->ec); 469 err = self_check_ec(ubi, e->pnum, e->ec);
471 if (err) 470 if (err)
472 return -EINVAL; 471 return -EINVAL;
473 472
@@ -667,7 +666,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
667 e1->ec, e2->ec); 666 e1->ec, e2->ec);
668 goto out_cancel; 667 goto out_cancel;
669 } 668 }
670 paranoid_check_in_wl_tree(ubi, e1, &ubi->used); 669 self_check_in_wl_tree(ubi, e1, &ubi->used);
671 rb_erase(&e1->u.rb, &ubi->used); 670 rb_erase(&e1->u.rb, &ubi->used);
672 dbg_wl("move PEB %d EC %d to PEB %d EC %d", 671 dbg_wl("move PEB %d EC %d to PEB %d EC %d",
673 e1->pnum, e1->ec, e2->pnum, e2->ec); 672 e1->pnum, e1->ec, e2->pnum, e2->ec);
@@ -676,12 +675,12 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk,
676 scrubbing = 1; 675 scrubbing = 1;
677 e1 = rb_entry(rb_first(&ubi->scrub), struct ubi_wl_entry, u.rb); 676 e1 = rb_entry(rb_first(&ubi->scrub), struct ubi_wl_entry, u.rb);
678 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF); 677 e2 = find_wl_entry(&ubi->free, WL_FREE_MAX_DIFF);
679 paranoid_check_in_wl_tree(ubi, e1, &ubi->scrub); 678 self_check_in_wl_tree(ubi, e1, &ubi->scrub);
680 rb_erase(&e1->u.rb, &ubi->scrub); 679 rb_erase(&e1->u.rb, &ubi->scrub);
681 dbg_wl("scrub PEB %d to PEB %d", e1->pnum, e2->pnum); 680 dbg_wl("scrub PEB %d to PEB %d", e1->pnum, e2->pnum);
682 } 681 }
683 682
684 paranoid_check_in_wl_tree(ubi, e2, &ubi->free); 683 self_check_in_wl_tree(ubi, e2, &ubi->free);
685 rb_erase(&e2->u.rb, &ubi->free); 684 rb_erase(&e2->u.rb, &ubi->free);
686 ubi->move_from = e1; 685 ubi->move_from = e1;
687 ubi->move_to = e2; 686 ubi->move_to = e2;
@@ -1128,13 +1127,13 @@ retry:
1128 return 0; 1127 return 0;
1129 } else { 1128 } else {
1130 if (in_wl_tree(e, &ubi->used)) { 1129 if (in_wl_tree(e, &ubi->used)) {
1131 paranoid_check_in_wl_tree(ubi, e, &ubi->used); 1130 self_check_in_wl_tree(ubi, e, &ubi->used);
1132 rb_erase(&e->u.rb, &ubi->used); 1131 rb_erase(&e->u.rb, &ubi->used);
1133 } else if (in_wl_tree(e, &ubi->scrub)) { 1132 } else if (in_wl_tree(e, &ubi->scrub)) {
1134 paranoid_check_in_wl_tree(ubi, e, &ubi->scrub); 1133 self_check_in_wl_tree(ubi, e, &ubi->scrub);
1135 rb_erase(&e->u.rb, &ubi->scrub); 1134 rb_erase(&e->u.rb, &ubi->scrub);
1136 } else if (in_wl_tree(e, &ubi->erroneous)) { 1135 } else if (in_wl_tree(e, &ubi->erroneous)) {
1137 paranoid_check_in_wl_tree(ubi, e, &ubi->erroneous); 1136 self_check_in_wl_tree(ubi, e, &ubi->erroneous);
1138 rb_erase(&e->u.rb, &ubi->erroneous); 1137 rb_erase(&e->u.rb, &ubi->erroneous);
1139 ubi->erroneous_peb_count -= 1; 1138 ubi->erroneous_peb_count -= 1;
1140 ubi_assert(ubi->erroneous_peb_count >= 0); 1139 ubi_assert(ubi->erroneous_peb_count >= 0);
@@ -1201,7 +1200,7 @@ retry:
1201 } 1200 }
1202 1201
1203 if (in_wl_tree(e, &ubi->used)) { 1202 if (in_wl_tree(e, &ubi->used)) {
1204 paranoid_check_in_wl_tree(ubi, e, &ubi->used); 1203 self_check_in_wl_tree(ubi, e, &ubi->used);
1205 rb_erase(&e->u.rb, &ubi->used); 1204 rb_erase(&e->u.rb, &ubi->used);
1206 } else { 1205 } else {
1207 int err; 1206 int err;
@@ -1521,7 +1520,7 @@ void ubi_wl_close(struct ubi_device *ubi)
1521} 1520}
1522 1521
1523/** 1522/**
1524 * paranoid_check_ec - make sure that the erase counter of a PEB is correct. 1523 * self_check_ec - make sure that the erase counter of a PEB is correct.
1525 * @ubi: UBI device description object 1524 * @ubi: UBI device description object
1526 * @pnum: the physical eraseblock number to check 1525 * @pnum: the physical eraseblock number to check
1527 * @ec: the erase counter to check 1526 * @ec: the erase counter to check
@@ -1530,7 +1529,7 @@ void ubi_wl_close(struct ubi_device *ubi)
1530 * is equivalent to @ec, and a negative error code if not or if an error 1529 * is equivalent to @ec, and a negative error code if not or if an error
1531 * occurred. 1530 * occurred.
1532 */ 1531 */
1533static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec) 1532static int self_check_ec(struct ubi_device *ubi, int pnum, int ec)
1534{ 1533{
1535 int err; 1534 int err;
1536 long long read_ec; 1535 long long read_ec;
@@ -1552,7 +1551,7 @@ static int paranoid_check_ec(struct ubi_device *ubi, int pnum, int ec)
1552 1551
1553 read_ec = be64_to_cpu(ec_hdr->ec); 1552 read_ec = be64_to_cpu(ec_hdr->ec);
1554 if (ec != read_ec) { 1553 if (ec != read_ec) {
1555 ubi_err("paranoid check failed for PEB %d", pnum); 1554 ubi_err("self-check failed for PEB %d", pnum);
1556 ubi_err("read EC is %lld, should be %d", read_ec, ec); 1555 ubi_err("read EC is %lld, should be %d", read_ec, ec);
1557 dump_stack(); 1556 dump_stack();
1558 err = 1; 1557 err = 1;
@@ -1565,7 +1564,7 @@ out_free:
1565} 1564}
1566 1565
1567/** 1566/**
1568 * paranoid_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree. 1567 * self_check_in_wl_tree - check that wear-leveling entry is in WL RB-tree.
1569 * @ubi: UBI device description object 1568 * @ubi: UBI device description object
1570 * @e: the wear-leveling entry to check 1569 * @e: the wear-leveling entry to check
1571 * @root: the root of the tree 1570 * @root: the root of the tree
@@ -1573,9 +1572,8 @@ out_free:
1573 * This function returns zero if @e is in the @root RB-tree and %-EINVAL if it 1572 * This function returns zero if @e is in the @root RB-tree and %-EINVAL if it
1574 * is not. 1573 * is not.
1575 */ 1574 */
1576static int paranoid_check_in_wl_tree(const struct ubi_device *ubi, 1575static int self_check_in_wl_tree(const struct ubi_device *ubi,
1577 struct ubi_wl_entry *e, 1576 struct ubi_wl_entry *e, struct rb_root *root)
1578 struct rb_root *root)
1579{ 1577{
1580 if (!ubi->dbg->chk_gen) 1578 if (!ubi->dbg->chk_gen)
1581 return 0; 1579 return 0;
@@ -1583,22 +1581,22 @@ static int paranoid_check_in_wl_tree(const struct ubi_device *ubi,
1583 if (in_wl_tree(e, root)) 1581 if (in_wl_tree(e, root))
1584 return 0; 1582 return 0;
1585 1583
1586 ubi_err("paranoid check failed for PEB %d, EC %d, RB-tree %p ", 1584 ubi_err("self-check failed for PEB %d, EC %d, RB-tree %p ",
1587 e->pnum, e->ec, root); 1585 e->pnum, e->ec, root);
1588 dump_stack(); 1586 dump_stack();
1589 return -EINVAL; 1587 return -EINVAL;
1590} 1588}
1591 1589
1592/** 1590/**
1593 * paranoid_check_in_pq - check if wear-leveling entry is in the protection 1591 * self_check_in_pq - check if wear-leveling entry is in the protection
1594 * queue. 1592 * queue.
1595 * @ubi: UBI device description object 1593 * @ubi: UBI device description object
1596 * @e: the wear-leveling entry to check 1594 * @e: the wear-leveling entry to check
1597 * 1595 *
1598 * This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not. 1596 * This function returns zero if @e is in @ubi->pq and %-EINVAL if it is not.
1599 */ 1597 */
1600static int paranoid_check_in_pq(const struct ubi_device *ubi, 1598static int self_check_in_pq(const struct ubi_device *ubi,
1601 struct ubi_wl_entry *e) 1599 struct ubi_wl_entry *e)
1602{ 1600{
1603 struct ubi_wl_entry *p; 1601 struct ubi_wl_entry *p;
1604 int i; 1602 int i;
@@ -1611,7 +1609,7 @@ static int paranoid_check_in_pq(const struct ubi_device *ubi,
1611 if (p == e) 1609 if (p == e)
1612 return 0; 1610 return 0;
1613 1611
1614 ubi_err("paranoid check failed for PEB %d, EC %d, Protect queue", 1612 ubi_err("self-check failed for PEB %d, EC %d, Protect queue",
1615 e->pnum, e->ec); 1613 e->pnum, e->ec);
1616 dump_stack(); 1614 dump_stack();
1617 return -EINVAL; 1615 return -EINVAL;