diff options
author | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-06-08 05:49:08 -0400 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@nokia.com> | 2009-06-08 06:05:43 -0400 |
commit | 9c259a52fa6ab46841a6094434cd0d752e854180 (patch) | |
tree | 7d25b2f4674678698f2be99cdbf414f0a2f58dda /drivers | |
parent | 2ba3d76a1e29f2ba64fbc762875cf9fb2d4ba2ba (diff) |
UBI: improve messages in the WL worker
Print not only the PEB number, but also the LEB number and volume id,
which is very useful for bug hunting.
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/ubi/wl.c | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 9d1d3595a240..784681e42360 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -656,6 +656,7 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
656 | int cancel) | 656 | int cancel) |
657 | { | 657 | { |
658 | int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0; | 658 | int err, scrubbing = 0, torture = 0, protect = 0, erroneous = 0; |
659 | int vol_id = -1, uninitialized_var(lnum); | ||
659 | struct ubi_wl_entry *e1, *e2; | 660 | struct ubi_wl_entry *e1, *e2; |
660 | struct ubi_vid_hdr *vid_hdr; | 661 | struct ubi_vid_hdr *vid_hdr; |
661 | 662 | ||
@@ -757,6 +758,9 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
757 | goto out_error; | 758 | goto out_error; |
758 | } | 759 | } |
759 | 760 | ||
761 | vol_id = be32_to_cpu(vid_hdr->vol_id); | ||
762 | lnum = be32_to_cpu(vid_hdr->lnum); | ||
763 | |||
760 | err = ubi_eba_copy_leb(ubi, e1->pnum, e2->pnum, vid_hdr); | 764 | err = ubi_eba_copy_leb(ubi, e1->pnum, e2->pnum, vid_hdr); |
761 | if (err) { | 765 | if (err) { |
762 | if (err == MOVE_CANCEL_RACE) { | 766 | if (err == MOVE_CANCEL_RACE) { |
@@ -773,7 +777,9 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
773 | 777 | ||
774 | if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR || | 778 | if (err == MOVE_CANCEL_BITFLIPS || err == MOVE_TARGET_WR_ERR || |
775 | err == MOVE_TARGET_RD_ERR) { | 779 | err == MOVE_TARGET_RD_ERR) { |
776 | /* Target PEB bit-flips or write error, torture it */ | 780 | /* |
781 | * Target PEB had bit-flips or write error - torture it. | ||
782 | */ | ||
777 | torture = 1; | 783 | torture = 1; |
778 | goto out_not_moved; | 784 | goto out_not_moved; |
779 | } | 785 | } |
@@ -803,10 +809,10 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
803 | } | 809 | } |
804 | 810 | ||
805 | /* The PEB has been successfully moved */ | 811 | /* The PEB has been successfully moved */ |
806 | ubi_free_vid_hdr(ubi, vid_hdr); | ||
807 | if (scrubbing) | 812 | if (scrubbing) |
808 | ubi_msg("scrubbed PEB %d, data moved to PEB %d", | 813 | ubi_msg("scrubbed PEB %d (LEB %d:%d), data moved to PEB %d", |
809 | e1->pnum, e2->pnum); | 814 | e1->pnum, vol_id, lnum, e2->pnum); |
815 | ubi_free_vid_hdr(ubi, vid_hdr); | ||
810 | 816 | ||
811 | spin_lock(&ubi->wl_lock); | 817 | spin_lock(&ubi->wl_lock); |
812 | if (!ubi->move_to_put) { | 818 | if (!ubi->move_to_put) { |
@@ -829,7 +835,8 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
829 | * Well, the target PEB was put meanwhile, schedule it for | 835 | * Well, the target PEB was put meanwhile, schedule it for |
830 | * erasure. | 836 | * erasure. |
831 | */ | 837 | */ |
832 | dbg_wl("PEB %d was put meanwhile, erase", e2->pnum); | 838 | dbg_wl("PEB %d (LEB %d:%d) was put meanwhile, erase", |
839 | e2->pnum, vol_id, lnum); | ||
833 | err = schedule_erase(ubi, e2, 0); | 840 | err = schedule_erase(ubi, e2, 0); |
834 | if (err) { | 841 | if (err) { |
835 | kmem_cache_free(ubi_wl_entry_slab, e2); | 842 | kmem_cache_free(ubi_wl_entry_slab, e2); |
@@ -847,8 +854,12 @@ static int wear_leveling_worker(struct ubi_device *ubi, struct ubi_work *wrk, | |||
847 | * have been changed, schedule it for erasure. | 854 | * have been changed, schedule it for erasure. |
848 | */ | 855 | */ |
849 | out_not_moved: | 856 | out_not_moved: |
850 | dbg_wl("cancel moving PEB %d to PEB %d (%d)", | 857 | if (vol_id != -1) |
851 | e1->pnum, e2->pnum, err); | 858 | dbg_wl("cancel moving PEB %d (LEB %d:%d) to PEB %d (%d)", |
859 | e1->pnum, vol_id, lnum, e2->pnum, err); | ||
860 | else | ||
861 | dbg_wl("cancel moving PEB %d to PEB %d (%d)", | ||
862 | e1->pnum, e2->pnum, err); | ||
852 | spin_lock(&ubi->wl_lock); | 863 | spin_lock(&ubi->wl_lock); |
853 | if (protect) | 864 | if (protect) |
854 | prot_queue_add(ubi, e1); | 865 | prot_queue_add(ubi, e1); |
@@ -874,8 +885,12 @@ out_not_moved: | |||
874 | return 0; | 885 | return 0; |
875 | 886 | ||
876 | out_error: | 887 | out_error: |
877 | ubi_err("error %d while moving PEB %d to PEB %d", | 888 | if (vol_id != -1) |
878 | err, e1->pnum, e2->pnum); | 889 | ubi_err("error %d while moving PEB %d to PEB %d", |
890 | err, e1->pnum, e2->pnum); | ||
891 | else | ||
892 | ubi_err("error %d while moving PEB %d (LEB %d:%d) to PEB %d", | ||
893 | err, e1->pnum, vol_id, lnum, e2->pnum); | ||
879 | spin_lock(&ubi->wl_lock); | 894 | spin_lock(&ubi->wl_lock); |
880 | ubi->move_from = ubi->move_to = NULL; | 895 | ubi->move_from = ubi->move_to = NULL; |
881 | ubi->move_to_put = ubi->wl_scheduled = 0; | 896 | ubi->move_to_put = ubi->wl_scheduled = 0; |