diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:28:35 -0500 |
---|---|---|
committer | Frederic Weisbecker <fweisbec@gmail.com> | 2009-12-07 01:29:22 -0500 |
commit | 6548698f929814375fa5d62ae1db96959b0418c1 (patch) | |
tree | 340924ae82cb0946aa15045b2b72186de52a8146 /fs/ubifs/debug.c | |
parent | 1d2c6cfd40b2dece3bb958cbbc405a2c1536ab75 (diff) | |
parent | 22763c5cf3690a681551162c15d34d935308c8d7 (diff) |
Merge commit 'v2.6.32' into reiserfs/kill-bkl
Merge-reason: The tree was based 2.6.31. It's better to be up to date
with 2.6.32. Although no conflicting changes were made in between,
it gives benchmarking results closer to the lastest kernel behaviour.
Diffstat (limited to 'fs/ubifs/debug.c')
-rw-r--r-- | fs/ubifs/debug.c | 112 |
1 files changed, 105 insertions, 7 deletions
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index ce2cd8343618..dbc093afd946 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -210,6 +210,20 @@ const char *dbg_cstate(int cmt_state) | |||
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | const char *dbg_jhead(int jhead) | ||
214 | { | ||
215 | switch (jhead) { | ||
216 | case GCHD: | ||
217 | return "0 (GC)"; | ||
218 | case BASEHD: | ||
219 | return "1 (base)"; | ||
220 | case DATAHD: | ||
221 | return "2 (data)"; | ||
222 | default: | ||
223 | return "unknown journal head"; | ||
224 | } | ||
225 | } | ||
226 | |||
213 | static void dump_ch(const struct ubifs_ch *ch) | 227 | static void dump_ch(const struct ubifs_ch *ch) |
214 | { | 228 | { |
215 | printk(KERN_DEBUG "\tmagic %#x\n", le32_to_cpu(ch->magic)); | 229 | printk(KERN_DEBUG "\tmagic %#x\n", le32_to_cpu(ch->magic)); |
@@ -623,8 +637,9 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
623 | /* If we are in R/O mode, journal heads do not exist */ | 637 | /* If we are in R/O mode, journal heads do not exist */ |
624 | if (c->jheads) | 638 | if (c->jheads) |
625 | for (i = 0; i < c->jhead_cnt; i++) | 639 | for (i = 0; i < c->jhead_cnt; i++) |
626 | printk(KERN_DEBUG "\tjhead %d\t LEB %d\n", | 640 | printk(KERN_DEBUG "\tjhead %s\t LEB %d\n", |
627 | c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum); | 641 | dbg_jhead(c->jheads[i].wbuf.jhead), |
642 | c->jheads[i].wbuf.lnum); | ||
628 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { | 643 | for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) { |
629 | bud = rb_entry(rb, struct ubifs_bud, rb); | 644 | bud = rb_entry(rb, struct ubifs_bud, rb); |
630 | printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum); | 645 | printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum); |
@@ -648,9 +663,90 @@ void dbg_dump_budg(struct ubifs_info *c) | |||
648 | 663 | ||
649 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | 664 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) |
650 | { | 665 | { |
651 | printk(KERN_DEBUG "LEB %d lprops: free %d, dirty %d (used %d), " | 666 | int i, spc, dark = 0, dead = 0; |
652 | "flags %#x\n", lp->lnum, lp->free, lp->dirty, | 667 | struct rb_node *rb; |
653 | c->leb_size - lp->free - lp->dirty, lp->flags); | 668 | struct ubifs_bud *bud; |
669 | |||
670 | spc = lp->free + lp->dirty; | ||
671 | if (spc < c->dead_wm) | ||
672 | dead = spc; | ||
673 | else | ||
674 | dark = ubifs_calc_dark(c, spc); | ||
675 | |||
676 | if (lp->flags & LPROPS_INDEX) | ||
677 | printk(KERN_DEBUG "LEB %-7d free %-8d dirty %-8d used %-8d " | ||
678 | "free + dirty %-8d flags %#x (", lp->lnum, lp->free, | ||
679 | lp->dirty, c->leb_size - spc, spc, lp->flags); | ||
680 | else | ||
681 | printk(KERN_DEBUG "LEB %-7d free %-8d dirty %-8d used %-8d " | ||
682 | "free + dirty %-8d dark %-4d dead %-4d nodes fit %-3d " | ||
683 | "flags %#-4x (", lp->lnum, lp->free, lp->dirty, | ||
684 | c->leb_size - spc, spc, dark, dead, | ||
685 | (int)(spc / UBIFS_MAX_NODE_SZ), lp->flags); | ||
686 | |||
687 | if (lp->flags & LPROPS_TAKEN) { | ||
688 | if (lp->flags & LPROPS_INDEX) | ||
689 | printk(KERN_CONT "index, taken"); | ||
690 | else | ||
691 | printk(KERN_CONT "taken"); | ||
692 | } else { | ||
693 | const char *s; | ||
694 | |||
695 | if (lp->flags & LPROPS_INDEX) { | ||
696 | switch (lp->flags & LPROPS_CAT_MASK) { | ||
697 | case LPROPS_DIRTY_IDX: | ||
698 | s = "dirty index"; | ||
699 | break; | ||
700 | case LPROPS_FRDI_IDX: | ||
701 | s = "freeable index"; | ||
702 | break; | ||
703 | default: | ||
704 | s = "index"; | ||
705 | } | ||
706 | } else { | ||
707 | switch (lp->flags & LPROPS_CAT_MASK) { | ||
708 | case LPROPS_UNCAT: | ||
709 | s = "not categorized"; | ||
710 | break; | ||
711 | case LPROPS_DIRTY: | ||
712 | s = "dirty"; | ||
713 | break; | ||
714 | case LPROPS_FREE: | ||
715 | s = "free"; | ||
716 | break; | ||
717 | case LPROPS_EMPTY: | ||
718 | s = "empty"; | ||
719 | break; | ||
720 | case LPROPS_FREEABLE: | ||
721 | s = "freeable"; | ||
722 | break; | ||
723 | default: | ||
724 | s = NULL; | ||
725 | break; | ||
726 | } | ||
727 | } | ||
728 | printk(KERN_CONT "%s", s); | ||
729 | } | ||
730 | |||
731 | for (rb = rb_first((struct rb_root *)&c->buds); rb; rb = rb_next(rb)) { | ||
732 | bud = rb_entry(rb, struct ubifs_bud, rb); | ||
733 | if (bud->lnum == lp->lnum) { | ||
734 | int head = 0; | ||
735 | for (i = 0; i < c->jhead_cnt; i++) { | ||
736 | if (lp->lnum == c->jheads[i].wbuf.lnum) { | ||
737 | printk(KERN_CONT ", jhead %s", | ||
738 | dbg_jhead(i)); | ||
739 | head = 1; | ||
740 | } | ||
741 | } | ||
742 | if (!head) | ||
743 | printk(KERN_CONT ", bud of jhead %s", | ||
744 | dbg_jhead(bud->jhead)); | ||
745 | } | ||
746 | } | ||
747 | if (lp->lnum == c->gc_lnum) | ||
748 | printk(KERN_CONT ", GC LEB"); | ||
749 | printk(KERN_CONT ")\n"); | ||
654 | } | 750 | } |
655 | 751 | ||
656 | void dbg_dump_lprops(struct ubifs_info *c) | 752 | void dbg_dump_lprops(struct ubifs_info *c) |
@@ -724,7 +820,7 @@ void dbg_dump_leb(const struct ubifs_info *c, int lnum) | |||
724 | 820 | ||
725 | printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", | 821 | printk(KERN_DEBUG "(pid %d) start dumping LEB %d\n", |
726 | current->pid, lnum); | 822 | current->pid, lnum); |
727 | sleb = ubifs_scan(c, lnum, 0, c->dbg->buf); | 823 | sleb = ubifs_scan(c, lnum, 0, c->dbg->buf, 0); |
728 | if (IS_ERR(sleb)) { | 824 | if (IS_ERR(sleb)) { |
729 | ubifs_err("scan error %d", (int)PTR_ERR(sleb)); | 825 | ubifs_err("scan error %d", (int)PTR_ERR(sleb)); |
730 | return; | 826 | return; |
@@ -909,8 +1005,10 @@ out: | |||
909 | ubifs_msg("saved lprops statistics dump"); | 1005 | ubifs_msg("saved lprops statistics dump"); |
910 | dbg_dump_lstats(&d->saved_lst); | 1006 | dbg_dump_lstats(&d->saved_lst); |
911 | ubifs_get_lp_stats(c, &lst); | 1007 | ubifs_get_lp_stats(c, &lst); |
1008 | |||
912 | ubifs_msg("current lprops statistics dump"); | 1009 | ubifs_msg("current lprops statistics dump"); |
913 | dbg_dump_lstats(&d->saved_lst); | 1010 | dbg_dump_lstats(&lst); |
1011 | |||
914 | spin_lock(&c->space_lock); | 1012 | spin_lock(&c->space_lock); |
915 | dbg_dump_budg(c); | 1013 | dbg_dump_budg(c); |
916 | spin_unlock(&c->space_lock); | 1014 | spin_unlock(&c->space_lock); |