diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 22:30:27 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-22 22:30:27 -0400 |
commit | 6133308ad1a386e7e7f776003a1c44e8b54e2166 (patch) | |
tree | b2102f3bd3b25e0f105cd91b6a22bd96a351c5d7 /fs/ubifs | |
parent | e8650a08232e75274304b812ff04cfce9af9671c (diff) | |
parent | 62f384552b6756cf1ea71f8762d1e97dc77dbd90 (diff) |
Merge tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs
Pull UBI and UBIFS updates from Artem Bityutskiy:
UBIFS:
* Always support xattrs (remove the Kconfig option)
* Always support debugging (remove the Kconfig option)
* A fix for a memory leak on error path
* A number of clean-ups
UBI:
* Always support debugging (remove the Kconfig option)
* Remove "data type" hint support
* Huge amount of renames to prepare for the fastmap wor
* A lot of clean-ups
* tag 'upstream-3.5-rc1' of git://git.infradead.org/linux-ubifs: (54 commits)
UBI: modify ubi_wl_flush function to clear work queue for a lnum
UBI: introduce UBI_ALL constant
UBI: add lnum and vol_id to struct ubi_work
UBI: add volume id struct ubi_ainf_peb
UBI: add in hex the value for UBI_INTERNAL_VOL_START to comment
UBI: rename scan.c to attach.c
UBI: remove scan.h
UBI: rename UBI_SCAN_UNKNOWN_EC
UBI: move and rename attach_by_scanning
UBI: rename _init_scan functions
UBI: amend comments after all the renamings
UBI: rename ubi_scan_leb_slab
UBI: rename ubi_scan_move_to_list
UBI: rename ubi_scan_destroy_ai
UBI: rename ubi_scan_get_free_peb
UBI: rename ubi_scan_rm_volume
UBI: rename ubi_scan_find_av
UBI: rename ubi_scan_add_used
UBI: remove unused function
UBI: make ubi_scan_erase_peb static and rename
...
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/Kconfig | 23 | ||||
-rw-r--r-- | fs/ubifs/Makefile | 5 | ||||
-rw-r--r-- | fs/ubifs/commit.c | 14 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 158 | ||||
-rw-r--r-- | fs/ubifs/debug.h | 217 | ||||
-rw-r--r-- | fs/ubifs/dir.c | 10 | ||||
-rw-r--r-- | fs/ubifs/file.c | 4 | ||||
-rw-r--r-- | fs/ubifs/gc.c | 2 | ||||
-rw-r--r-- | fs/ubifs/io.c | 74 | ||||
-rw-r--r-- | fs/ubifs/journal.c | 10 | ||||
-rw-r--r-- | fs/ubifs/log.c | 18 | ||||
-rw-r--r-- | fs/ubifs/lprops.c | 18 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 78 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 86 | ||||
-rw-r--r-- | fs/ubifs/master.c | 8 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 25 | ||||
-rw-r--r-- | fs/ubifs/recovery.c | 43 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 27 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 26 | ||||
-rw-r--r-- | fs/ubifs/scan.c | 14 | ||||
-rw-r--r-- | fs/ubifs/super.c | 31 | ||||
-rw-r--r-- | fs/ubifs/tnc.c | 26 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 28 | ||||
-rw-r--r-- | fs/ubifs/tnc_misc.c | 36 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 26 | ||||
-rw-r--r-- | fs/ubifs/xattr.c | 4 |
26 files changed, 369 insertions, 642 deletions
diff --git a/fs/ubifs/Kconfig b/fs/ubifs/Kconfig index f8b0160da2da..ba66d508006a 100644 --- a/fs/ubifs/Kconfig +++ b/fs/ubifs/Kconfig | |||
@@ -11,12 +11,6 @@ config UBIFS_FS | |||
11 | help | 11 | help |
12 | UBIFS is a file system for flash devices which works on top of UBI. | 12 | UBIFS is a file system for flash devices which works on top of UBI. |
13 | 13 | ||
14 | config UBIFS_FS_XATTR | ||
15 | bool "Extended attributes support" | ||
16 | depends on UBIFS_FS | ||
17 | help | ||
18 | This option enables support of extended attributes. | ||
19 | |||
20 | config UBIFS_FS_ADVANCED_COMPR | 14 | config UBIFS_FS_ADVANCED_COMPR |
21 | bool "Advanced compression options" | 15 | bool "Advanced compression options" |
22 | depends on UBIFS_FS | 16 | depends on UBIFS_FS |
@@ -41,20 +35,3 @@ config UBIFS_FS_ZLIB | |||
41 | default y | 35 | default y |
42 | help | 36 | help |
43 | Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. | 37 | Zlib compresses better than LZO but it is slower. Say 'Y' if unsure. |
44 | |||
45 | # Debugging-related stuff | ||
46 | config UBIFS_FS_DEBUG | ||
47 | bool "Enable debugging support" | ||
48 | depends on UBIFS_FS | ||
49 | select DEBUG_FS | ||
50 | select KALLSYMS | ||
51 | help | ||
52 | This option enables UBIFS debugging support. It makes sure various | ||
53 | assertions, self-checks, debugging messages and test modes are compiled | ||
54 | in (this all is compiled out otherwise). Assertions are light-weight | ||
55 | and this option also enables them. Self-checks, debugging messages and | ||
56 | test modes are switched off by default. Thus, it is safe and actually | ||
57 | recommended to have debugging support enabled, and it should not slow | ||
58 | down UBIFS. You can then further enable / disable individual debugging | ||
59 | features using UBIFS module parameters and the corresponding sysfs | ||
60 | interfaces. | ||
diff --git a/fs/ubifs/Makefile b/fs/ubifs/Makefile index 80e93c35e496..2c6f0cb816b4 100644 --- a/fs/ubifs/Makefile +++ b/fs/ubifs/Makefile | |||
@@ -3,7 +3,4 @@ obj-$(CONFIG_UBIFS_FS) += ubifs.o | |||
3 | ubifs-y += shrinker.o journal.o file.o dir.o super.o sb.o io.o | 3 | ubifs-y += shrinker.o journal.o file.o dir.o super.o sb.o io.o |
4 | ubifs-y += tnc.o master.o scan.o replay.o log.o commit.o gc.o orphan.o | 4 | ubifs-y += tnc.o master.o scan.o replay.o log.o commit.o gc.o orphan.o |
5 | ubifs-y += budget.o find.o tnc_commit.o compress.o lpt.o lprops.o | 5 | ubifs-y += budget.o find.o tnc_commit.o compress.o lpt.o lprops.o |
6 | ubifs-y += recovery.o ioctl.o lpt_commit.o tnc_misc.o | 6 | ubifs-y += recovery.o ioctl.o lpt_commit.o tnc_misc.o xattr.o debug.o |
7 | |||
8 | ubifs-$(CONFIG_UBIFS_FS_DEBUG) += debug.o | ||
9 | ubifs-$(CONFIG_UBIFS_FS_XATTR) += xattr.o | ||
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index fb3b5c813a30..8eda717cb99b 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -496,7 +496,9 @@ int ubifs_gc_should_commit(struct ubifs_info *c) | |||
496 | return ret; | 496 | return ret; |
497 | } | 497 | } |
498 | 498 | ||
499 | #ifdef CONFIG_UBIFS_FS_DEBUG | 499 | /* |
500 | * Everything below is related to debugging. | ||
501 | */ | ||
500 | 502 | ||
501 | /** | 503 | /** |
502 | * struct idx_node - hold index nodes during index tree traversal. | 504 | * struct idx_node - hold index nodes during index tree traversal. |
@@ -714,14 +716,14 @@ out: | |||
714 | return 0; | 716 | return 0; |
715 | 717 | ||
716 | out_dump: | 718 | out_dump: |
717 | dbg_err("dumping index node (iip=%d)", i->iip); | 719 | ubifs_err("dumping index node (iip=%d)", i->iip); |
718 | dbg_dump_node(c, idx); | 720 | ubifs_dump_node(c, idx); |
719 | list_del(&i->list); | 721 | list_del(&i->list); |
720 | kfree(i); | 722 | kfree(i); |
721 | if (!list_empty(&list)) { | 723 | if (!list_empty(&list)) { |
722 | i = list_entry(list.prev, struct idx_node, list); | 724 | i = list_entry(list.prev, struct idx_node, list); |
723 | dbg_err("dumping parent index node"); | 725 | ubifs_err("dumping parent index node"); |
724 | dbg_dump_node(c, &i->idx); | 726 | ubifs_dump_node(c, &i->idx); |
725 | } | 727 | } |
726 | out_free: | 728 | out_free: |
727 | while (!list_empty(&list)) { | 729 | while (!list_empty(&list)) { |
@@ -734,5 +736,3 @@ out_free: | |||
734 | err = -EINVAL; | 736 | err = -EINVAL; |
735 | return err; | 737 | return err; |
736 | } | 738 | } |
737 | |||
738 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 1934084e2088..685a83756b2b 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -34,8 +34,6 @@ | |||
34 | #include <linux/random.h> | 34 | #include <linux/random.h> |
35 | #include "ubifs.h" | 35 | #include "ubifs.h" |
36 | 36 | ||
37 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
38 | |||
39 | static DEFINE_SPINLOCK(dbg_lock); | 37 | static DEFINE_SPINLOCK(dbg_lock); |
40 | 38 | ||
41 | static const char *get_key_fmt(int fmt) | 39 | static const char *get_key_fmt(int fmt) |
@@ -232,7 +230,7 @@ static void dump_ch(const struct ubifs_ch *ch) | |||
232 | printk(KERN_ERR "\tlen %u\n", le32_to_cpu(ch->len)); | 230 | printk(KERN_ERR "\tlen %u\n", le32_to_cpu(ch->len)); |
233 | } | 231 | } |
234 | 232 | ||
235 | void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode) | 233 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode) |
236 | { | 234 | { |
237 | const struct ubifs_inode *ui = ubifs_inode(inode); | 235 | const struct ubifs_inode *ui = ubifs_inode(inode); |
238 | struct qstr nm = { .name = NULL }; | 236 | struct qstr nm = { .name = NULL }; |
@@ -300,7 +298,7 @@ void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode) | |||
300 | kfree(pdent); | 298 | kfree(pdent); |
301 | } | 299 | } |
302 | 300 | ||
303 | void dbg_dump_node(const struct ubifs_info *c, const void *node) | 301 | void ubifs_dump_node(const struct ubifs_info *c, const void *node) |
304 | { | 302 | { |
305 | int i, n; | 303 | int i, n; |
306 | union ubifs_key key; | 304 | union ubifs_key key; |
@@ -603,7 +601,7 @@ void dbg_dump_node(const struct ubifs_info *c, const void *node) | |||
603 | spin_unlock(&dbg_lock); | 601 | spin_unlock(&dbg_lock); |
604 | } | 602 | } |
605 | 603 | ||
606 | void dbg_dump_budget_req(const struct ubifs_budget_req *req) | 604 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req) |
607 | { | 605 | { |
608 | spin_lock(&dbg_lock); | 606 | spin_lock(&dbg_lock); |
609 | printk(KERN_ERR "Budgeting request: new_ino %d, dirtied_ino %d\n", | 607 | printk(KERN_ERR "Budgeting request: new_ino %d, dirtied_ino %d\n", |
@@ -620,7 +618,7 @@ void dbg_dump_budget_req(const struct ubifs_budget_req *req) | |||
620 | spin_unlock(&dbg_lock); | 618 | spin_unlock(&dbg_lock); |
621 | } | 619 | } |
622 | 620 | ||
623 | void dbg_dump_lstats(const struct ubifs_lp_stats *lst) | 621 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst) |
624 | { | 622 | { |
625 | spin_lock(&dbg_lock); | 623 | spin_lock(&dbg_lock); |
626 | printk(KERN_ERR "(pid %d) Lprops statistics: empty_lebs %d, " | 624 | printk(KERN_ERR "(pid %d) Lprops statistics: empty_lebs %d, " |
@@ -634,7 +632,7 @@ void dbg_dump_lstats(const struct ubifs_lp_stats *lst) | |||
634 | spin_unlock(&dbg_lock); | 632 | spin_unlock(&dbg_lock); |
635 | } | 633 | } |
636 | 634 | ||
637 | void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) | 635 | void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi) |
638 | { | 636 | { |
639 | int i; | 637 | int i; |
640 | struct rb_node *rb; | 638 | struct rb_node *rb; |
@@ -707,7 +705,7 @@ out_unlock: | |||
707 | spin_unlock(&c->space_lock); | 705 | spin_unlock(&c->space_lock); |
708 | } | 706 | } |
709 | 707 | ||
710 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | 708 | void ubifs_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) |
711 | { | 709 | { |
712 | int i, spc, dark = 0, dead = 0; | 710 | int i, spc, dark = 0, dead = 0; |
713 | struct rb_node *rb; | 711 | struct rb_node *rb; |
@@ -801,7 +799,7 @@ void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp) | |||
801 | printk(KERN_CONT ")\n"); | 799 | printk(KERN_CONT ")\n"); |
802 | } | 800 | } |
803 | 801 | ||
804 | void dbg_dump_lprops(struct ubifs_info *c) | 802 | void ubifs_dump_lprops(struct ubifs_info *c) |
805 | { | 803 | { |
806 | int lnum, err; | 804 | int lnum, err; |
807 | struct ubifs_lprops lp; | 805 | struct ubifs_lprops lp; |
@@ -810,20 +808,20 @@ void dbg_dump_lprops(struct ubifs_info *c) | |||
810 | printk(KERN_ERR "(pid %d) start dumping LEB properties\n", | 808 | printk(KERN_ERR "(pid %d) start dumping LEB properties\n", |
811 | current->pid); | 809 | current->pid); |
812 | ubifs_get_lp_stats(c, &lst); | 810 | ubifs_get_lp_stats(c, &lst); |
813 | dbg_dump_lstats(&lst); | 811 | ubifs_dump_lstats(&lst); |
814 | 812 | ||
815 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { | 813 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { |
816 | err = ubifs_read_one_lp(c, lnum, &lp); | 814 | err = ubifs_read_one_lp(c, lnum, &lp); |
817 | if (err) | 815 | if (err) |
818 | ubifs_err("cannot read lprops for LEB %d", lnum); | 816 | ubifs_err("cannot read lprops for LEB %d", lnum); |
819 | 817 | ||
820 | dbg_dump_lprop(c, &lp); | 818 | ubifs_dump_lprop(c, &lp); |
821 | } | 819 | } |
822 | printk(KERN_ERR "(pid %d) finish dumping LEB properties\n", | 820 | printk(KERN_ERR "(pid %d) finish dumping LEB properties\n", |
823 | current->pid); | 821 | current->pid); |
824 | } | 822 | } |
825 | 823 | ||
826 | void dbg_dump_lpt_info(struct ubifs_info *c) | 824 | void ubifs_dump_lpt_info(struct ubifs_info *c) |
827 | { | 825 | { |
828 | int i; | 826 | int i; |
829 | 827 | ||
@@ -862,8 +860,8 @@ void dbg_dump_lpt_info(struct ubifs_info *c) | |||
862 | spin_unlock(&dbg_lock); | 860 | spin_unlock(&dbg_lock); |
863 | } | 861 | } |
864 | 862 | ||
865 | void dbg_dump_sleb(const struct ubifs_info *c, | 863 | void ubifs_dump_sleb(const struct ubifs_info *c, |
866 | const struct ubifs_scan_leb *sleb, int offs) | 864 | const struct ubifs_scan_leb *sleb, int offs) |
867 | { | 865 | { |
868 | struct ubifs_scan_node *snod; | 866 | struct ubifs_scan_node *snod; |
869 | 867 | ||
@@ -874,11 +872,11 @@ void dbg_dump_sleb(const struct ubifs_info *c, | |||
874 | cond_resched(); | 872 | cond_resched(); |
875 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", sleb->lnum, | 873 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", sleb->lnum, |
876 | snod->offs, snod->len); | 874 | snod->offs, snod->len); |
877 | dbg_dump_node(c, snod->node); | 875 | ubifs_dump_node(c, snod->node); |
878 | } | 876 | } |
879 | } | 877 | } |
880 | 878 | ||
881 | void dbg_dump_leb(const struct ubifs_info *c, int lnum) | 879 | void ubifs_dump_leb(const struct ubifs_info *c, int lnum) |
882 | { | 880 | { |
883 | struct ubifs_scan_leb *sleb; | 881 | struct ubifs_scan_leb *sleb; |
884 | struct ubifs_scan_node *snod; | 882 | struct ubifs_scan_node *snod; |
@@ -909,7 +907,7 @@ void dbg_dump_leb(const struct ubifs_info *c, int lnum) | |||
909 | cond_resched(); | 907 | cond_resched(); |
910 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", lnum, | 908 | printk(KERN_ERR "Dumping node at LEB %d:%d len %d\n", lnum, |
911 | snod->offs, snod->len); | 909 | snod->offs, snod->len); |
912 | dbg_dump_node(c, snod->node); | 910 | ubifs_dump_node(c, snod->node); |
913 | } | 911 | } |
914 | 912 | ||
915 | printk(KERN_ERR "(pid %d) finish dumping LEB %d\n", | 913 | printk(KERN_ERR "(pid %d) finish dumping LEB %d\n", |
@@ -921,8 +919,8 @@ out: | |||
921 | return; | 919 | return; |
922 | } | 920 | } |
923 | 921 | ||
924 | void dbg_dump_znode(const struct ubifs_info *c, | 922 | void ubifs_dump_znode(const struct ubifs_info *c, |
925 | const struct ubifs_znode *znode) | 923 | const struct ubifs_znode *znode) |
926 | { | 924 | { |
927 | int n; | 925 | int n; |
928 | const struct ubifs_zbranch *zbr; | 926 | const struct ubifs_zbranch *zbr; |
@@ -965,7 +963,7 @@ void dbg_dump_znode(const struct ubifs_info *c, | |||
965 | spin_unlock(&dbg_lock); | 963 | spin_unlock(&dbg_lock); |
966 | } | 964 | } |
967 | 965 | ||
968 | void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) | 966 | void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) |
969 | { | 967 | { |
970 | int i; | 968 | int i; |
971 | 969 | ||
@@ -981,8 +979,8 @@ void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat) | |||
981 | printk(KERN_ERR "(pid %d) finish dumping heap\n", current->pid); | 979 | printk(KERN_ERR "(pid %d) finish dumping heap\n", current->pid); |
982 | } | 980 | } |
983 | 981 | ||
984 | void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 982 | void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, |
985 | struct ubifs_nnode *parent, int iip) | 983 | struct ubifs_nnode *parent, int iip) |
986 | { | 984 | { |
987 | int i; | 985 | int i; |
988 | 986 | ||
@@ -999,7 +997,7 @@ void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
999 | } | 997 | } |
1000 | } | 998 | } |
1001 | 999 | ||
1002 | void dbg_dump_tnc(struct ubifs_info *c) | 1000 | void ubifs_dump_tnc(struct ubifs_info *c) |
1003 | { | 1001 | { |
1004 | struct ubifs_znode *znode; | 1002 | struct ubifs_znode *znode; |
1005 | int level; | 1003 | int level; |
@@ -1014,7 +1012,7 @@ void dbg_dump_tnc(struct ubifs_info *c) | |||
1014 | level = znode->level; | 1012 | level = znode->level; |
1015 | printk(KERN_ERR "== Level %d ==\n", level); | 1013 | printk(KERN_ERR "== Level %d ==\n", level); |
1016 | } | 1014 | } |
1017 | dbg_dump_znode(c, znode); | 1015 | ubifs_dump_znode(c, znode); |
1018 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); | 1016 | znode = ubifs_tnc_levelorder_next(c->zroot.znode, znode); |
1019 | } | 1017 | } |
1020 | printk(KERN_ERR "(pid %d) finish dumping TNC tree\n", current->pid); | 1018 | printk(KERN_ERR "(pid %d) finish dumping TNC tree\n", current->pid); |
@@ -1023,18 +1021,18 @@ void dbg_dump_tnc(struct ubifs_info *c) | |||
1023 | static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, | 1021 | static int dump_znode(struct ubifs_info *c, struct ubifs_znode *znode, |
1024 | void *priv) | 1022 | void *priv) |
1025 | { | 1023 | { |
1026 | dbg_dump_znode(c, znode); | 1024 | ubifs_dump_znode(c, znode); |
1027 | return 0; | 1025 | return 0; |
1028 | } | 1026 | } |
1029 | 1027 | ||
1030 | /** | 1028 | /** |
1031 | * dbg_dump_index - dump the on-flash index. | 1029 | * ubifs_dump_index - dump the on-flash index. |
1032 | * @c: UBIFS file-system description object | 1030 | * @c: UBIFS file-system description object |
1033 | * | 1031 | * |
1034 | * This function dumps whole UBIFS indexing B-tree, unlike 'dbg_dump_tnc()' | 1032 | * This function dumps whole UBIFS indexing B-tree, unlike 'ubifs_dump_tnc()' |
1035 | * which dumps only in-memory znodes and does not read znodes which from flash. | 1033 | * which dumps only in-memory znodes and does not read znodes which from flash. |
1036 | */ | 1034 | */ |
1037 | void dbg_dump_index(struct ubifs_info *c) | 1035 | void ubifs_dump_index(struct ubifs_info *c) |
1038 | { | 1036 | { |
1039 | dbg_walk_index(c, NULL, dump_znode, NULL); | 1037 | dbg_walk_index(c, NULL, dump_znode, NULL); |
1040 | } | 1038 | } |
@@ -1120,15 +1118,15 @@ int dbg_check_space_info(struct ubifs_info *c) | |||
1120 | 1118 | ||
1121 | out: | 1119 | out: |
1122 | ubifs_msg("saved lprops statistics dump"); | 1120 | ubifs_msg("saved lprops statistics dump"); |
1123 | dbg_dump_lstats(&d->saved_lst); | 1121 | ubifs_dump_lstats(&d->saved_lst); |
1124 | ubifs_msg("saved budgeting info dump"); | 1122 | ubifs_msg("saved budgeting info dump"); |
1125 | dbg_dump_budg(c, &d->saved_bi); | 1123 | ubifs_dump_budg(c, &d->saved_bi); |
1126 | ubifs_msg("saved idx_gc_cnt %d", d->saved_idx_gc_cnt); | 1124 | ubifs_msg("saved idx_gc_cnt %d", d->saved_idx_gc_cnt); |
1127 | ubifs_msg("current lprops statistics dump"); | 1125 | ubifs_msg("current lprops statistics dump"); |
1128 | ubifs_get_lp_stats(c, &lst); | 1126 | ubifs_get_lp_stats(c, &lst); |
1129 | dbg_dump_lstats(&lst); | 1127 | ubifs_dump_lstats(&lst); |
1130 | ubifs_msg("current budgeting info dump"); | 1128 | ubifs_msg("current budgeting info dump"); |
1131 | dbg_dump_budg(c, &c->bi); | 1129 | ubifs_dump_budg(c, &c->bi); |
1132 | dump_stack(); | 1130 | dump_stack(); |
1133 | return -EINVAL; | 1131 | return -EINVAL; |
1134 | } | 1132 | } |
@@ -1160,7 +1158,7 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) | |||
1160 | "is clean", ui->ui_size, ui->synced_i_size); | 1158 | "is clean", ui->ui_size, ui->synced_i_size); |
1161 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, | 1159 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, |
1162 | inode->i_mode, i_size_read(inode)); | 1160 | inode->i_mode, i_size_read(inode)); |
1163 | dbg_dump_stack(); | 1161 | dump_stack(); |
1164 | err = -EINVAL; | 1162 | err = -EINVAL; |
1165 | } | 1163 | } |
1166 | spin_unlock(&ui->ui_lock); | 1164 | spin_unlock(&ui->ui_lock); |
@@ -1223,14 +1221,14 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1223 | "but calculated size is %llu", dir->i_ino, | 1221 | "but calculated size is %llu", dir->i_ino, |
1224 | (unsigned long long)i_size_read(dir), | 1222 | (unsigned long long)i_size_read(dir), |
1225 | (unsigned long long)size); | 1223 | (unsigned long long)size); |
1226 | dbg_dump_inode(c, dir); | 1224 | ubifs_dump_inode(c, dir); |
1227 | dump_stack(); | 1225 | dump_stack(); |
1228 | return -EINVAL; | 1226 | return -EINVAL; |
1229 | } | 1227 | } |
1230 | if (dir->i_nlink != nlink) { | 1228 | if (dir->i_nlink != nlink) { |
1231 | ubifs_err("directory inode %lu has nlink %u, but calculated " | 1229 | ubifs_err("directory inode %lu has nlink %u, but calculated " |
1232 | "nlink is %u", dir->i_ino, dir->i_nlink, nlink); | 1230 | "nlink is %u", dir->i_ino, dir->i_nlink, nlink); |
1233 | dbg_dump_inode(c, dir); | 1231 | ubifs_dump_inode(c, dir); |
1234 | dump_stack(); | 1232 | dump_stack(); |
1235 | return -EINVAL; | 1233 | return -EINVAL; |
1236 | } | 1234 | } |
@@ -1287,25 +1285,25 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1287 | err = 1; | 1285 | err = 1; |
1288 | key_read(c, &dent1->key, &key); | 1286 | key_read(c, &dent1->key, &key); |
1289 | if (keys_cmp(c, &zbr1->key, &key)) { | 1287 | if (keys_cmp(c, &zbr1->key, &key)) { |
1290 | dbg_err("1st entry at %d:%d has key %s", zbr1->lnum, | 1288 | ubifs_err("1st entry at %d:%d has key %s", zbr1->lnum, |
1291 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1289 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1292 | DBG_KEY_BUF_LEN)); | 1290 | DBG_KEY_BUF_LEN)); |
1293 | dbg_err("but it should have key %s according to tnc", | 1291 | ubifs_err("but it should have key %s according to tnc", |
1294 | dbg_snprintf_key(c, &zbr1->key, key_buf, | 1292 | dbg_snprintf_key(c, &zbr1->key, key_buf, |
1295 | DBG_KEY_BUF_LEN)); | 1293 | DBG_KEY_BUF_LEN)); |
1296 | dbg_dump_node(c, dent1); | 1294 | ubifs_dump_node(c, dent1); |
1297 | goto out_free; | 1295 | goto out_free; |
1298 | } | 1296 | } |
1299 | 1297 | ||
1300 | key_read(c, &dent2->key, &key); | 1298 | key_read(c, &dent2->key, &key); |
1301 | if (keys_cmp(c, &zbr2->key, &key)) { | 1299 | if (keys_cmp(c, &zbr2->key, &key)) { |
1302 | dbg_err("2nd entry at %d:%d has key %s", zbr1->lnum, | 1300 | ubifs_err("2nd entry at %d:%d has key %s", zbr1->lnum, |
1303 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1301 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1304 | DBG_KEY_BUF_LEN)); | 1302 | DBG_KEY_BUF_LEN)); |
1305 | dbg_err("but it should have key %s according to tnc", | 1303 | ubifs_err("but it should have key %s according to tnc", |
1306 | dbg_snprintf_key(c, &zbr2->key, key_buf, | 1304 | dbg_snprintf_key(c, &zbr2->key, key_buf, |
1307 | DBG_KEY_BUF_LEN)); | 1305 | DBG_KEY_BUF_LEN)); |
1308 | dbg_dump_node(c, dent2); | 1306 | ubifs_dump_node(c, dent2); |
1309 | goto out_free; | 1307 | goto out_free; |
1310 | } | 1308 | } |
1311 | 1309 | ||
@@ -1318,15 +1316,15 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1318 | goto out_free; | 1316 | goto out_free; |
1319 | } | 1317 | } |
1320 | if (cmp == 0 && nlen1 == nlen2) | 1318 | if (cmp == 0 && nlen1 == nlen2) |
1321 | dbg_err("2 xent/dent nodes with the same name"); | 1319 | ubifs_err("2 xent/dent nodes with the same name"); |
1322 | else | 1320 | else |
1323 | dbg_err("bad order of colliding key %s", | 1321 | ubifs_err("bad order of colliding key %s", |
1324 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 1322 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
1325 | 1323 | ||
1326 | ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs); | 1324 | ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs); |
1327 | dbg_dump_node(c, dent1); | 1325 | ubifs_dump_node(c, dent1); |
1328 | ubifs_msg("second node at %d:%d\n", zbr2->lnum, zbr2->offs); | 1326 | ubifs_msg("second node at %d:%d\n", zbr2->lnum, zbr2->offs); |
1329 | dbg_dump_node(c, dent2); | 1327 | ubifs_dump_node(c, dent2); |
1330 | 1328 | ||
1331 | out_free: | 1329 | out_free: |
1332 | kfree(dent2); | 1330 | kfree(dent2); |
@@ -1529,10 +1527,10 @@ static int dbg_check_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr) | |||
1529 | out: | 1527 | out: |
1530 | ubifs_err("failed, error %d", err); | 1528 | ubifs_err("failed, error %d", err); |
1531 | ubifs_msg("dump of the znode"); | 1529 | ubifs_msg("dump of the znode"); |
1532 | dbg_dump_znode(c, znode); | 1530 | ubifs_dump_znode(c, znode); |
1533 | if (zp) { | 1531 | if (zp) { |
1534 | ubifs_msg("dump of the parent znode"); | 1532 | ubifs_msg("dump of the parent znode"); |
1535 | dbg_dump_znode(c, zp); | 1533 | ubifs_dump_znode(c, zp); |
1536 | } | 1534 | } |
1537 | dump_stack(); | 1535 | dump_stack(); |
1538 | return -EINVAL; | 1536 | return -EINVAL; |
@@ -1599,9 +1597,9 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1599 | return err; | 1597 | return err; |
1600 | if (err) { | 1598 | if (err) { |
1601 | ubifs_msg("first znode"); | 1599 | ubifs_msg("first znode"); |
1602 | dbg_dump_znode(c, prev); | 1600 | ubifs_dump_znode(c, prev); |
1603 | ubifs_msg("second znode"); | 1601 | ubifs_msg("second znode"); |
1604 | dbg_dump_znode(c, znode); | 1602 | ubifs_dump_znode(c, znode); |
1605 | return -EINVAL; | 1603 | return -EINVAL; |
1606 | } | 1604 | } |
1607 | } | 1605 | } |
@@ -1690,7 +1688,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1690 | if (err) { | 1688 | if (err) { |
1691 | ubifs_err("znode checking function returned " | 1689 | ubifs_err("znode checking function returned " |
1692 | "error %d", err); | 1690 | "error %d", err); |
1693 | dbg_dump_znode(c, znode); | 1691 | ubifs_dump_znode(c, znode); |
1694 | goto out_dump; | 1692 | goto out_dump; |
1695 | } | 1693 | } |
1696 | } | 1694 | } |
@@ -1758,7 +1756,7 @@ out_dump: | |||
1758 | else | 1756 | else |
1759 | zbr = &c->zroot; | 1757 | zbr = &c->zroot; |
1760 | ubifs_msg("dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); | 1758 | ubifs_msg("dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); |
1761 | dbg_dump_znode(c, znode); | 1759 | ubifs_dump_znode(c, znode); |
1762 | out_unlock: | 1760 | out_unlock: |
1763 | mutex_unlock(&c->tnc_mutex); | 1761 | mutex_unlock(&c->tnc_mutex); |
1764 | return err; | 1762 | return err; |
@@ -2194,7 +2192,7 @@ out: | |||
2194 | 2192 | ||
2195 | out_dump: | 2193 | out_dump: |
2196 | ubifs_msg("dump of node at LEB %d:%d", zbr->lnum, zbr->offs); | 2194 | ubifs_msg("dump of node at LEB %d:%d", zbr->lnum, zbr->offs); |
2197 | dbg_dump_node(c, node); | 2195 | ubifs_dump_node(c, node); |
2198 | out_free: | 2196 | out_free: |
2199 | kfree(node); | 2197 | kfree(node); |
2200 | return err; | 2198 | return err; |
@@ -2352,7 +2350,7 @@ out_dump: | |||
2352 | 2350 | ||
2353 | ubifs_msg("dump of the inode %lu sitting in LEB %d:%d", | 2351 | ubifs_msg("dump of the inode %lu sitting in LEB %d:%d", |
2354 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); | 2352 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); |
2355 | dbg_dump_node(c, ino); | 2353 | ubifs_dump_node(c, ino); |
2356 | kfree(ino); | 2354 | kfree(ino); |
2357 | return -EINVAL; | 2355 | return -EINVAL; |
2358 | } | 2356 | } |
@@ -2423,12 +2421,12 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2423 | 2421 | ||
2424 | if (sa->type != UBIFS_DATA_NODE) { | 2422 | if (sa->type != UBIFS_DATA_NODE) { |
2425 | ubifs_err("bad node type %d", sa->type); | 2423 | ubifs_err("bad node type %d", sa->type); |
2426 | dbg_dump_node(c, sa->node); | 2424 | ubifs_dump_node(c, sa->node); |
2427 | return -EINVAL; | 2425 | return -EINVAL; |
2428 | } | 2426 | } |
2429 | if (sb->type != UBIFS_DATA_NODE) { | 2427 | if (sb->type != UBIFS_DATA_NODE) { |
2430 | ubifs_err("bad node type %d", sb->type); | 2428 | ubifs_err("bad node type %d", sb->type); |
2431 | dbg_dump_node(c, sb->node); | 2429 | ubifs_dump_node(c, sb->node); |
2432 | return -EINVAL; | 2430 | return -EINVAL; |
2433 | } | 2431 | } |
2434 | 2432 | ||
@@ -2459,8 +2457,8 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2459 | return 0; | 2457 | return 0; |
2460 | 2458 | ||
2461 | error_dump: | 2459 | error_dump: |
2462 | dbg_dump_node(c, sa->node); | 2460 | ubifs_dump_node(c, sa->node); |
2463 | dbg_dump_node(c, sb->node); | 2461 | ubifs_dump_node(c, sb->node); |
2464 | return -EINVAL; | 2462 | return -EINVAL; |
2465 | } | 2463 | } |
2466 | 2464 | ||
@@ -2491,13 +2489,13 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2491 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2489 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2492 | sa->type != UBIFS_XENT_NODE) { | 2490 | sa->type != UBIFS_XENT_NODE) { |
2493 | ubifs_err("bad node type %d", sa->type); | 2491 | ubifs_err("bad node type %d", sa->type); |
2494 | dbg_dump_node(c, sa->node); | 2492 | ubifs_dump_node(c, sa->node); |
2495 | return -EINVAL; | 2493 | return -EINVAL; |
2496 | } | 2494 | } |
2497 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2495 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2498 | sa->type != UBIFS_XENT_NODE) { | 2496 | sa->type != UBIFS_XENT_NODE) { |
2499 | ubifs_err("bad node type %d", sb->type); | 2497 | ubifs_err("bad node type %d", sb->type); |
2500 | dbg_dump_node(c, sb->node); | 2498 | ubifs_dump_node(c, sb->node); |
2501 | return -EINVAL; | 2499 | return -EINVAL; |
2502 | } | 2500 | } |
2503 | 2501 | ||
@@ -2547,9 +2545,9 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2547 | 2545 | ||
2548 | error_dump: | 2546 | error_dump: |
2549 | ubifs_msg("dumping first node"); | 2547 | ubifs_msg("dumping first node"); |
2550 | dbg_dump_node(c, sa->node); | 2548 | ubifs_dump_node(c, sa->node); |
2551 | ubifs_msg("dumping second node"); | 2549 | ubifs_msg("dumping second node"); |
2552 | dbg_dump_node(c, sb->node); | 2550 | ubifs_dump_node(c, sb->node); |
2553 | return -EINVAL; | 2551 | return -EINVAL; |
2554 | return 0; | 2552 | return 0; |
2555 | } | 2553 | } |
@@ -2678,7 +2676,7 @@ static void cut_data(const void *buf, unsigned int len) | |||
2678 | } | 2676 | } |
2679 | 2677 | ||
2680 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | 2678 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, |
2681 | int offs, int len, int dtype) | 2679 | int offs, int len) |
2682 | { | 2680 | { |
2683 | int err, failing; | 2681 | int err, failing; |
2684 | 2682 | ||
@@ -2688,7 +2686,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2688 | failing = power_cut_emulated(c, lnum, 1); | 2686 | failing = power_cut_emulated(c, lnum, 1); |
2689 | if (failing) | 2687 | if (failing) |
2690 | cut_data(buf, len); | 2688 | cut_data(buf, len); |
2691 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); | 2689 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
2692 | if (err) | 2690 | if (err) |
2693 | return err; | 2691 | return err; |
2694 | if (failing) | 2692 | if (failing) |
@@ -2697,7 +2695,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2697 | } | 2695 | } |
2698 | 2696 | ||
2699 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, | 2697 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, |
2700 | int len, int dtype) | 2698 | int len) |
2701 | { | 2699 | { |
2702 | int err; | 2700 | int err; |
2703 | 2701 | ||
@@ -2705,7 +2703,7 @@ int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, | |||
2705 | return -EROFS; | 2703 | return -EROFS; |
2706 | if (power_cut_emulated(c, lnum, 1)) | 2704 | if (power_cut_emulated(c, lnum, 1)) |
2707 | return -EROFS; | 2705 | return -EROFS; |
2708 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); | 2706 | err = ubi_leb_change(c->ubi, lnum, buf, len); |
2709 | if (err) | 2707 | if (err) |
2710 | return err; | 2708 | return err; |
2711 | if (power_cut_emulated(c, lnum, 1)) | 2709 | if (power_cut_emulated(c, lnum, 1)) |
@@ -2729,7 +2727,7 @@ int dbg_leb_unmap(struct ubifs_info *c, int lnum) | |||
2729 | return 0; | 2727 | return 0; |
2730 | } | 2728 | } |
2731 | 2729 | ||
2732 | int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype) | 2730 | int dbg_leb_map(struct ubifs_info *c, int lnum) |
2733 | { | 2731 | { |
2734 | int err; | 2732 | int err; |
2735 | 2733 | ||
@@ -2737,7 +2735,7 @@ int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype) | |||
2737 | return -EROFS; | 2735 | return -EROFS; |
2738 | if (power_cut_emulated(c, lnum, 0)) | 2736 | if (power_cut_emulated(c, lnum, 0)) |
2739 | return -EROFS; | 2737 | return -EROFS; |
2740 | err = ubi_leb_map(c->ubi, lnum, dtype); | 2738 | err = ubi_leb_map(c->ubi, lnum); |
2741 | if (err) | 2739 | if (err) |
2742 | return err; | 2740 | return err; |
2743 | if (power_cut_emulated(c, lnum, 0)) | 2741 | if (power_cut_emulated(c, lnum, 0)) |
@@ -2857,16 +2855,16 @@ static ssize_t dfs_file_write(struct file *file, const char __user *u, | |||
2857 | * 'ubifs-debug' file-system instead. | 2855 | * 'ubifs-debug' file-system instead. |
2858 | */ | 2856 | */ |
2859 | if (file->f_path.dentry == d->dfs_dump_lprops) { | 2857 | if (file->f_path.dentry == d->dfs_dump_lprops) { |
2860 | dbg_dump_lprops(c); | 2858 | ubifs_dump_lprops(c); |
2861 | return count; | 2859 | return count; |
2862 | } | 2860 | } |
2863 | if (file->f_path.dentry == d->dfs_dump_budg) { | 2861 | if (file->f_path.dentry == d->dfs_dump_budg) { |
2864 | dbg_dump_budg(c, &c->bi); | 2862 | ubifs_dump_budg(c, &c->bi); |
2865 | return count; | 2863 | return count; |
2866 | } | 2864 | } |
2867 | if (file->f_path.dentry == d->dfs_dump_tnc) { | 2865 | if (file->f_path.dentry == d->dfs_dump_tnc) { |
2868 | mutex_lock(&c->tnc_mutex); | 2866 | mutex_lock(&c->tnc_mutex); |
2869 | dbg_dump_tnc(c); | 2867 | ubifs_dump_tnc(c); |
2870 | mutex_unlock(&c->tnc_mutex); | 2868 | mutex_unlock(&c->tnc_mutex); |
2871 | return count; | 2869 | return count; |
2872 | } | 2870 | } |
@@ -3189,5 +3187,3 @@ void ubifs_debugging_exit(struct ubifs_info *c) | |||
3189 | { | 3187 | { |
3190 | kfree(c->dbg); | 3188 | kfree(c->dbg); |
3191 | } | 3189 | } |
3192 | |||
3193 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 9f717655df18..486a8e024fb6 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
@@ -29,8 +29,6 @@ typedef int (*dbg_leaf_callback)(struct ubifs_info *c, | |||
29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, | 29 | typedef int (*dbg_znode_callback)(struct ubifs_info *c, |
30 | struct ubifs_znode *znode, void *priv); | 30 | struct ubifs_znode *znode, void *priv); |
31 | 31 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
33 | |||
34 | /* | 32 | /* |
35 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" | 33 | * The UBIFS debugfs directory name pattern and maximum name length (3 for "ubi" |
36 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. | 34 | * + 1 for "_" and plus 2x2 for 2 UBI numbers and 1 for the trailing zero byte. |
@@ -149,7 +147,7 @@ struct ubifs_global_debug_info { | |||
149 | if (unlikely(!(expr))) { \ | 147 | if (unlikely(!(expr))) { \ |
150 | printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ | 148 | printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ |
151 | __func__, __LINE__, current->pid); \ | 149 | __func__, __LINE__, current->pid); \ |
152 | dbg_dump_stack(); \ | 150 | dump_stack(); \ |
153 | } \ | 151 | } \ |
154 | } while (0) | 152 | } while (0) |
155 | 153 | ||
@@ -161,12 +159,6 @@ struct ubifs_global_debug_info { | |||
161 | } \ | 159 | } \ |
162 | } while (0) | 160 | } while (0) |
163 | 161 | ||
164 | #define dbg_dump_stack() dump_stack() | ||
165 | |||
166 | #define dbg_err(fmt, ...) do { \ | ||
167 | ubifs_err(fmt, ##__VA_ARGS__); \ | ||
168 | } while (0) | ||
169 | |||
170 | #define ubifs_dbg_msg(type, fmt, ...) \ | 162 | #define ubifs_dbg_msg(type, fmt, ...) \ |
171 | pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) | 163 | pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) |
172 | 164 | ||
@@ -257,27 +249,27 @@ const char *dbg_get_key_dump(const struct ubifs_info *c, | |||
257 | const union ubifs_key *key); | 249 | const union ubifs_key *key); |
258 | const char *dbg_snprintf_key(const struct ubifs_info *c, | 250 | const char *dbg_snprintf_key(const struct ubifs_info *c, |
259 | const union ubifs_key *key, char *buffer, int len); | 251 | const union ubifs_key *key, char *buffer, int len); |
260 | void dbg_dump_inode(struct ubifs_info *c, const struct inode *inode); | 252 | void ubifs_dump_inode(struct ubifs_info *c, const struct inode *inode); |
261 | void dbg_dump_node(const struct ubifs_info *c, const void *node); | 253 | void ubifs_dump_node(const struct ubifs_info *c, const void *node); |
262 | void dbg_dump_lpt_node(const struct ubifs_info *c, void *node, int lnum, | 254 | void ubifs_dump_budget_req(const struct ubifs_budget_req *req); |
263 | int offs); | 255 | void ubifs_dump_lstats(const struct ubifs_lp_stats *lst); |
264 | void dbg_dump_budget_req(const struct ubifs_budget_req *req); | 256 | void ubifs_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi); |
265 | void dbg_dump_lstats(const struct ubifs_lp_stats *lst); | 257 | void ubifs_dump_lprop(const struct ubifs_info *c, |
266 | void dbg_dump_budg(struct ubifs_info *c, const struct ubifs_budg_info *bi); | 258 | const struct ubifs_lprops *lp); |
267 | void dbg_dump_lprop(const struct ubifs_info *c, const struct ubifs_lprops *lp); | 259 | void ubifs_dump_lprops(struct ubifs_info *c); |
268 | void dbg_dump_lprops(struct ubifs_info *c); | 260 | void ubifs_dump_lpt_info(struct ubifs_info *c); |
269 | void dbg_dump_lpt_info(struct ubifs_info *c); | 261 | void ubifs_dump_leb(const struct ubifs_info *c, int lnum); |
270 | void dbg_dump_leb(const struct ubifs_info *c, int lnum); | 262 | void ubifs_dump_sleb(const struct ubifs_info *c, |
271 | void dbg_dump_sleb(const struct ubifs_info *c, | 263 | const struct ubifs_scan_leb *sleb, int offs); |
272 | const struct ubifs_scan_leb *sleb, int offs); | 264 | void ubifs_dump_znode(const struct ubifs_info *c, |
273 | void dbg_dump_znode(const struct ubifs_info *c, | 265 | const struct ubifs_znode *znode); |
274 | const struct ubifs_znode *znode); | 266 | void ubifs_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, |
275 | void dbg_dump_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat); | 267 | int cat); |
276 | void dbg_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | 268 | void ubifs_dump_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, |
277 | struct ubifs_nnode *parent, int iip); | 269 | struct ubifs_nnode *parent, int iip); |
278 | void dbg_dump_tnc(struct ubifs_info *c); | 270 | void ubifs_dump_tnc(struct ubifs_info *c); |
279 | void dbg_dump_index(struct ubifs_info *c); | 271 | void ubifs_dump_index(struct ubifs_info *c); |
280 | void dbg_dump_lpt_lebs(const struct ubifs_info *c); | 272 | void ubifs_dump_lpt_lebs(const struct ubifs_info *c); |
281 | 273 | ||
282 | int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | 274 | int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, |
283 | dbg_znode_callback znode_cb, void *priv); | 275 | dbg_znode_callback znode_cb, void *priv); |
@@ -307,11 +299,10 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head); | |||
307 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); | 299 | int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head); |
308 | 300 | ||
309 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 301 | int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
310 | int len, int dtype); | 302 | int len); |
311 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 303 | int dbg_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); |
312 | int dtype); | ||
313 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); | 304 | int dbg_leb_unmap(struct ubifs_info *c, int lnum); |
314 | int dbg_leb_map(struct ubifs_info *c, int lnum, int dtype); | 305 | int dbg_leb_map(struct ubifs_info *c, int lnum); |
315 | 306 | ||
316 | /* Debugfs-related stuff */ | 307 | /* Debugfs-related stuff */ |
317 | int dbg_debugfs_init(void); | 308 | int dbg_debugfs_init(void); |
@@ -319,162 +310,4 @@ void dbg_debugfs_exit(void); | |||
319 | int dbg_debugfs_init_fs(struct ubifs_info *c); | 310 | int dbg_debugfs_init_fs(struct ubifs_info *c); |
320 | void dbg_debugfs_exit_fs(struct ubifs_info *c); | 311 | void dbg_debugfs_exit_fs(struct ubifs_info *c); |
321 | 312 | ||
322 | #else /* !CONFIG_UBIFS_FS_DEBUG */ | ||
323 | |||
324 | /* Use "if (0)" to make compiler check arguments even if debugging is off */ | ||
325 | #define ubifs_assert(expr) do { \ | ||
326 | if (0) \ | ||
327 | printk(KERN_CRIT "UBIFS assert failed in %s at %u (pid %d)\n", \ | ||
328 | __func__, __LINE__, current->pid); \ | ||
329 | } while (0) | ||
330 | |||
331 | #define dbg_err(fmt, ...) do { \ | ||
332 | if (0) \ | ||
333 | ubifs_err(fmt, ##__VA_ARGS__); \ | ||
334 | } while (0) | ||
335 | |||
336 | #define DBGKEY(key) ((char *)(key)) | ||
337 | #define DBGKEY1(key) ((char *)(key)) | ||
338 | |||
339 | #define ubifs_dbg_msg(fmt, ...) do { \ | ||
340 | if (0) \ | ||
341 | printk(KERN_DEBUG fmt "\n", ##__VA_ARGS__); \ | ||
342 | } while (0) | ||
343 | |||
344 | #define dbg_dump_stack() | ||
345 | #define ubifs_assert_cmt_locked(c) | ||
346 | |||
347 | #define dbg_msg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
348 | #define dbg_gen(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
349 | #define dbg_jnl(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
350 | #define dbg_jnlk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
351 | #define dbg_tnc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
352 | #define dbg_tnck(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
353 | #define dbg_lp(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
354 | #define dbg_find(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
355 | #define dbg_mnt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
356 | #define dbg_mntk(key, fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
357 | #define dbg_io(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
358 | #define dbg_cmt(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
359 | #define dbg_budg(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
360 | #define dbg_log(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
361 | #define dbg_gc(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
362 | #define dbg_scan(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
363 | #define dbg_rcvry(fmt, ...) ubifs_dbg_msg(fmt, ##__VA_ARGS__) | ||
364 | |||
365 | static inline int ubifs_debugging_init(struct ubifs_info *c) { return 0; } | ||
366 | static inline void ubifs_debugging_exit(struct ubifs_info *c) { return; } | ||
367 | static inline const char *dbg_ntype(int type) { return ""; } | ||
368 | static inline const char *dbg_cstate(int cmt_state) { return ""; } | ||
369 | static inline const char *dbg_jhead(int jhead) { return ""; } | ||
370 | static inline const char * | ||
371 | dbg_get_key_dump(const struct ubifs_info *c, | ||
372 | const union ubifs_key *key) { return ""; } | ||
373 | static inline const char * | ||
374 | dbg_snprintf_key(const struct ubifs_info *c, | ||
375 | const union ubifs_key *key, char *buffer, | ||
376 | int len) { return ""; } | ||
377 | static inline void dbg_dump_inode(struct ubifs_info *c, | ||
378 | const struct inode *inode) { return; } | ||
379 | static inline void dbg_dump_node(const struct ubifs_info *c, | ||
380 | const void *node) { return; } | ||
381 | static inline void dbg_dump_lpt_node(const struct ubifs_info *c, | ||
382 | void *node, int lnum, | ||
383 | int offs) { return; } | ||
384 | static inline void | ||
385 | dbg_dump_budget_req(const struct ubifs_budget_req *req) { return; } | ||
386 | static inline void | ||
387 | dbg_dump_lstats(const struct ubifs_lp_stats *lst) { return; } | ||
388 | static inline void | ||
389 | dbg_dump_budg(struct ubifs_info *c, | ||
390 | const struct ubifs_budg_info *bi) { return; } | ||
391 | static inline void dbg_dump_lprop(const struct ubifs_info *c, | ||
392 | const struct ubifs_lprops *lp) { return; } | ||
393 | static inline void dbg_dump_lprops(struct ubifs_info *c) { return; } | ||
394 | static inline void dbg_dump_lpt_info(struct ubifs_info *c) { return; } | ||
395 | static inline void dbg_dump_leb(const struct ubifs_info *c, | ||
396 | int lnum) { return; } | ||
397 | static inline void | ||
398 | dbg_dump_sleb(const struct ubifs_info *c, | ||
399 | const struct ubifs_scan_leb *sleb, int offs) { return; } | ||
400 | static inline void | ||
401 | dbg_dump_znode(const struct ubifs_info *c, | ||
402 | const struct ubifs_znode *znode) { return; } | ||
403 | static inline void dbg_dump_heap(struct ubifs_info *c, | ||
404 | struct ubifs_lpt_heap *heap, | ||
405 | int cat) { return; } | ||
406 | static inline void dbg_dump_pnode(struct ubifs_info *c, | ||
407 | struct ubifs_pnode *pnode, | ||
408 | struct ubifs_nnode *parent, | ||
409 | int iip) { return; } | ||
410 | static inline void dbg_dump_tnc(struct ubifs_info *c) { return; } | ||
411 | static inline void dbg_dump_index(struct ubifs_info *c) { return; } | ||
412 | static inline void dbg_dump_lpt_lebs(const struct ubifs_info *c) { return; } | ||
413 | |||
414 | static inline int dbg_walk_index(struct ubifs_info *c, | ||
415 | dbg_leaf_callback leaf_cb, | ||
416 | dbg_znode_callback znode_cb, | ||
417 | void *priv) { return 0; } | ||
418 | static inline void dbg_save_space_info(struct ubifs_info *c) { return; } | ||
419 | static inline int dbg_check_space_info(struct ubifs_info *c) { return 0; } | ||
420 | static inline int dbg_check_lprops(struct ubifs_info *c) { return 0; } | ||
421 | static inline int | ||
422 | dbg_old_index_check_init(struct ubifs_info *c, | ||
423 | struct ubifs_zbranch *zroot) { return 0; } | ||
424 | static inline int | ||
425 | dbg_check_old_index(struct ubifs_info *c, | ||
426 | struct ubifs_zbranch *zroot) { return 0; } | ||
427 | static inline int dbg_check_cats(struct ubifs_info *c) { return 0; } | ||
428 | static inline int dbg_check_ltab(struct ubifs_info *c) { return 0; } | ||
429 | static inline int dbg_chk_lpt_free_spc(struct ubifs_info *c) { return 0; } | ||
430 | static inline int dbg_chk_lpt_sz(struct ubifs_info *c, | ||
431 | int action, int len) { return 0; } | ||
432 | static inline int | ||
433 | dbg_check_synced_i_size(const struct ubifs_info *c, | ||
434 | struct inode *inode) { return 0; } | ||
435 | static inline int dbg_check_dir(struct ubifs_info *c, | ||
436 | const struct inode *dir) { return 0; } | ||
437 | static inline int dbg_check_tnc(struct ubifs_info *c, int extra) { return 0; } | ||
438 | static inline int dbg_check_idx_size(struct ubifs_info *c, | ||
439 | long long idx_size) { return 0; } | ||
440 | static inline int dbg_check_filesystem(struct ubifs_info *c) { return 0; } | ||
441 | static inline void dbg_check_heap(struct ubifs_info *c, | ||
442 | struct ubifs_lpt_heap *heap, | ||
443 | int cat, int add_pos) { return; } | ||
444 | static inline int dbg_check_lpt_nodes(struct ubifs_info *c, | ||
445 | struct ubifs_cnode *cnode, int row, int col) { return 0; } | ||
446 | static inline int dbg_check_inode_size(struct ubifs_info *c, | ||
447 | const struct inode *inode, | ||
448 | loff_t size) { return 0; } | ||
449 | static inline int | ||
450 | dbg_check_data_nodes_order(struct ubifs_info *c, | ||
451 | struct list_head *head) { return 0; } | ||
452 | static inline int | ||
453 | dbg_check_nondata_nodes_order(struct ubifs_info *c, | ||
454 | struct list_head *head) { return 0; } | ||
455 | |||
456 | static inline int dbg_leb_write(struct ubifs_info *c, int lnum, | ||
457 | const void *buf, int offset, | ||
458 | int len, int dtype) { return 0; } | ||
459 | static inline int dbg_leb_change(struct ubifs_info *c, int lnum, | ||
460 | const void *buf, int len, | ||
461 | int dtype) { return 0; } | ||
462 | static inline int dbg_leb_unmap(struct ubifs_info *c, int lnum) { return 0; } | ||
463 | static inline int dbg_leb_map(struct ubifs_info *c, int lnum, | ||
464 | int dtype) { return 0; } | ||
465 | |||
466 | static inline int dbg_is_chk_gen(const struct ubifs_info *c) { return 0; } | ||
467 | static inline int dbg_is_chk_index(const struct ubifs_info *c) { return 0; } | ||
468 | static inline int dbg_is_chk_orph(const struct ubifs_info *c) { return 0; } | ||
469 | static inline int dbg_is_chk_lprops(const struct ubifs_info *c) { return 0; } | ||
470 | static inline int dbg_is_chk_fs(const struct ubifs_info *c) { return 0; } | ||
471 | static inline int dbg_is_tst_rcvry(const struct ubifs_info *c) { return 0; } | ||
472 | static inline int dbg_is_power_cut(const struct ubifs_info *c) { return 0; } | ||
473 | |||
474 | static inline int dbg_debugfs_init(void) { return 0; } | ||
475 | static inline void dbg_debugfs_exit(void) { return; } | ||
476 | static inline int dbg_debugfs_init_fs(struct ubifs_info *c) { return 0; } | ||
477 | static inline int dbg_debugfs_exit_fs(struct ubifs_info *c) { return 0; } | ||
478 | |||
479 | #endif /* !CONFIG_UBIFS_FS_DEBUG */ | ||
480 | #endif /* !__UBIFS_DEBUG_H__ */ | 313 | #endif /* !__UBIFS_DEBUG_H__ */ |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index ec9f1870ab7f..62a2727f4ecf 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -170,8 +170,6 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, | |||
170 | return inode; | 170 | return inode; |
171 | } | 171 | } |
172 | 172 | ||
173 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
174 | |||
175 | static int dbg_check_name(const struct ubifs_info *c, | 173 | static int dbg_check_name(const struct ubifs_info *c, |
176 | const struct ubifs_dent_node *dent, | 174 | const struct ubifs_dent_node *dent, |
177 | const struct qstr *nm) | 175 | const struct qstr *nm) |
@@ -185,12 +183,6 @@ static int dbg_check_name(const struct ubifs_info *c, | |||
185 | return 0; | 183 | return 0; |
186 | } | 184 | } |
187 | 185 | ||
188 | #else | ||
189 | |||
190 | #define dbg_check_name(c, dent, nm) 0 | ||
191 | |||
192 | #endif | ||
193 | |||
194 | static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, | 186 | static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, |
195 | struct nameidata *nd) | 187 | struct nameidata *nd) |
196 | { | 188 | { |
@@ -1187,12 +1179,10 @@ const struct inode_operations ubifs_dir_inode_operations = { | |||
1187 | .rename = ubifs_rename, | 1179 | .rename = ubifs_rename, |
1188 | .setattr = ubifs_setattr, | 1180 | .setattr = ubifs_setattr, |
1189 | .getattr = ubifs_getattr, | 1181 | .getattr = ubifs_getattr, |
1190 | #ifdef CONFIG_UBIFS_FS_XATTR | ||
1191 | .setxattr = ubifs_setxattr, | 1182 | .setxattr = ubifs_setxattr, |
1192 | .getxattr = ubifs_getxattr, | 1183 | .getxattr = ubifs_getxattr, |
1193 | .listxattr = ubifs_listxattr, | 1184 | .listxattr = ubifs_listxattr, |
1194 | .removexattr = ubifs_removexattr, | 1185 | .removexattr = ubifs_removexattr, |
1195 | #endif | ||
1196 | }; | 1186 | }; |
1197 | 1187 | ||
1198 | const struct file_operations ubifs_dir_operations = { | 1188 | const struct file_operations ubifs_dir_operations = { |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index 5c8f6dc1d28b..35389ca2d267 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -97,7 +97,7 @@ static int read_block(struct inode *inode, void *addr, unsigned int block, | |||
97 | dump: | 97 | dump: |
98 | ubifs_err("bad data node (block %u, inode %lu)", | 98 | ubifs_err("bad data node (block %u, inode %lu)", |
99 | block, inode->i_ino); | 99 | block, inode->i_ino); |
100 | dbg_dump_node(c, dn); | 100 | ubifs_dump_node(c, dn); |
101 | return -EINVAL; | 101 | return -EINVAL; |
102 | } | 102 | } |
103 | 103 | ||
@@ -1562,12 +1562,10 @@ const struct address_space_operations ubifs_file_address_operations = { | |||
1562 | const struct inode_operations ubifs_file_inode_operations = { | 1562 | const struct inode_operations ubifs_file_inode_operations = { |
1563 | .setattr = ubifs_setattr, | 1563 | .setattr = ubifs_setattr, |
1564 | .getattr = ubifs_getattr, | 1564 | .getattr = ubifs_getattr, |
1565 | #ifdef CONFIG_UBIFS_FS_XATTR | ||
1566 | .setxattr = ubifs_setxattr, | 1565 | .setxattr = ubifs_setxattr, |
1567 | .getxattr = ubifs_getxattr, | 1566 | .getxattr = ubifs_getxattr, |
1568 | .listxattr = ubifs_listxattr, | 1567 | .listxattr = ubifs_listxattr, |
1569 | .removexattr = ubifs_removexattr, | 1568 | .removexattr = ubifs_removexattr, |
1570 | #endif | ||
1571 | }; | 1569 | }; |
1572 | 1570 | ||
1573 | const struct inode_operations ubifs_symlink_inode_operations = { | 1571 | const struct inode_operations ubifs_symlink_inode_operations = { |
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index ded29f6224c2..04dd6f47635e 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c | |||
@@ -109,7 +109,7 @@ static int switch_gc_head(struct ubifs_info *c) | |||
109 | return err; | 109 | return err; |
110 | 110 | ||
111 | c->gc_lnum = -1; | 111 | c->gc_lnum = -1; |
112 | err = ubifs_wbuf_seek_nolock(wbuf, gc_lnum, 0, UBI_LONGTERM); | 112 | err = ubifs_wbuf_seek_nolock(wbuf, gc_lnum, 0); |
113 | return err; | 113 | return err; |
114 | } | 114 | } |
115 | 115 | ||
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 9228950a658f..e18b9889a51b 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -109,13 +109,13 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, | |||
109 | if (err && (err != -EBADMSG || even_ebadmsg)) { | 109 | if (err && (err != -EBADMSG || even_ebadmsg)) { |
110 | ubifs_err("reading %d bytes from LEB %d:%d failed, error %d", | 110 | ubifs_err("reading %d bytes from LEB %d:%d failed, error %d", |
111 | len, lnum, offs, err); | 111 | len, lnum, offs, err); |
112 | dbg_dump_stack(); | 112 | dump_stack(); |
113 | } | 113 | } |
114 | return err; | 114 | return err; |
115 | } | 115 | } |
116 | 116 | ||
117 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 117 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
118 | int len, int dtype) | 118 | int len) |
119 | { | 119 | { |
120 | int err; | 120 | int err; |
121 | 121 | ||
@@ -123,20 +123,19 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | |||
123 | if (c->ro_error) | 123 | if (c->ro_error) |
124 | return -EROFS; | 124 | return -EROFS; |
125 | if (!dbg_is_tst_rcvry(c)) | 125 | if (!dbg_is_tst_rcvry(c)) |
126 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len, dtype); | 126 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
127 | else | 127 | else |
128 | err = dbg_leb_write(c, lnum, buf, offs, len, dtype); | 128 | err = dbg_leb_write(c, lnum, buf, offs, len); |
129 | if (err) { | 129 | if (err) { |
130 | ubifs_err("writing %d bytes to LEB %d:%d failed, error %d", | 130 | ubifs_err("writing %d bytes to LEB %d:%d failed, error %d", |
131 | len, lnum, offs, err); | 131 | len, lnum, offs, err); |
132 | ubifs_ro_mode(c, err); | 132 | ubifs_ro_mode(c, err); |
133 | dbg_dump_stack(); | 133 | dump_stack(); |
134 | } | 134 | } |
135 | return err; | 135 | return err; |
136 | } | 136 | } |
137 | 137 | ||
138 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 138 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) |
139 | int dtype) | ||
140 | { | 139 | { |
141 | int err; | 140 | int err; |
142 | 141 | ||
@@ -144,14 +143,14 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | |||
144 | if (c->ro_error) | 143 | if (c->ro_error) |
145 | return -EROFS; | 144 | return -EROFS; |
146 | if (!dbg_is_tst_rcvry(c)) | 145 | if (!dbg_is_tst_rcvry(c)) |
147 | err = ubi_leb_change(c->ubi, lnum, buf, len, dtype); | 146 | err = ubi_leb_change(c->ubi, lnum, buf, len); |
148 | else | 147 | else |
149 | err = dbg_leb_change(c, lnum, buf, len, dtype); | 148 | err = dbg_leb_change(c, lnum, buf, len); |
150 | if (err) { | 149 | if (err) { |
151 | ubifs_err("changing %d bytes in LEB %d failed, error %d", | 150 | ubifs_err("changing %d bytes in LEB %d failed, error %d", |
152 | len, lnum, err); | 151 | len, lnum, err); |
153 | ubifs_ro_mode(c, err); | 152 | ubifs_ro_mode(c, err); |
154 | dbg_dump_stack(); | 153 | dump_stack(); |
155 | } | 154 | } |
156 | return err; | 155 | return err; |
157 | } | 156 | } |
@@ -170,12 +169,12 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum) | |||
170 | if (err) { | 169 | if (err) { |
171 | ubifs_err("unmap LEB %d failed, error %d", lnum, err); | 170 | ubifs_err("unmap LEB %d failed, error %d", lnum, err); |
172 | ubifs_ro_mode(c, err); | 171 | ubifs_ro_mode(c, err); |
173 | dbg_dump_stack(); | 172 | dump_stack(); |
174 | } | 173 | } |
175 | return err; | 174 | return err; |
176 | } | 175 | } |
177 | 176 | ||
178 | int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype) | 177 | int ubifs_leb_map(struct ubifs_info *c, int lnum) |
179 | { | 178 | { |
180 | int err; | 179 | int err; |
181 | 180 | ||
@@ -183,13 +182,13 @@ int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype) | |||
183 | if (c->ro_error) | 182 | if (c->ro_error) |
184 | return -EROFS; | 183 | return -EROFS; |
185 | if (!dbg_is_tst_rcvry(c)) | 184 | if (!dbg_is_tst_rcvry(c)) |
186 | err = ubi_leb_map(c->ubi, lnum, dtype); | 185 | err = ubi_leb_map(c->ubi, lnum); |
187 | else | 186 | else |
188 | err = dbg_leb_map(c, lnum, dtype); | 187 | err = dbg_leb_map(c, lnum); |
189 | if (err) { | 188 | if (err) { |
190 | ubifs_err("mapping LEB %d failed, error %d", lnum, err); | 189 | ubifs_err("mapping LEB %d failed, error %d", lnum, err); |
191 | ubifs_ro_mode(c, err); | 190 | ubifs_ro_mode(c, err); |
192 | dbg_dump_stack(); | 191 | dump_stack(); |
193 | } | 192 | } |
194 | return err; | 193 | return err; |
195 | } | 194 | } |
@@ -202,7 +201,7 @@ int ubifs_is_mapped(const struct ubifs_info *c, int lnum) | |||
202 | if (err < 0) { | 201 | if (err < 0) { |
203 | ubifs_err("ubi_is_mapped failed for LEB %d, error %d", | 202 | ubifs_err("ubi_is_mapped failed for LEB %d, error %d", |
204 | lnum, err); | 203 | lnum, err); |
205 | dbg_dump_stack(); | 204 | dump_stack(); |
206 | } | 205 | } |
207 | return err; | 206 | return err; |
208 | } | 207 | } |
@@ -294,8 +293,8 @@ out_len: | |||
294 | out: | 293 | out: |
295 | if (!quiet) { | 294 | if (!quiet) { |
296 | ubifs_err("bad node at LEB %d:%d", lnum, offs); | 295 | ubifs_err("bad node at LEB %d:%d", lnum, offs); |
297 | dbg_dump_node(c, buf); | 296 | ubifs_dump_node(c, buf); |
298 | dbg_dump_stack(); | 297 | dump_stack(); |
299 | } | 298 | } |
300 | return err; | 299 | return err; |
301 | } | 300 | } |
@@ -523,8 +522,7 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
523 | dirt = sync_len - wbuf->used; | 522 | dirt = sync_len - wbuf->used; |
524 | if (dirt) | 523 | if (dirt) |
525 | ubifs_pad(c, wbuf->buf + wbuf->used, dirt); | 524 | ubifs_pad(c, wbuf->buf + wbuf->used, dirt); |
526 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len, | 525 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, sync_len); |
527 | wbuf->dtype); | ||
528 | if (err) | 526 | if (err) |
529 | return err; | 527 | return err; |
530 | 528 | ||
@@ -562,14 +560,12 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
562 | * @wbuf: write-buffer | 560 | * @wbuf: write-buffer |
563 | * @lnum: logical eraseblock number to seek to | 561 | * @lnum: logical eraseblock number to seek to |
564 | * @offs: logical eraseblock offset to seek to | 562 | * @offs: logical eraseblock offset to seek to |
565 | * @dtype: data type | ||
566 | * | 563 | * |
567 | * This function targets the write-buffer to logical eraseblock @lnum:@offs. | 564 | * This function targets the write-buffer to logical eraseblock @lnum:@offs. |
568 | * The write-buffer has to be empty. Returns zero in case of success and a | 565 | * The write-buffer has to be empty. Returns zero in case of success and a |
569 | * negative error code in case of failure. | 566 | * negative error code in case of failure. |
570 | */ | 567 | */ |
571 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | 568 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs) |
572 | int dtype) | ||
573 | { | 569 | { |
574 | const struct ubifs_info *c = wbuf->c; | 570 | const struct ubifs_info *c = wbuf->c; |
575 | 571 | ||
@@ -592,7 +588,6 @@ int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | |||
592 | wbuf->avail = wbuf->size; | 588 | wbuf->avail = wbuf->size; |
593 | wbuf->used = 0; | 589 | wbuf->used = 0; |
594 | spin_unlock(&wbuf->lock); | 590 | spin_unlock(&wbuf->lock); |
595 | wbuf->dtype = dtype; | ||
596 | 591 | ||
597 | return 0; | 592 | return 0; |
598 | } | 593 | } |
@@ -719,8 +714,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
719 | dbg_io("flush jhead %s wbuf to LEB %d:%d", | 714 | dbg_io("flush jhead %s wbuf to LEB %d:%d", |
720 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); | 715 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); |
721 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, | 716 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, |
722 | wbuf->offs, wbuf->size, | 717 | wbuf->offs, wbuf->size); |
723 | wbuf->dtype); | ||
724 | if (err) | 718 | if (err) |
725 | goto out; | 719 | goto out; |
726 | 720 | ||
@@ -756,7 +750,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
756 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); | 750 | dbg_jhead(wbuf->jhead), wbuf->lnum, wbuf->offs); |
757 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); | 751 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); |
758 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, | 752 | err = ubifs_leb_write(c, wbuf->lnum, wbuf->buf, wbuf->offs, |
759 | wbuf->size, wbuf->dtype); | 753 | wbuf->size); |
760 | if (err) | 754 | if (err) |
761 | goto out; | 755 | goto out; |
762 | 756 | ||
@@ -775,7 +769,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
775 | dbg_io("write %d bytes to LEB %d:%d", | 769 | dbg_io("write %d bytes to LEB %d:%d", |
776 | wbuf->size, wbuf->lnum, wbuf->offs); | 770 | wbuf->size, wbuf->lnum, wbuf->offs); |
777 | err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, | 771 | err = ubifs_leb_write(c, wbuf->lnum, buf, wbuf->offs, |
778 | wbuf->size, wbuf->dtype); | 772 | wbuf->size); |
779 | if (err) | 773 | if (err) |
780 | goto out; | 774 | goto out; |
781 | 775 | ||
@@ -797,7 +791,7 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
797 | dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, | 791 | dbg_io("write %d bytes to LEB %d:%d", n, wbuf->lnum, |
798 | wbuf->offs); | 792 | wbuf->offs); |
799 | err = ubifs_leb_write(c, wbuf->lnum, buf + written, | 793 | err = ubifs_leb_write(c, wbuf->lnum, buf + written, |
800 | wbuf->offs, n, wbuf->dtype); | 794 | wbuf->offs, n); |
801 | if (err) | 795 | if (err) |
802 | goto out; | 796 | goto out; |
803 | wbuf->offs += n; | 797 | wbuf->offs += n; |
@@ -841,9 +835,9 @@ exit: | |||
841 | out: | 835 | out: |
842 | ubifs_err("cannot write %d bytes to LEB %d:%d, error %d", | 836 | ubifs_err("cannot write %d bytes to LEB %d:%d, error %d", |
843 | len, wbuf->lnum, wbuf->offs, err); | 837 | len, wbuf->lnum, wbuf->offs, err); |
844 | dbg_dump_node(c, buf); | 838 | ubifs_dump_node(c, buf); |
845 | dbg_dump_stack(); | 839 | dump_stack(); |
846 | dbg_dump_leb(c, wbuf->lnum); | 840 | ubifs_dump_leb(c, wbuf->lnum); |
847 | return err; | 841 | return err; |
848 | } | 842 | } |
849 | 843 | ||
@@ -854,7 +848,6 @@ out: | |||
854 | * @len: node length | 848 | * @len: node length |
855 | * @lnum: logical eraseblock number | 849 | * @lnum: logical eraseblock number |
856 | * @offs: offset within the logical eraseblock | 850 | * @offs: offset within the logical eraseblock |
857 | * @dtype: node life-time hint (%UBI_LONGTERM, %UBI_SHORTTERM, %UBI_UNKNOWN) | ||
858 | * | 851 | * |
859 | * This function automatically fills node magic number, assigns sequence | 852 | * This function automatically fills node magic number, assigns sequence |
860 | * number, and calculates node CRC checksum. The length of the @buf buffer has | 853 | * number, and calculates node CRC checksum. The length of the @buf buffer has |
@@ -863,7 +856,7 @@ out: | |||
863 | * success and a negative error code in case of failure. | 856 | * success and a negative error code in case of failure. |
864 | */ | 857 | */ |
865 | int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, | 858 | int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, |
866 | int offs, int dtype) | 859 | int offs) |
867 | { | 860 | { |
868 | int err, buf_len = ALIGN(len, c->min_io_size); | 861 | int err, buf_len = ALIGN(len, c->min_io_size); |
869 | 862 | ||
@@ -879,9 +872,9 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, | |||
879 | return -EROFS; | 872 | return -EROFS; |
880 | 873 | ||
881 | ubifs_prepare_node(c, buf, len, 1); | 874 | ubifs_prepare_node(c, buf, len, 1); |
882 | err = ubifs_leb_write(c, lnum, buf, offs, buf_len, dtype); | 875 | err = ubifs_leb_write(c, lnum, buf, offs, buf_len); |
883 | if (err) | 876 | if (err) |
884 | dbg_dump_node(c, buf); | 877 | ubifs_dump_node(c, buf); |
885 | 878 | ||
886 | return err; | 879 | return err; |
887 | } | 880 | } |
@@ -960,8 +953,8 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | |||
960 | 953 | ||
961 | out: | 954 | out: |
962 | ubifs_err("bad node at LEB %d:%d", lnum, offs); | 955 | ubifs_err("bad node at LEB %d:%d", lnum, offs); |
963 | dbg_dump_node(c, buf); | 956 | ubifs_dump_node(c, buf); |
964 | dbg_dump_stack(); | 957 | dump_stack(); |
965 | return -EINVAL; | 958 | return -EINVAL; |
966 | } | 959 | } |
967 | 960 | ||
@@ -1017,8 +1010,8 @@ int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, | |||
1017 | out: | 1010 | out: |
1018 | ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs, | 1011 | ubifs_err("bad node at LEB %d:%d, LEB mapping status %d", lnum, offs, |
1019 | ubi_is_mapped(c->ubi, lnum)); | 1012 | ubi_is_mapped(c->ubi, lnum)); |
1020 | dbg_dump_node(c, buf); | 1013 | ubifs_dump_node(c, buf); |
1021 | dbg_dump_stack(); | 1014 | dump_stack(); |
1022 | return -EINVAL; | 1015 | return -EINVAL; |
1023 | } | 1016 | } |
1024 | 1017 | ||
@@ -1056,7 +1049,6 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) | |||
1056 | */ | 1049 | */ |
1057 | size = c->max_write_size - (c->leb_start % c->max_write_size); | 1050 | size = c->max_write_size - (c->leb_start % c->max_write_size); |
1058 | wbuf->avail = wbuf->size = size; | 1051 | wbuf->avail = wbuf->size = size; |
1059 | wbuf->dtype = UBI_UNKNOWN; | ||
1060 | wbuf->sync_callback = NULL; | 1052 | wbuf->sync_callback = NULL; |
1061 | mutex_init(&wbuf->io_mutex); | 1053 | mutex_init(&wbuf->io_mutex); |
1062 | spin_lock_init(&wbuf->lock); | 1054 | spin_lock_init(&wbuf->lock); |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index 2f438ab2e7a2..12c0f154ca83 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -214,7 +214,7 @@ out: | |||
214 | err = ubifs_add_bud_to_log(c, jhead, lnum, offs); | 214 | err = ubifs_add_bud_to_log(c, jhead, lnum, offs); |
215 | if (err) | 215 | if (err) |
216 | goto out_return; | 216 | goto out_return; |
217 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype); | 217 | err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs); |
218 | if (err) | 218 | if (err) |
219 | goto out_unlock; | 219 | goto out_unlock; |
220 | 220 | ||
@@ -385,9 +385,9 @@ out: | |||
385 | if (err == -ENOSPC) { | 385 | if (err == -ENOSPC) { |
386 | /* This are some budgeting problems, print useful information */ | 386 | /* This are some budgeting problems, print useful information */ |
387 | down_write(&c->commit_sem); | 387 | down_write(&c->commit_sem); |
388 | dbg_dump_stack(); | 388 | dump_stack(); |
389 | dbg_dump_budg(c, &c->bi); | 389 | ubifs_dump_budg(c, &c->bi); |
390 | dbg_dump_lprops(c); | 390 | ubifs_dump_lprops(c); |
391 | cmt_retries = dbg_check_lprops(c); | 391 | cmt_retries = dbg_check_lprops(c); |
392 | up_write(&c->commit_sem); | 392 | up_write(&c->commit_sem); |
393 | } | 393 | } |
@@ -1267,7 +1267,6 @@ out_free: | |||
1267 | return err; | 1267 | return err; |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | #ifdef CONFIG_UBIFS_FS_XATTR | ||
1271 | 1270 | ||
1272 | /** | 1271 | /** |
1273 | * ubifs_jnl_delete_xattr - delete an extended attribute. | 1272 | * ubifs_jnl_delete_xattr - delete an extended attribute. |
@@ -1462,4 +1461,3 @@ out_free: | |||
1462 | return err; | 1461 | return err; |
1463 | } | 1462 | } |
1464 | 1463 | ||
1465 | #endif /* CONFIG_UBIFS_FS_XATTR */ | ||
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index f9fd068d1ae0..c80b15d6c8de 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -29,11 +29,7 @@ | |||
29 | 29 | ||
30 | #include "ubifs.h" | 30 | #include "ubifs.h" |
31 | 31 | ||
32 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
33 | static int dbg_check_bud_bytes(struct ubifs_info *c); | 32 | static int dbg_check_bud_bytes(struct ubifs_info *c); |
34 | #else | ||
35 | #define dbg_check_bud_bytes(c) 0 | ||
36 | #endif | ||
37 | 33 | ||
38 | /** | 34 | /** |
39 | * ubifs_search_bud - search bud LEB. | 35 | * ubifs_search_bud - search bud LEB. |
@@ -262,7 +258,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) | |||
262 | * an unclean reboot, because the target LEB might have been | 258 | * an unclean reboot, because the target LEB might have been |
263 | * unmapped, but not yet physically erased. | 259 | * unmapped, but not yet physically erased. |
264 | */ | 260 | */ |
265 | err = ubifs_leb_map(c, bud->lnum, UBI_SHORTTERM); | 261 | err = ubifs_leb_map(c, bud->lnum); |
266 | if (err) | 262 | if (err) |
267 | goto out_unlock; | 263 | goto out_unlock; |
268 | } | 264 | } |
@@ -270,7 +266,7 @@ int ubifs_add_bud_to_log(struct ubifs_info *c, int jhead, int lnum, int offs) | |||
270 | dbg_log("write ref LEB %d:%d", | 266 | dbg_log("write ref LEB %d:%d", |
271 | c->lhead_lnum, c->lhead_offs); | 267 | c->lhead_lnum, c->lhead_offs); |
272 | err = ubifs_write_node(c, ref, UBIFS_REF_NODE_SZ, c->lhead_lnum, | 268 | err = ubifs_write_node(c, ref, UBIFS_REF_NODE_SZ, c->lhead_lnum, |
273 | c->lhead_offs, UBI_SHORTTERM); | 269 | c->lhead_offs); |
274 | if (err) | 270 | if (err) |
275 | goto out_unlock; | 271 | goto out_unlock; |
276 | 272 | ||
@@ -422,7 +418,7 @@ int ubifs_log_start_commit(struct ubifs_info *c, int *ltail_lnum) | |||
422 | 418 | ||
423 | len = ALIGN(len, c->min_io_size); | 419 | len = ALIGN(len, c->min_io_size); |
424 | dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len); | 420 | dbg_log("writing commit start at LEB %d:0, len %d", c->lhead_lnum, len); |
425 | err = ubifs_leb_write(c, c->lhead_lnum, cs, 0, len, UBI_SHORTTERM); | 421 | err = ubifs_leb_write(c, c->lhead_lnum, cs, 0, len); |
426 | if (err) | 422 | if (err) |
427 | goto out; | 423 | goto out; |
428 | 424 | ||
@@ -623,7 +619,7 @@ static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, | |||
623 | int sz = ALIGN(*offs, c->min_io_size), err; | 619 | int sz = ALIGN(*offs, c->min_io_size), err; |
624 | 620 | ||
625 | ubifs_pad(c, buf + *offs, sz - *offs); | 621 | ubifs_pad(c, buf + *offs, sz - *offs); |
626 | err = ubifs_leb_change(c, *lnum, buf, sz, UBI_SHORTTERM); | 622 | err = ubifs_leb_change(c, *lnum, buf, sz); |
627 | if (err) | 623 | if (err) |
628 | return err; | 624 | return err; |
629 | *lnum = ubifs_next_log_lnum(c, *lnum); | 625 | *lnum = ubifs_next_log_lnum(c, *lnum); |
@@ -702,7 +698,7 @@ int ubifs_consolidate_log(struct ubifs_info *c) | |||
702 | int sz = ALIGN(offs, c->min_io_size); | 698 | int sz = ALIGN(offs, c->min_io_size); |
703 | 699 | ||
704 | ubifs_pad(c, buf + offs, sz - offs); | 700 | ubifs_pad(c, buf + offs, sz - offs); |
705 | err = ubifs_leb_change(c, write_lnum, buf, sz, UBI_SHORTTERM); | 701 | err = ubifs_leb_change(c, write_lnum, buf, sz); |
706 | if (err) | 702 | if (err) |
707 | goto out_free; | 703 | goto out_free; |
708 | offs = ALIGN(offs, c->min_io_size); | 704 | offs = ALIGN(offs, c->min_io_size); |
@@ -734,8 +730,6 @@ out_free: | |||
734 | return err; | 730 | return err; |
735 | } | 731 | } |
736 | 732 | ||
737 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
738 | |||
739 | /** | 733 | /** |
740 | * dbg_check_bud_bytes - make sure bud bytes calculation are all right. | 734 | * dbg_check_bud_bytes - make sure bud bytes calculation are all right. |
741 | * @c: UBIFS file-system description object | 735 | * @c: UBIFS file-system description object |
@@ -767,5 +761,3 @@ static int dbg_check_bud_bytes(struct ubifs_info *c) | |||
767 | 761 | ||
768 | return err; | 762 | return err; |
769 | } | 763 | } |
770 | |||
771 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index f8a181e647cc..86eb8e533249 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -447,7 +447,7 @@ static void change_category(struct ubifs_info *c, struct ubifs_lprops *lprops) | |||
447 | int new_cat = ubifs_categorize_lprops(c, lprops); | 447 | int new_cat = ubifs_categorize_lprops(c, lprops); |
448 | 448 | ||
449 | if (old_cat == new_cat) { | 449 | if (old_cat == new_cat) { |
450 | struct ubifs_lpt_heap *heap = &c->lpt_heap[new_cat - 1]; | 450 | struct ubifs_lpt_heap *heap; |
451 | 451 | ||
452 | /* lprops on a heap now must be moved up or down */ | 452 | /* lprops on a heap now must be moved up or down */ |
453 | if (new_cat < 1 || new_cat > LPROPS_HEAP_CNT) | 453 | if (new_cat < 1 || new_cat > LPROPS_HEAP_CNT) |
@@ -846,7 +846,9 @@ const struct ubifs_lprops *ubifs_fast_find_frdi_idx(struct ubifs_info *c) | |||
846 | return lprops; | 846 | return lprops; |
847 | } | 847 | } |
848 | 848 | ||
849 | #ifdef CONFIG_UBIFS_FS_DEBUG | 849 | /* |
850 | * Everything below is related to debugging. | ||
851 | */ | ||
850 | 852 | ||
851 | /** | 853 | /** |
852 | * dbg_check_cats - check category heaps and lists. | 854 | * dbg_check_cats - check category heaps and lists. |
@@ -1001,8 +1003,8 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
1001 | out: | 1003 | out: |
1002 | if (err) { | 1004 | if (err) { |
1003 | dbg_msg("failed cat %d hpos %d err %d", cat, i, err); | 1005 | dbg_msg("failed cat %d hpos %d err %d", cat, i, err); |
1004 | dbg_dump_stack(); | 1006 | dump_stack(); |
1005 | dbg_dump_heap(c, heap, cat); | 1007 | ubifs_dump_heap(c, heap, cat); |
1006 | } | 1008 | } |
1007 | } | 1009 | } |
1008 | 1010 | ||
@@ -1109,8 +1111,8 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1109 | if (IS_ERR(sleb)) { | 1111 | if (IS_ERR(sleb)) { |
1110 | ret = PTR_ERR(sleb); | 1112 | ret = PTR_ERR(sleb); |
1111 | if (ret == -EUCLEAN) { | 1113 | if (ret == -EUCLEAN) { |
1112 | dbg_dump_lprops(c); | 1114 | ubifs_dump_lprops(c); |
1113 | dbg_dump_budg(c, &c->bi); | 1115 | ubifs_dump_budg(c, &c->bi); |
1114 | } | 1116 | } |
1115 | goto out; | 1117 | goto out; |
1116 | } | 1118 | } |
@@ -1237,7 +1239,7 @@ out_print: | |||
1237 | ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, " | 1239 | ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, " |
1238 | "should be free %d, dirty %d", | 1240 | "should be free %d, dirty %d", |
1239 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); | 1241 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); |
1240 | dbg_dump_leb(c, lnum); | 1242 | ubifs_dump_leb(c, lnum); |
1241 | out_destroy: | 1243 | out_destroy: |
1242 | ubifs_scan_destroy(sleb); | 1244 | ubifs_scan_destroy(sleb); |
1243 | ret = -EINVAL; | 1245 | ret = -EINVAL; |
@@ -1315,5 +1317,3 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1315 | out: | 1317 | out: |
1316 | return err; | 1318 | return err; |
1317 | } | 1319 | } |
1318 | |||
1319 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 66d59d0a1402..ce33b2beb151 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -701,8 +701,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
701 | alen = ALIGN(len, c->min_io_size); | 701 | alen = ALIGN(len, c->min_io_size); |
702 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 702 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
703 | memset(p, 0xff, alen - len); | 703 | memset(p, 0xff, alen - len); |
704 | err = ubifs_leb_change(c, lnum++, buf, alen, | 704 | err = ubifs_leb_change(c, lnum++, buf, alen); |
705 | UBI_SHORTTERM); | ||
706 | if (err) | 705 | if (err) |
707 | goto out; | 706 | goto out; |
708 | p = buf; | 707 | p = buf; |
@@ -732,8 +731,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
732 | set_ltab(c, lnum, c->leb_size - alen, | 731 | set_ltab(c, lnum, c->leb_size - alen, |
733 | alen - len); | 732 | alen - len); |
734 | memset(p, 0xff, alen - len); | 733 | memset(p, 0xff, alen - len); |
735 | err = ubifs_leb_change(c, lnum++, buf, alen, | 734 | err = ubifs_leb_change(c, lnum++, buf, alen); |
736 | UBI_SHORTTERM); | ||
737 | if (err) | 735 | if (err) |
738 | goto out; | 736 | goto out; |
739 | p = buf; | 737 | p = buf; |
@@ -780,8 +778,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
780 | alen = ALIGN(len, c->min_io_size); | 778 | alen = ALIGN(len, c->min_io_size); |
781 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 779 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
782 | memset(p, 0xff, alen - len); | 780 | memset(p, 0xff, alen - len); |
783 | err = ubifs_leb_change(c, lnum++, buf, alen, | 781 | err = ubifs_leb_change(c, lnum++, buf, alen); |
784 | UBI_SHORTTERM); | ||
785 | if (err) | 782 | if (err) |
786 | goto out; | 783 | goto out; |
787 | p = buf; | 784 | p = buf; |
@@ -806,7 +803,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
806 | alen = ALIGN(len, c->min_io_size); | 803 | alen = ALIGN(len, c->min_io_size); |
807 | set_ltab(c, lnum, c->leb_size - alen, alen - len); | 804 | set_ltab(c, lnum, c->leb_size - alen, alen - len); |
808 | memset(p, 0xff, alen - len); | 805 | memset(p, 0xff, alen - len); |
809 | err = ubifs_leb_change(c, lnum++, buf, alen, UBI_SHORTTERM); | 806 | err = ubifs_leb_change(c, lnum++, buf, alen); |
810 | if (err) | 807 | if (err) |
811 | goto out; | 808 | goto out; |
812 | p = buf; | 809 | p = buf; |
@@ -826,7 +823,7 @@ int ubifs_create_dflt_lpt(struct ubifs_info *c, int *main_lebs, int lpt_first, | |||
826 | 823 | ||
827 | /* Write remaining buffer */ | 824 | /* Write remaining buffer */ |
828 | memset(p, 0xff, alen - len); | 825 | memset(p, 0xff, alen - len); |
829 | err = ubifs_leb_change(c, lnum, buf, alen, UBI_SHORTTERM); | 826 | err = ubifs_leb_change(c, lnum, buf, alen); |
830 | if (err) | 827 | if (err) |
831 | goto out; | 828 | goto out; |
832 | 829 | ||
@@ -926,7 +923,7 @@ static int check_lpt_crc(void *buf, int len) | |||
926 | if (crc != calc_crc) { | 923 | if (crc != calc_crc) { |
927 | ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc, | 924 | ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc, |
928 | calc_crc); | 925 | calc_crc); |
929 | dbg_dump_stack(); | 926 | dump_stack(); |
930 | return -EINVAL; | 927 | return -EINVAL; |
931 | } | 928 | } |
932 | return 0; | 929 | return 0; |
@@ -949,7 +946,7 @@ static int check_lpt_type(uint8_t **addr, int *pos, int type) | |||
949 | if (node_type != type) { | 946 | if (node_type != type) { |
950 | ubifs_err("invalid type (%d) in LPT node type %d", node_type, | 947 | ubifs_err("invalid type (%d) in LPT node type %d", node_type, |
951 | type); | 948 | type); |
952 | dbg_dump_stack(); | 949 | dump_stack(); |
953 | return -EINVAL; | 950 | return -EINVAL; |
954 | } | 951 | } |
955 | return 0; | 952 | return 0; |
@@ -1247,7 +1244,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1247 | 1244 | ||
1248 | out: | 1245 | out: |
1249 | ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs); | 1246 | ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs); |
1250 | dbg_dump_stack(); | 1247 | dump_stack(); |
1251 | kfree(nnode); | 1248 | kfree(nnode); |
1252 | return err; | 1249 | return err; |
1253 | } | 1250 | } |
@@ -1312,8 +1309,8 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1312 | 1309 | ||
1313 | out: | 1310 | out: |
1314 | ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); | 1311 | ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); |
1315 | dbg_dump_pnode(c, pnode, parent, iip); | 1312 | ubifs_dump_pnode(c, pnode, parent, iip); |
1316 | dbg_dump_stack(); | 1313 | dump_stack(); |
1317 | dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); | 1314 | dbg_msg("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); |
1318 | kfree(pnode); | 1315 | kfree(pnode); |
1319 | return err; | 1316 | return err; |
@@ -1740,16 +1737,20 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr) | |||
1740 | if (rd) { | 1737 | if (rd) { |
1741 | err = lpt_init_rd(c); | 1738 | err = lpt_init_rd(c); |
1742 | if (err) | 1739 | if (err) |
1743 | return err; | 1740 | goto out_err; |
1744 | } | 1741 | } |
1745 | 1742 | ||
1746 | if (wr) { | 1743 | if (wr) { |
1747 | err = lpt_init_wr(c); | 1744 | err = lpt_init_wr(c); |
1748 | if (err) | 1745 | if (err) |
1749 | return err; | 1746 | goto out_err; |
1750 | } | 1747 | } |
1751 | 1748 | ||
1752 | return 0; | 1749 | return 0; |
1750 | |||
1751 | out_err: | ||
1752 | ubifs_lpt_free(c, 0); | ||
1753 | return err; | ||
1753 | } | 1754 | } |
1754 | 1755 | ||
1755 | /** | 1756 | /** |
@@ -2080,8 +2081,6 @@ out: | |||
2080 | return err; | 2081 | return err; |
2081 | } | 2082 | } |
2082 | 2083 | ||
2083 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
2084 | |||
2085 | /** | 2084 | /** |
2086 | * dbg_chk_pnode - check a pnode. | 2085 | * dbg_chk_pnode - check a pnode. |
2087 | * @c: the UBIFS file-system description object | 2086 | * @c: the UBIFS file-system description object |
@@ -2096,8 +2095,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2096 | int i; | 2095 | int i; |
2097 | 2096 | ||
2098 | if (pnode->num != col) { | 2097 | if (pnode->num != col) { |
2099 | dbg_err("pnode num %d expected %d parent num %d iip %d", | 2098 | ubifs_err("pnode num %d expected %d parent num %d iip %d", |
2100 | pnode->num, col, pnode->parent->num, pnode->iip); | 2099 | pnode->num, col, pnode->parent->num, pnode->iip); |
2101 | return -EINVAL; | 2100 | return -EINVAL; |
2102 | } | 2101 | } |
2103 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { | 2102 | for (i = 0; i < UBIFS_LPT_FANOUT; i++) { |
@@ -2111,14 +2110,14 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2111 | if (lnum >= c->leb_cnt) | 2110 | if (lnum >= c->leb_cnt) |
2112 | continue; | 2111 | continue; |
2113 | if (lprops->lnum != lnum) { | 2112 | if (lprops->lnum != lnum) { |
2114 | dbg_err("bad LEB number %d expected %d", | 2113 | ubifs_err("bad LEB number %d expected %d", |
2115 | lprops->lnum, lnum); | 2114 | lprops->lnum, lnum); |
2116 | return -EINVAL; | 2115 | return -EINVAL; |
2117 | } | 2116 | } |
2118 | if (lprops->flags & LPROPS_TAKEN) { | 2117 | if (lprops->flags & LPROPS_TAKEN) { |
2119 | if (cat != LPROPS_UNCAT) { | 2118 | if (cat != LPROPS_UNCAT) { |
2120 | dbg_err("LEB %d taken but not uncat %d", | 2119 | ubifs_err("LEB %d taken but not uncat %d", |
2121 | lprops->lnum, cat); | 2120 | lprops->lnum, cat); |
2122 | return -EINVAL; | 2121 | return -EINVAL; |
2123 | } | 2122 | } |
2124 | continue; | 2123 | continue; |
@@ -2130,8 +2129,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2130 | case LPROPS_FRDI_IDX: | 2129 | case LPROPS_FRDI_IDX: |
2131 | break; | 2130 | break; |
2132 | default: | 2131 | default: |
2133 | dbg_err("LEB %d index but cat %d", | 2132 | ubifs_err("LEB %d index but cat %d", |
2134 | lprops->lnum, cat); | 2133 | lprops->lnum, cat); |
2135 | return -EINVAL; | 2134 | return -EINVAL; |
2136 | } | 2135 | } |
2137 | } else { | 2136 | } else { |
@@ -2143,8 +2142,8 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2143 | case LPROPS_FREEABLE: | 2142 | case LPROPS_FREEABLE: |
2144 | break; | 2143 | break; |
2145 | default: | 2144 | default: |
2146 | dbg_err("LEB %d not index but cat %d", | 2145 | ubifs_err("LEB %d not index but cat %d", |
2147 | lprops->lnum, cat); | 2146 | lprops->lnum, cat); |
2148 | return -EINVAL; | 2147 | return -EINVAL; |
2149 | } | 2148 | } |
2150 | } | 2149 | } |
@@ -2184,24 +2183,24 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2184 | break; | 2183 | break; |
2185 | } | 2184 | } |
2186 | if (!found) { | 2185 | if (!found) { |
2187 | dbg_err("LEB %d cat %d not found in cat heap/list", | 2186 | ubifs_err("LEB %d cat %d not found in cat heap/list", |
2188 | lprops->lnum, cat); | 2187 | lprops->lnum, cat); |
2189 | return -EINVAL; | 2188 | return -EINVAL; |
2190 | } | 2189 | } |
2191 | switch (cat) { | 2190 | switch (cat) { |
2192 | case LPROPS_EMPTY: | 2191 | case LPROPS_EMPTY: |
2193 | if (lprops->free != c->leb_size) { | 2192 | if (lprops->free != c->leb_size) { |
2194 | dbg_err("LEB %d cat %d free %d dirty %d", | 2193 | ubifs_err("LEB %d cat %d free %d dirty %d", |
2195 | lprops->lnum, cat, lprops->free, | 2194 | lprops->lnum, cat, lprops->free, |
2196 | lprops->dirty); | 2195 | lprops->dirty); |
2197 | return -EINVAL; | 2196 | return -EINVAL; |
2198 | } | 2197 | } |
2199 | case LPROPS_FREEABLE: | 2198 | case LPROPS_FREEABLE: |
2200 | case LPROPS_FRDI_IDX: | 2199 | case LPROPS_FRDI_IDX: |
2201 | if (lprops->free + lprops->dirty != c->leb_size) { | 2200 | if (lprops->free + lprops->dirty != c->leb_size) { |
2202 | dbg_err("LEB %d cat %d free %d dirty %d", | 2201 | ubifs_err("LEB %d cat %d free %d dirty %d", |
2203 | lprops->lnum, cat, lprops->free, | 2202 | lprops->lnum, cat, lprops->free, |
2204 | lprops->dirty); | 2203 | lprops->dirty); |
2205 | return -EINVAL; | 2204 | return -EINVAL; |
2206 | } | 2205 | } |
2207 | } | 2206 | } |
@@ -2235,9 +2234,10 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2235 | /* cnode is a nnode */ | 2234 | /* cnode is a nnode */ |
2236 | num = calc_nnode_num(row, col); | 2235 | num = calc_nnode_num(row, col); |
2237 | if (cnode->num != num) { | 2236 | if (cnode->num != num) { |
2238 | dbg_err("nnode num %d expected %d " | 2237 | ubifs_err("nnode num %d expected %d " |
2239 | "parent num %d iip %d", cnode->num, num, | 2238 | "parent num %d iip %d", |
2240 | (nnode ? nnode->num : 0), cnode->iip); | 2239 | cnode->num, num, |
2240 | (nnode ? nnode->num : 0), cnode->iip); | ||
2241 | return -EINVAL; | 2241 | return -EINVAL; |
2242 | } | 2242 | } |
2243 | nn = (struct ubifs_nnode *)cnode; | 2243 | nn = (struct ubifs_nnode *)cnode; |
@@ -2274,5 +2274,3 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2274 | } | 2274 | } |
2275 | return 0; | 2275 | return 0; |
2276 | } | 2276 | } |
2277 | |||
2278 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index cddd6bd214f4..4fa70734e6e7 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -30,11 +30,7 @@ | |||
30 | #include <linux/random.h> | 30 | #include <linux/random.h> |
31 | #include "ubifs.h" | 31 | #include "ubifs.h" |
32 | 32 | ||
33 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
34 | static int dbg_populate_lsave(struct ubifs_info *c); | 33 | static int dbg_populate_lsave(struct ubifs_info *c); |
35 | #else | ||
36 | #define dbg_populate_lsave(c) 0 | ||
37 | #endif | ||
38 | 34 | ||
39 | /** | 35 | /** |
40 | * first_dirty_cnode - find first dirty cnode. | 36 | * first_dirty_cnode - find first dirty cnode. |
@@ -324,11 +320,10 @@ static int layout_cnodes(struct ubifs_info *c) | |||
324 | return 0; | 320 | return 0; |
325 | 321 | ||
326 | no_space: | 322 | no_space: |
327 | ubifs_err("LPT out of space"); | 323 | ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, " |
328 | dbg_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, " | 324 | "done_lsave %d", lnum, offs, len, done_ltab, done_lsave); |
329 | "done_lsave %d", lnum, offs, len, done_ltab, done_lsave); | 325 | ubifs_dump_lpt_info(c); |
330 | dbg_dump_lpt_info(c); | 326 | ubifs_dump_lpt_lebs(c); |
331 | dbg_dump_lpt_lebs(c); | ||
332 | dump_stack(); | 327 | dump_stack(); |
333 | return err; | 328 | return err; |
334 | } | 329 | } |
@@ -421,7 +416,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
421 | alen = ALIGN(wlen, c->min_io_size); | 416 | alen = ALIGN(wlen, c->min_io_size); |
422 | memset(buf + offs, 0xff, alen - wlen); | 417 | memset(buf + offs, 0xff, alen - wlen); |
423 | err = ubifs_leb_write(c, lnum, buf + from, from, | 418 | err = ubifs_leb_write(c, lnum, buf + from, from, |
424 | alen, UBI_SHORTTERM); | 419 | alen); |
425 | if (err) | 420 | if (err) |
426 | return err; | 421 | return err; |
427 | } | 422 | } |
@@ -479,8 +474,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
479 | wlen = offs - from; | 474 | wlen = offs - from; |
480 | alen = ALIGN(wlen, c->min_io_size); | 475 | alen = ALIGN(wlen, c->min_io_size); |
481 | memset(buf + offs, 0xff, alen - wlen); | 476 | memset(buf + offs, 0xff, alen - wlen); |
482 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, | 477 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
483 | UBI_SHORTTERM); | ||
484 | if (err) | 478 | if (err) |
485 | return err; | 479 | return err; |
486 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); | 480 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); |
@@ -506,8 +500,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
506 | wlen = offs - from; | 500 | wlen = offs - from; |
507 | alen = ALIGN(wlen, c->min_io_size); | 501 | alen = ALIGN(wlen, c->min_io_size); |
508 | memset(buf + offs, 0xff, alen - wlen); | 502 | memset(buf + offs, 0xff, alen - wlen); |
509 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, | 503 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
510 | UBI_SHORTTERM); | ||
511 | if (err) | 504 | if (err) |
512 | return err; | 505 | return err; |
513 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); | 506 | dbg_chk_lpt_sz(c, 2, c->leb_size - offs); |
@@ -531,7 +524,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
531 | wlen = offs - from; | 524 | wlen = offs - from; |
532 | alen = ALIGN(wlen, c->min_io_size); | 525 | alen = ALIGN(wlen, c->min_io_size); |
533 | memset(buf + offs, 0xff, alen - wlen); | 526 | memset(buf + offs, 0xff, alen - wlen); |
534 | err = ubifs_leb_write(c, lnum, buf + from, from, alen, UBI_SHORTTERM); | 527 | err = ubifs_leb_write(c, lnum, buf + from, from, alen); |
535 | if (err) | 528 | if (err) |
536 | return err; | 529 | return err; |
537 | 530 | ||
@@ -552,11 +545,10 @@ static int write_cnodes(struct ubifs_info *c) | |||
552 | return 0; | 545 | return 0; |
553 | 546 | ||
554 | no_space: | 547 | no_space: |
555 | ubifs_err("LPT out of space mismatch"); | 548 | ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab " |
556 | dbg_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab " | 549 | "%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave); |
557 | "%d, done_lsave %d", lnum, offs, len, done_ltab, done_lsave); | 550 | ubifs_dump_lpt_info(c); |
558 | dbg_dump_lpt_info(c); | 551 | ubifs_dump_lpt_lebs(c); |
559 | dbg_dump_lpt_lebs(c); | ||
560 | dump_stack(); | 552 | dump_stack(); |
561 | return err; | 553 | return err; |
562 | } | 554 | } |
@@ -1497,7 +1489,9 @@ void ubifs_lpt_free(struct ubifs_info *c, int wr_only) | |||
1497 | kfree(c->lpt_nod_buf); | 1489 | kfree(c->lpt_nod_buf); |
1498 | } | 1490 | } |
1499 | 1491 | ||
1500 | #ifdef CONFIG_UBIFS_FS_DEBUG | 1492 | /* |
1493 | * Everything below is related to debugging. | ||
1494 | */ | ||
1501 | 1495 | ||
1502 | /** | 1496 | /** |
1503 | * dbg_is_all_ff - determine if a buffer contains only 0xFF bytes. | 1497 | * dbg_is_all_ff - determine if a buffer contains only 0xFF bytes. |
@@ -1735,7 +1729,7 @@ int dbg_check_ltab(struct ubifs_info *c) | |||
1735 | for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { | 1729 | for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { |
1736 | err = dbg_check_ltab_lnum(c, lnum); | 1730 | err = dbg_check_ltab_lnum(c, lnum); |
1737 | if (err) { | 1731 | if (err) { |
1738 | dbg_err("failed at LEB %d", lnum); | 1732 | ubifs_err("failed at LEB %d", lnum); |
1739 | return err; | 1733 | return err; |
1740 | } | 1734 | } |
1741 | } | 1735 | } |
@@ -1767,10 +1761,10 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c) | |||
1767 | free += c->leb_size; | 1761 | free += c->leb_size; |
1768 | } | 1762 | } |
1769 | if (free < c->lpt_sz) { | 1763 | if (free < c->lpt_sz) { |
1770 | dbg_err("LPT space error: free %lld lpt_sz %lld", | 1764 | ubifs_err("LPT space error: free %lld lpt_sz %lld", |
1771 | free, c->lpt_sz); | 1765 | free, c->lpt_sz); |
1772 | dbg_dump_lpt_info(c); | 1766 | ubifs_dump_lpt_info(c); |
1773 | dbg_dump_lpt_lebs(c); | 1767 | ubifs_dump_lpt_lebs(c); |
1774 | dump_stack(); | 1768 | dump_stack(); |
1775 | return -EINVAL; | 1769 | return -EINVAL; |
1776 | } | 1770 | } |
@@ -1807,13 +1801,13 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1807 | d->chk_lpt_lebs = 0; | 1801 | d->chk_lpt_lebs = 0; |
1808 | d->chk_lpt_wastage = 0; | 1802 | d->chk_lpt_wastage = 0; |
1809 | if (c->dirty_pn_cnt > c->pnode_cnt) { | 1803 | if (c->dirty_pn_cnt > c->pnode_cnt) { |
1810 | dbg_err("dirty pnodes %d exceed max %d", | 1804 | ubifs_err("dirty pnodes %d exceed max %d", |
1811 | c->dirty_pn_cnt, c->pnode_cnt); | 1805 | c->dirty_pn_cnt, c->pnode_cnt); |
1812 | err = -EINVAL; | 1806 | err = -EINVAL; |
1813 | } | 1807 | } |
1814 | if (c->dirty_nn_cnt > c->nnode_cnt) { | 1808 | if (c->dirty_nn_cnt > c->nnode_cnt) { |
1815 | dbg_err("dirty nnodes %d exceed max %d", | 1809 | ubifs_err("dirty nnodes %d exceed max %d", |
1816 | c->dirty_nn_cnt, c->nnode_cnt); | 1810 | c->dirty_nn_cnt, c->nnode_cnt); |
1817 | err = -EINVAL; | 1811 | err = -EINVAL; |
1818 | } | 1812 | } |
1819 | return err; | 1813 | return err; |
@@ -1830,23 +1824,23 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1830 | chk_lpt_sz *= d->chk_lpt_lebs; | 1824 | chk_lpt_sz *= d->chk_lpt_lebs; |
1831 | chk_lpt_sz += len - c->nhead_offs; | 1825 | chk_lpt_sz += len - c->nhead_offs; |
1832 | if (d->chk_lpt_sz != chk_lpt_sz) { | 1826 | if (d->chk_lpt_sz != chk_lpt_sz) { |
1833 | dbg_err("LPT wrote %lld but space used was %lld", | 1827 | ubifs_err("LPT wrote %lld but space used was %lld", |
1834 | d->chk_lpt_sz, chk_lpt_sz); | 1828 | d->chk_lpt_sz, chk_lpt_sz); |
1835 | err = -EINVAL; | 1829 | err = -EINVAL; |
1836 | } | 1830 | } |
1837 | if (d->chk_lpt_sz > c->lpt_sz) { | 1831 | if (d->chk_lpt_sz > c->lpt_sz) { |
1838 | dbg_err("LPT wrote %lld but lpt_sz is %lld", | 1832 | ubifs_err("LPT wrote %lld but lpt_sz is %lld", |
1839 | d->chk_lpt_sz, c->lpt_sz); | 1833 | d->chk_lpt_sz, c->lpt_sz); |
1840 | err = -EINVAL; | 1834 | err = -EINVAL; |
1841 | } | 1835 | } |
1842 | if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) { | 1836 | if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) { |
1843 | dbg_err("LPT layout size %lld but wrote %lld", | 1837 | ubifs_err("LPT layout size %lld but wrote %lld", |
1844 | d->chk_lpt_sz, d->chk_lpt_sz2); | 1838 | d->chk_lpt_sz, d->chk_lpt_sz2); |
1845 | err = -EINVAL; | 1839 | err = -EINVAL; |
1846 | } | 1840 | } |
1847 | if (d->chk_lpt_sz2 && d->new_nhead_offs != len) { | 1841 | if (d->chk_lpt_sz2 && d->new_nhead_offs != len) { |
1848 | dbg_err("LPT new nhead offs: expected %d was %d", | 1842 | ubifs_err("LPT new nhead offs: expected %d was %d", |
1849 | d->new_nhead_offs, len); | 1843 | d->new_nhead_offs, len); |
1850 | err = -EINVAL; | 1844 | err = -EINVAL; |
1851 | } | 1845 | } |
1852 | lpt_sz = (long long)c->pnode_cnt * c->pnode_sz; | 1846 | lpt_sz = (long long)c->pnode_cnt * c->pnode_sz; |
@@ -1855,13 +1849,13 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1855 | if (c->big_lpt) | 1849 | if (c->big_lpt) |
1856 | lpt_sz += c->lsave_sz; | 1850 | lpt_sz += c->lsave_sz; |
1857 | if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) { | 1851 | if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) { |
1858 | dbg_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld", | 1852 | ubifs_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld", |
1859 | d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz); | 1853 | d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz); |
1860 | err = -EINVAL; | 1854 | err = -EINVAL; |
1861 | } | 1855 | } |
1862 | if (err) { | 1856 | if (err) { |
1863 | dbg_dump_lpt_info(c); | 1857 | ubifs_dump_lpt_info(c); |
1864 | dbg_dump_lpt_lebs(c); | 1858 | ubifs_dump_lpt_lebs(c); |
1865 | dump_stack(); | 1859 | dump_stack(); |
1866 | } | 1860 | } |
1867 | d->chk_lpt_sz2 = d->chk_lpt_sz; | 1861 | d->chk_lpt_sz2 = d->chk_lpt_sz; |
@@ -1880,7 +1874,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1880 | } | 1874 | } |
1881 | 1875 | ||
1882 | /** | 1876 | /** |
1883 | * dbg_dump_lpt_leb - dump an LPT LEB. | 1877 | * ubifs_dump_lpt_leb - dump an LPT LEB. |
1884 | * @c: UBIFS file-system description object | 1878 | * @c: UBIFS file-system description object |
1885 | * @lnum: LEB number to dump | 1879 | * @lnum: LEB number to dump |
1886 | * | 1880 | * |
@@ -1986,13 +1980,13 @@ out: | |||
1986 | } | 1980 | } |
1987 | 1981 | ||
1988 | /** | 1982 | /** |
1989 | * dbg_dump_lpt_lebs - dump LPT lebs. | 1983 | * ubifs_dump_lpt_lebs - dump LPT lebs. |
1990 | * @c: UBIFS file-system description object | 1984 | * @c: UBIFS file-system description object |
1991 | * | 1985 | * |
1992 | * This function dumps all LPT LEBs. The caller has to make sure the LPT is | 1986 | * This function dumps all LPT LEBs. The caller has to make sure the LPT is |
1993 | * locked. | 1987 | * locked. |
1994 | */ | 1988 | */ |
1995 | void dbg_dump_lpt_lebs(const struct ubifs_info *c) | 1989 | void ubifs_dump_lpt_lebs(const struct ubifs_info *c) |
1996 | { | 1990 | { |
1997 | int i; | 1991 | int i; |
1998 | 1992 | ||
@@ -2046,5 +2040,3 @@ static int dbg_populate_lsave(struct ubifs_info *c) | |||
2046 | 2040 | ||
2047 | return 1; | 2041 | return 1; |
2048 | } | 2042 | } |
2049 | |||
2050 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 278c2382e8c2..ab83ace9910a 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c | |||
@@ -241,7 +241,7 @@ static int validate_master(const struct ubifs_info *c) | |||
241 | 241 | ||
242 | out: | 242 | out: |
243 | ubifs_err("bad master node at offset %d error %d", c->mst_offs, err); | 243 | ubifs_err("bad master node at offset %d error %d", c->mst_offs, err); |
244 | dbg_dump_node(c, c->mst_node); | 244 | ubifs_dump_node(c, c->mst_node); |
245 | return -EINVAL; | 245 | return -EINVAL; |
246 | } | 246 | } |
247 | 247 | ||
@@ -317,7 +317,7 @@ int ubifs_read_master(struct ubifs_info *c) | |||
317 | if (c->leb_cnt < old_leb_cnt || | 317 | if (c->leb_cnt < old_leb_cnt || |
318 | c->leb_cnt < UBIFS_MIN_LEB_CNT) { | 318 | c->leb_cnt < UBIFS_MIN_LEB_CNT) { |
319 | ubifs_err("bad leb_cnt on master node"); | 319 | ubifs_err("bad leb_cnt on master node"); |
320 | dbg_dump_node(c, c->mst_node); | 320 | ubifs_dump_node(c, c->mst_node); |
321 | return -EINVAL; | 321 | return -EINVAL; |
322 | } | 322 | } |
323 | 323 | ||
@@ -379,7 +379,7 @@ int ubifs_write_master(struct ubifs_info *c) | |||
379 | c->mst_offs = offs; | 379 | c->mst_offs = offs; |
380 | c->mst_node->highest_inum = cpu_to_le64(c->highest_inum); | 380 | c->mst_node->highest_inum = cpu_to_le64(c->highest_inum); |
381 | 381 | ||
382 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs, UBI_SHORTTERM); | 382 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs); |
383 | if (err) | 383 | if (err) |
384 | return err; | 384 | return err; |
385 | 385 | ||
@@ -390,7 +390,7 @@ int ubifs_write_master(struct ubifs_info *c) | |||
390 | if (err) | 390 | if (err) |
391 | return err; | 391 | return err; |
392 | } | 392 | } |
393 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs, UBI_SHORTTERM); | 393 | err = ubifs_write_node(c, c->mst_node, len, lnum, offs); |
394 | 394 | ||
395 | return err; | 395 | return err; |
396 | } | 396 | } |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index c542c73cfa3c..b02734db187c 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -52,11 +52,7 @@ | |||
52 | * than the maximum number of orphans allowed. | 52 | * than the maximum number of orphans allowed. |
53 | */ | 53 | */ |
54 | 54 | ||
55 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
56 | static int dbg_check_orphans(struct ubifs_info *c); | 55 | static int dbg_check_orphans(struct ubifs_info *c); |
57 | #else | ||
58 | #define dbg_check_orphans(c) 0 | ||
59 | #endif | ||
60 | 56 | ||
61 | /** | 57 | /** |
62 | * ubifs_add_orphan - add an orphan. | 58 | * ubifs_add_orphan - add an orphan. |
@@ -92,7 +88,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum) | |||
92 | else if (inum > o->inum) | 88 | else if (inum > o->inum) |
93 | p = &(*p)->rb_right; | 89 | p = &(*p)->rb_right; |
94 | else { | 90 | else { |
95 | dbg_err("orphaned twice"); | 91 | ubifs_err("orphaned twice"); |
96 | spin_unlock(&c->orphan_lock); | 92 | spin_unlock(&c->orphan_lock); |
97 | kfree(orphan); | 93 | kfree(orphan); |
98 | return 0; | 94 | return 0; |
@@ -158,8 +154,8 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum) | |||
158 | } | 154 | } |
159 | } | 155 | } |
160 | spin_unlock(&c->orphan_lock); | 156 | spin_unlock(&c->orphan_lock); |
161 | dbg_err("missing orphan ino %lu", (unsigned long)inum); | 157 | ubifs_err("missing orphan ino %lu", (unsigned long)inum); |
162 | dbg_dump_stack(); | 158 | dump_stack(); |
163 | } | 159 | } |
164 | 160 | ||
165 | /** | 161 | /** |
@@ -248,8 +244,7 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
248 | ubifs_assert(c->ohead_offs == 0); | 244 | ubifs_assert(c->ohead_offs == 0); |
249 | ubifs_prepare_node(c, c->orph_buf, len, 1); | 245 | ubifs_prepare_node(c, c->orph_buf, len, 1); |
250 | len = ALIGN(len, c->min_io_size); | 246 | len = ALIGN(len, c->min_io_size); |
251 | err = ubifs_leb_change(c, c->ohead_lnum, c->orph_buf, len, | 247 | err = ubifs_leb_change(c, c->ohead_lnum, c->orph_buf, len); |
252 | UBI_SHORTTERM); | ||
253 | } else { | 248 | } else { |
254 | if (c->ohead_offs == 0) { | 249 | if (c->ohead_offs == 0) { |
255 | /* Ensure LEB has been unmapped */ | 250 | /* Ensure LEB has been unmapped */ |
@@ -258,7 +253,7 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic) | |||
258 | return err; | 253 | return err; |
259 | } | 254 | } |
260 | err = ubifs_write_node(c, c->orph_buf, len, c->ohead_lnum, | 255 | err = ubifs_write_node(c, c->orph_buf, len, c->ohead_lnum, |
261 | c->ohead_offs, UBI_SHORTTERM); | 256 | c->ohead_offs); |
262 | } | 257 | } |
263 | return err; | 258 | return err; |
264 | } | 259 | } |
@@ -569,7 +564,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
569 | if (snod->type != UBIFS_ORPH_NODE) { | 564 | if (snod->type != UBIFS_ORPH_NODE) { |
570 | ubifs_err("invalid node type %d in orphan area at " | 565 | ubifs_err("invalid node type %d in orphan area at " |
571 | "%d:%d", snod->type, sleb->lnum, snod->offs); | 566 | "%d:%d", snod->type, sleb->lnum, snod->offs); |
572 | dbg_dump_node(c, snod->node); | 567 | ubifs_dump_node(c, snod->node); |
573 | return -EINVAL; | 568 | return -EINVAL; |
574 | } | 569 | } |
575 | 570 | ||
@@ -597,7 +592,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
597 | ubifs_err("out of order commit number %llu in " | 592 | ubifs_err("out of order commit number %llu in " |
598 | "orphan node at %d:%d", | 593 | "orphan node at %d:%d", |
599 | cmt_no, sleb->lnum, snod->offs); | 594 | cmt_no, sleb->lnum, snod->offs); |
600 | dbg_dump_node(c, snod->node); | 595 | ubifs_dump_node(c, snod->node); |
601 | return -EINVAL; | 596 | return -EINVAL; |
602 | } | 597 | } |
603 | dbg_rcvry("out of date LEB %d", sleb->lnum); | 598 | dbg_rcvry("out of date LEB %d", sleb->lnum); |
@@ -725,7 +720,9 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only) | |||
725 | return err; | 720 | return err; |
726 | } | 721 | } |
727 | 722 | ||
728 | #ifdef CONFIG_UBIFS_FS_DEBUG | 723 | /* |
724 | * Everything below is related to debugging. | ||
725 | */ | ||
729 | 726 | ||
730 | struct check_orphan { | 727 | struct check_orphan { |
731 | struct rb_node rb; | 728 | struct rb_node rb; |
@@ -968,5 +965,3 @@ out: | |||
968 | kfree(ci.node); | 965 | kfree(ci.node); |
969 | return err; | 966 | return err; |
970 | } | 967 | } |
971 | |||
972 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 2a935b317232..c30d976b4be8 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -213,10 +213,10 @@ static int write_rcvrd_mst_node(struct ubifs_info *c, | |||
213 | mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); | 213 | mst->flags |= cpu_to_le32(UBIFS_MST_RCVRY); |
214 | 214 | ||
215 | ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1); | 215 | ubifs_prepare_node(c, mst, UBIFS_MST_NODE_SZ, 1); |
216 | err = ubifs_leb_change(c, lnum, mst, sz, UBI_SHORTTERM); | 216 | err = ubifs_leb_change(c, lnum, mst, sz); |
217 | if (err) | 217 | if (err) |
218 | goto out; | 218 | goto out; |
219 | err = ubifs_leb_change(c, lnum + 1, mst, sz, UBI_SHORTTERM); | 219 | err = ubifs_leb_change(c, lnum + 1, mst, sz); |
220 | if (err) | 220 | if (err) |
221 | goto out; | 221 | goto out; |
222 | out: | 222 | out: |
@@ -362,12 +362,12 @@ out_err: | |||
362 | out_free: | 362 | out_free: |
363 | ubifs_err("failed to recover master node"); | 363 | ubifs_err("failed to recover master node"); |
364 | if (mst1) { | 364 | if (mst1) { |
365 | dbg_err("dumping first master node"); | 365 | ubifs_err("dumping first master node"); |
366 | dbg_dump_node(c, mst1); | 366 | ubifs_dump_node(c, mst1); |
367 | } | 367 | } |
368 | if (mst2) { | 368 | if (mst2) { |
369 | dbg_err("dumping second master node"); | 369 | ubifs_err("dumping second master node"); |
370 | dbg_dump_node(c, mst2); | 370 | ubifs_dump_node(c, mst2); |
371 | } | 371 | } |
372 | vfree(buf2); | 372 | vfree(buf2); |
373 | vfree(buf1); | 373 | vfree(buf1); |
@@ -555,8 +555,7 @@ static int fix_unclean_leb(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
555 | ubifs_pad(c, buf, pad_len); | 555 | ubifs_pad(c, buf, pad_len); |
556 | } | 556 | } |
557 | } | 557 | } |
558 | err = ubifs_leb_change(c, lnum, sleb->buf, len, | 558 | err = ubifs_leb_change(c, lnum, sleb->buf, len); |
559 | UBI_UNKNOWN); | ||
560 | if (err) | 559 | if (err) |
561 | return err; | 560 | return err; |
562 | } | 561 | } |
@@ -683,7 +682,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
683 | ret, lnum, offs); | 682 | ret, lnum, offs); |
684 | break; | 683 | break; |
685 | } else { | 684 | } else { |
686 | dbg_err("unexpected return value %d", ret); | 685 | ubifs_err("unexpected return value %d", ret); |
687 | err = -EINVAL; | 686 | err = -EINVAL; |
688 | goto error; | 687 | goto error; |
689 | } | 688 | } |
@@ -789,7 +788,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
789 | 788 | ||
790 | corrupted_rescan: | 789 | corrupted_rescan: |
791 | /* Re-scan the corrupted data with verbose messages */ | 790 | /* Re-scan the corrupted data with verbose messages */ |
792 | dbg_err("corruptio %d", ret); | 791 | ubifs_err("corruptio %d", ret); |
793 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); | 792 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); |
794 | corrupted: | 793 | corrupted: |
795 | ubifs_scanned_corruption(c, lnum, offs, buf); | 794 | ubifs_scanned_corruption(c, lnum, offs, buf); |
@@ -827,17 +826,17 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, | |||
827 | goto out_free; | 826 | goto out_free; |
828 | ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); | 827 | ret = ubifs_scan_a_node(c, cs_node, UBIFS_CS_NODE_SZ, lnum, offs, 0); |
829 | if (ret != SCANNED_A_NODE) { | 828 | if (ret != SCANNED_A_NODE) { |
830 | dbg_err("Not a valid node"); | 829 | ubifs_err("Not a valid node"); |
831 | goto out_err; | 830 | goto out_err; |
832 | } | 831 | } |
833 | if (cs_node->ch.node_type != UBIFS_CS_NODE) { | 832 | if (cs_node->ch.node_type != UBIFS_CS_NODE) { |
834 | dbg_err("Node a CS node, type is %d", cs_node->ch.node_type); | 833 | ubifs_err("Node a CS node, type is %d", cs_node->ch.node_type); |
835 | goto out_err; | 834 | goto out_err; |
836 | } | 835 | } |
837 | if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { | 836 | if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { |
838 | dbg_err("CS node cmt_no %llu != current cmt_no %llu", | 837 | ubifs_err("CS node cmt_no %llu != current cmt_no %llu", |
839 | (unsigned long long)le64_to_cpu(cs_node->cmt_no), | 838 | (unsigned long long)le64_to_cpu(cs_node->cmt_no), |
840 | c->cmt_no); | 839 | c->cmt_no); |
841 | goto out_err; | 840 | goto out_err; |
842 | } | 841 | } |
843 | *cs_sqnum = le64_to_cpu(cs_node->ch.sqnum); | 842 | *cs_sqnum = le64_to_cpu(cs_node->ch.sqnum); |
@@ -941,7 +940,7 @@ static int recover_head(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
941 | err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); | 940 | err = ubifs_leb_read(c, lnum, sbuf, 0, offs, 1); |
942 | if (err) | 941 | if (err) |
943 | return err; | 942 | return err; |
944 | return ubifs_leb_change(c, lnum, sbuf, offs, UBI_UNKNOWN); | 943 | return ubifs_leb_change(c, lnum, sbuf, offs); |
945 | } | 944 | } |
946 | 945 | ||
947 | return 0; | 946 | return 0; |
@@ -1071,7 +1070,7 @@ static int clean_an_unclean_leb(struct ubifs_info *c, | |||
1071 | } | 1070 | } |
1072 | 1071 | ||
1073 | /* Write back the LEB atomically */ | 1072 | /* Write back the LEB atomically */ |
1074 | err = ubifs_leb_change(c, lnum, sbuf, len, UBI_UNKNOWN); | 1073 | err = ubifs_leb_change(c, lnum, sbuf, len); |
1075 | if (err) | 1074 | if (err) |
1076 | return err; | 1075 | return err; |
1077 | 1076 | ||
@@ -1138,9 +1137,9 @@ static int grab_empty_leb(struct ubifs_info *c) | |||
1138 | */ | 1137 | */ |
1139 | lnum = ubifs_find_free_leb_for_idx(c); | 1138 | lnum = ubifs_find_free_leb_for_idx(c); |
1140 | if (lnum < 0) { | 1139 | if (lnum < 0) { |
1141 | dbg_err("could not find an empty LEB"); | 1140 | ubifs_err("could not find an empty LEB"); |
1142 | dbg_dump_lprops(c); | 1141 | ubifs_dump_lprops(c); |
1143 | dbg_dump_budg(c, &c->bi); | 1142 | ubifs_dump_budg(c, &c->bi); |
1144 | return lnum; | 1143 | return lnum; |
1145 | } | 1144 | } |
1146 | 1145 | ||
@@ -1218,7 +1217,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c) | |||
1218 | } | 1217 | } |
1219 | mutex_unlock(&wbuf->io_mutex); | 1218 | mutex_unlock(&wbuf->io_mutex); |
1220 | if (err < 0) { | 1219 | if (err < 0) { |
1221 | dbg_err("GC failed, error %d", err); | 1220 | ubifs_err("GC failed, error %d", err); |
1222 | if (err == -EAGAIN) | 1221 | if (err == -EAGAIN) |
1223 | err = -EINVAL; | 1222 | err = -EINVAL; |
1224 | return err; | 1223 | return err; |
@@ -1472,7 +1471,7 @@ static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e) | |||
1472 | len -= 1; | 1471 | len -= 1; |
1473 | len = ALIGN(len + 1, c->min_io_size); | 1472 | len = ALIGN(len + 1, c->min_io_size); |
1474 | /* Atomically write the fixed LEB back again */ | 1473 | /* Atomically write the fixed LEB back again */ |
1475 | err = ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); | 1474 | err = ubifs_leb_change(c, lnum, c->sbuf, len); |
1476 | if (err) | 1475 | if (err) |
1477 | goto out; | 1476 | goto out; |
1478 | dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", | 1477 | dbg_rcvry("inode %lu at %d:%d size %lld -> %lld", |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index b007637f0406..3a2da7e476e5 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -154,8 +154,7 @@ static int set_bud_lprops(struct ubifs_info *c, struct bud_entry *b) | |||
154 | 154 | ||
155 | /* Make sure the journal head points to the latest bud */ | 155 | /* Make sure the journal head points to the latest bud */ |
156 | err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, | 156 | err = ubifs_wbuf_seek_nolock(&c->jheads[b->bud->jhead].wbuf, |
157 | b->bud->lnum, c->leb_size - b->free, | 157 | b->bud->lnum, c->leb_size - b->free); |
158 | UBI_SHORTTERM); | ||
159 | 158 | ||
160 | out: | 159 | out: |
161 | ubifs_release_lprops(c); | 160 | ubifs_release_lprops(c); |
@@ -686,7 +685,7 @@ out: | |||
686 | 685 | ||
687 | out_dump: | 686 | out_dump: |
688 | ubifs_err("bad node is at LEB %d:%d", lnum, snod->offs); | 687 | ubifs_err("bad node is at LEB %d:%d", lnum, snod->offs); |
689 | dbg_dump_node(c, snod->node); | 688 | ubifs_dump_node(c, snod->node); |
690 | ubifs_scan_destroy(sleb); | 689 | ubifs_scan_destroy(sleb); |
691 | return -EINVAL; | 690 | return -EINVAL; |
692 | } | 691 | } |
@@ -861,16 +860,16 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
861 | * numbers. | 860 | * numbers. |
862 | */ | 861 | */ |
863 | if (snod->type != UBIFS_CS_NODE) { | 862 | if (snod->type != UBIFS_CS_NODE) { |
864 | dbg_err("first log node at LEB %d:%d is not CS node", | 863 | ubifs_err("first log node at LEB %d:%d is not CS node", |
865 | lnum, offs); | 864 | lnum, offs); |
866 | goto out_dump; | 865 | goto out_dump; |
867 | } | 866 | } |
868 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { | 867 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { |
869 | dbg_err("first CS node at LEB %d:%d has wrong " | 868 | ubifs_err("first CS node at LEB %d:%d has wrong " |
870 | "commit number %llu expected %llu", | 869 | "commit number %llu expected %llu", |
871 | lnum, offs, | 870 | lnum, offs, |
872 | (unsigned long long)le64_to_cpu(node->cmt_no), | 871 | (unsigned long long)le64_to_cpu(node->cmt_no), |
873 | c->cmt_no); | 872 | c->cmt_no); |
874 | goto out_dump; | 873 | goto out_dump; |
875 | } | 874 | } |
876 | 875 | ||
@@ -892,7 +891,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
892 | 891 | ||
893 | /* Make sure the first node sits at offset zero of the LEB */ | 892 | /* Make sure the first node sits at offset zero of the LEB */ |
894 | if (snod->offs != 0) { | 893 | if (snod->offs != 0) { |
895 | dbg_err("first node is not at zero offset"); | 894 | ubifs_err("first node is not at zero offset"); |
896 | goto out_dump; | 895 | goto out_dump; |
897 | } | 896 | } |
898 | 897 | ||
@@ -905,8 +904,8 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
905 | } | 904 | } |
906 | 905 | ||
907 | if (snod->sqnum < c->cs_sqnum) { | 906 | if (snod->sqnum < c->cs_sqnum) { |
908 | dbg_err("bad sqnum %llu, commit sqnum %llu", | 907 | ubifs_err("bad sqnum %llu, commit sqnum %llu", |
909 | snod->sqnum, c->cs_sqnum); | 908 | snod->sqnum, c->cs_sqnum); |
910 | goto out_dump; | 909 | goto out_dump; |
911 | } | 910 | } |
912 | 911 | ||
@@ -958,7 +957,7 @@ out: | |||
958 | out_dump: | 957 | out_dump: |
959 | ubifs_err("log error detected while replaying the log at LEB %d:%d", | 958 | ubifs_err("log error detected while replaying the log at LEB %d:%d", |
960 | lnum, offs + snod->offs); | 959 | lnum, offs + snod->offs); |
961 | dbg_dump_node(c, snod->node); | 960 | ubifs_dump_node(c, snod->node); |
962 | ubifs_scan_destroy(sleb); | 961 | ubifs_scan_destroy(sleb); |
963 | return -EINVAL; | 962 | return -EINVAL; |
964 | } | 963 | } |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 771f7fb6ce92..ef3d1ba6d992 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -130,7 +130,6 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
130 | * orphan node. | 130 | * orphan node. |
131 | */ | 131 | */ |
132 | orph_lebs = UBIFS_MIN_ORPH_LEBS; | 132 | orph_lebs = UBIFS_MIN_ORPH_LEBS; |
133 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
134 | if (c->leb_cnt - min_leb_cnt > 1) | 133 | if (c->leb_cnt - min_leb_cnt > 1) |
135 | /* | 134 | /* |
136 | * For debugging purposes it is better to have at least 2 | 135 | * For debugging purposes it is better to have at least 2 |
@@ -138,7 +137,6 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
138 | * consolidations and would be stressed more. | 137 | * consolidations and would be stressed more. |
139 | */ | 138 | */ |
140 | orph_lebs += 1; | 139 | orph_lebs += 1; |
141 | #endif | ||
142 | 140 | ||
143 | main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; | 141 | main_lebs = c->leb_cnt - UBIFS_SB_LEBS - UBIFS_MST_LEBS - log_lebs; |
144 | main_lebs -= orph_lebs; | 142 | main_lebs -= orph_lebs; |
@@ -196,7 +194,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
196 | sup->rp_size = cpu_to_le64(tmp64); | 194 | sup->rp_size = cpu_to_le64(tmp64); |
197 | sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); | 195 | sup->ro_compat_version = cpu_to_le32(UBIFS_RO_COMPAT_VERSION); |
198 | 196 | ||
199 | err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0, UBI_LONGTERM); | 197 | err = ubifs_write_node(c, sup, UBIFS_SB_NODE_SZ, 0, 0); |
200 | kfree(sup); | 198 | kfree(sup); |
201 | if (err) | 199 | if (err) |
202 | return err; | 200 | return err; |
@@ -252,14 +250,13 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
252 | 250 | ||
253 | mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ); | 251 | mst->total_used = cpu_to_le64(UBIFS_INO_NODE_SZ); |
254 | 252 | ||
255 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0, | 253 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM, 0); |
256 | UBI_UNKNOWN); | ||
257 | if (err) { | 254 | if (err) { |
258 | kfree(mst); | 255 | kfree(mst); |
259 | return err; | 256 | return err; |
260 | } | 257 | } |
261 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, 0, | 258 | err = ubifs_write_node(c, mst, UBIFS_MST_NODE_SZ, UBIFS_MST_LNUM + 1, |
262 | UBI_UNKNOWN); | 259 | 0); |
263 | kfree(mst); | 260 | kfree(mst); |
264 | if (err) | 261 | if (err) |
265 | return err; | 262 | return err; |
@@ -282,8 +279,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
282 | key_write_idx(c, &key, &br->key); | 279 | key_write_idx(c, &key, &br->key); |
283 | br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); | 280 | br->lnum = cpu_to_le32(main_first + DEFAULT_DATA_LEB); |
284 | br->len = cpu_to_le32(UBIFS_INO_NODE_SZ); | 281 | br->len = cpu_to_le32(UBIFS_INO_NODE_SZ); |
285 | err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0, | 282 | err = ubifs_write_node(c, idx, tmp, main_first + DEFAULT_IDX_LEB, 0); |
286 | UBI_UNKNOWN); | ||
287 | kfree(idx); | 283 | kfree(idx); |
288 | if (err) | 284 | if (err) |
289 | return err; | 285 | return err; |
@@ -315,8 +311,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
315 | ino->flags = cpu_to_le32(UBIFS_COMPR_FL); | 311 | ino->flags = cpu_to_le32(UBIFS_COMPR_FL); |
316 | 312 | ||
317 | err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, | 313 | err = ubifs_write_node(c, ino, UBIFS_INO_NODE_SZ, |
318 | main_first + DEFAULT_DATA_LEB, 0, | 314 | main_first + DEFAULT_DATA_LEB, 0); |
319 | UBI_UNKNOWN); | ||
320 | kfree(ino); | 315 | kfree(ino); |
321 | if (err) | 316 | if (err) |
322 | return err; | 317 | return err; |
@@ -335,8 +330,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
335 | return -ENOMEM; | 330 | return -ENOMEM; |
336 | 331 | ||
337 | cs->ch.node_type = UBIFS_CS_NODE; | 332 | cs->ch.node_type = UBIFS_CS_NODE; |
338 | err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, | 333 | err = ubifs_write_node(c, cs, UBIFS_CS_NODE_SZ, UBIFS_LOG_LNUM, 0); |
339 | 0, UBI_UNKNOWN); | ||
340 | kfree(cs); | 334 | kfree(cs); |
341 | 335 | ||
342 | ubifs_msg("default file-system created"); | 336 | ubifs_msg("default file-system created"); |
@@ -475,7 +469,7 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
475 | 469 | ||
476 | failed: | 470 | failed: |
477 | ubifs_err("bad superblock, error %d", err); | 471 | ubifs_err("bad superblock, error %d", err); |
478 | dbg_dump_node(c, sup); | 472 | ubifs_dump_node(c, sup); |
479 | return -EINVAL; | 473 | return -EINVAL; |
480 | } | 474 | } |
481 | 475 | ||
@@ -518,7 +512,7 @@ int ubifs_write_sb_node(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
518 | int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); | 512 | int len = ALIGN(UBIFS_SB_NODE_SZ, c->min_io_size); |
519 | 513 | ||
520 | ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); | 514 | ubifs_prepare_node(c, sup, UBIFS_SB_NODE_SZ, 1); |
521 | return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len, UBI_LONGTERM); | 515 | return ubifs_leb_change(c, UBIFS_SB_LNUM, sup, len); |
522 | } | 516 | } |
523 | 517 | ||
524 | /** | 518 | /** |
@@ -691,7 +685,7 @@ static int fixup_leb(struct ubifs_info *c, int lnum, int len) | |||
691 | if (err) | 685 | if (err) |
692 | return err; | 686 | return err; |
693 | 687 | ||
694 | return ubifs_leb_change(c, lnum, c->sbuf, len, UBI_UNKNOWN); | 688 | return ubifs_leb_change(c, lnum, c->sbuf, len); |
695 | } | 689 | } |
696 | 690 | ||
697 | /** | 691 | /** |
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 37383e8011b1..7c40e6025fd6 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c | |||
@@ -101,7 +101,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
101 | if (!quiet) { | 101 | if (!quiet) { |
102 | ubifs_err("bad pad node at LEB %d:%d", | 102 | ubifs_err("bad pad node at LEB %d:%d", |
103 | lnum, offs); | 103 | lnum, offs); |
104 | dbg_dump_node(c, pad); | 104 | ubifs_dump_node(c, pad); |
105 | } | 105 | } |
106 | return SCANNED_A_BAD_PAD_NODE; | 106 | return SCANNED_A_BAD_PAD_NODE; |
107 | } | 107 | } |
@@ -109,8 +109,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
109 | /* Make the node pads to 8-byte boundary */ | 109 | /* Make the node pads to 8-byte boundary */ |
110 | if ((node_len + pad_len) & 7) { | 110 | if ((node_len + pad_len) & 7) { |
111 | if (!quiet) | 111 | if (!quiet) |
112 | dbg_err("bad padding length %d - %d", | 112 | ubifs_err("bad padding length %d - %d", |
113 | offs, offs + node_len + pad_len); | 113 | offs, offs + node_len + pad_len); |
114 | return SCANNED_A_BAD_PAD_NODE; | 114 | return SCANNED_A_BAD_PAD_NODE; |
115 | } | 115 | } |
116 | 116 | ||
@@ -245,7 +245,7 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
245 | len = c->leb_size - offs; | 245 | len = c->leb_size - offs; |
246 | if (len > 8192) | 246 | if (len > 8192) |
247 | len = 8192; | 247 | len = 8192; |
248 | dbg_err("first %d bytes from LEB %d:%d", len, lnum, offs); | 248 | ubifs_err("first %d bytes from LEB %d:%d", len, lnum, offs); |
249 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); | 249 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); |
250 | } | 250 | } |
251 | 251 | ||
@@ -300,16 +300,16 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
300 | 300 | ||
301 | switch (ret) { | 301 | switch (ret) { |
302 | case SCANNED_GARBAGE: | 302 | case SCANNED_GARBAGE: |
303 | dbg_err("garbage"); | 303 | ubifs_err("garbage"); |
304 | goto corrupted; | 304 | goto corrupted; |
305 | case SCANNED_A_NODE: | 305 | case SCANNED_A_NODE: |
306 | break; | 306 | break; |
307 | case SCANNED_A_CORRUPT_NODE: | 307 | case SCANNED_A_CORRUPT_NODE: |
308 | case SCANNED_A_BAD_PAD_NODE: | 308 | case SCANNED_A_BAD_PAD_NODE: |
309 | dbg_err("bad node"); | 309 | ubifs_err("bad node"); |
310 | goto corrupted; | 310 | goto corrupted; |
311 | default: | 311 | default: |
312 | dbg_err("unknown"); | 312 | ubifs_err("unknown"); |
313 | err = -EINVAL; | 313 | err = -EINVAL; |
314 | goto error; | 314 | goto error; |
315 | } | 315 | } |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 76e4e0566ad6..001acccac0d6 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -246,8 +246,8 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum) | |||
246 | 246 | ||
247 | out_invalid: | 247 | out_invalid: |
248 | ubifs_err("inode %lu validation failed, error %d", inode->i_ino, err); | 248 | ubifs_err("inode %lu validation failed, error %d", inode->i_ino, err); |
249 | dbg_dump_node(c, ino); | 249 | ubifs_dump_node(c, ino); |
250 | dbg_dump_inode(c, inode); | 250 | ubifs_dump_inode(c, inode); |
251 | err = -EINVAL; | 251 | err = -EINVAL; |
252 | out_ino: | 252 | out_ino: |
253 | kfree(ino); | 253 | kfree(ino); |
@@ -668,8 +668,8 @@ static int init_constants_sb(struct ubifs_info *c) | |||
668 | tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; | 668 | tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; |
669 | tmp = ALIGN(tmp, c->min_io_size); | 669 | tmp = ALIGN(tmp, c->min_io_size); |
670 | if (tmp > c->leb_size) { | 670 | if (tmp > c->leb_size) { |
671 | dbg_err("too small LEB size %d, at least %d needed", | 671 | ubifs_err("too small LEB size %d, at least %d needed", |
672 | c->leb_size, tmp); | 672 | c->leb_size, tmp); |
673 | return -EINVAL; | 673 | return -EINVAL; |
674 | } | 674 | } |
675 | 675 | ||
@@ -683,8 +683,8 @@ static int init_constants_sb(struct ubifs_info *c) | |||
683 | tmp /= c->leb_size; | 683 | tmp /= c->leb_size; |
684 | tmp += 1; | 684 | tmp += 1; |
685 | if (c->log_lebs < tmp) { | 685 | if (c->log_lebs < tmp) { |
686 | dbg_err("too small log %d LEBs, required min. %d LEBs", | 686 | ubifs_err("too small log %d LEBs, required min. %d LEBs", |
687 | c->log_lebs, tmp); | 687 | c->log_lebs, tmp); |
688 | return -EINVAL; | 688 | return -EINVAL; |
689 | } | 689 | } |
690 | 690 | ||
@@ -813,13 +813,10 @@ static int alloc_wbufs(struct ubifs_info *c) | |||
813 | c->jheads[i].grouped = 1; | 813 | c->jheads[i].grouped = 1; |
814 | } | 814 | } |
815 | 815 | ||
816 | c->jheads[BASEHD].wbuf.dtype = UBI_SHORTTERM; | ||
817 | /* | 816 | /* |
818 | * Garbage Collector head likely contains long-term data and | 817 | * Garbage Collector head does not need to be synchronized by timer. |
819 | * does not need to be synchronized by timer. Also GC head nodes are | 818 | * Also GC head nodes are not grouped. |
820 | * not grouped. | ||
821 | */ | 819 | */ |
822 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; | ||
823 | c->jheads[GCHD].wbuf.no_timer = 1; | 820 | c->jheads[GCHD].wbuf.no_timer = 1; |
824 | c->jheads[GCHD].grouped = 0; | 821 | c->jheads[GCHD].grouped = 0; |
825 | 822 | ||
@@ -863,7 +860,7 @@ static void free_orphans(struct ubifs_info *c) | |||
863 | orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); | 860 | orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); |
864 | list_del(&orph->list); | 861 | list_del(&orph->list); |
865 | kfree(orph); | 862 | kfree(orph); |
866 | dbg_err("orphan list not empty at unmount"); | 863 | ubifs_err("orphan list not empty at unmount"); |
867 | } | 864 | } |
868 | 865 | ||
869 | vfree(c->orph_buf); | 866 | vfree(c->orph_buf); |
@@ -1147,8 +1144,8 @@ static int check_free_space(struct ubifs_info *c) | |||
1147 | ubifs_assert(c->dark_wm > 0); | 1144 | ubifs_assert(c->dark_wm > 0); |
1148 | if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) { | 1145 | if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) { |
1149 | ubifs_err("insufficient free space to mount in R/W mode"); | 1146 | ubifs_err("insufficient free space to mount in R/W mode"); |
1150 | dbg_dump_budg(c, &c->bi); | 1147 | ubifs_dump_budg(c, &c->bi); |
1151 | dbg_dump_lprops(c); | 1148 | ubifs_dump_lprops(c); |
1152 | return -ENOSPC; | 1149 | return -ENOSPC; |
1153 | } | 1150 | } |
1154 | return 0; | 1151 | return 0; |
@@ -1301,7 +1298,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1301 | if (!c->ro_mount && c->space_fixup) { | 1298 | if (!c->ro_mount && c->space_fixup) { |
1302 | err = ubifs_fixup_free_space(c); | 1299 | err = ubifs_fixup_free_space(c); |
1303 | if (err) | 1300 | if (err) |
1304 | goto out_master; | 1301 | goto out_lpt; |
1305 | } | 1302 | } |
1306 | 1303 | ||
1307 | if (!c->ro_mount) { | 1304 | if (!c->ro_mount) { |
@@ -2126,8 +2123,8 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, | |||
2126 | */ | 2123 | */ |
2127 | ubi = open_ubi(name, UBI_READONLY); | 2124 | ubi = open_ubi(name, UBI_READONLY); |
2128 | if (IS_ERR(ubi)) { | 2125 | if (IS_ERR(ubi)) { |
2129 | dbg_err("cannot open \"%s\", error %d", | 2126 | ubifs_err("cannot open \"%s\", error %d", |
2130 | name, (int)PTR_ERR(ubi)); | 2127 | name, (int)PTR_ERR(ubi)); |
2131 | return ERR_CAST(ubi); | 2128 | return ERR_CAST(ubi); |
2132 | } | 2129 | } |
2133 | 2130 | ||
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index abd51331345e..349f31a30f40 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -339,8 +339,8 @@ static int lnc_add(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
339 | 339 | ||
340 | err = ubifs_validate_entry(c, dent); | 340 | err = ubifs_validate_entry(c, dent); |
341 | if (err) { | 341 | if (err) { |
342 | dbg_dump_stack(); | 342 | dump_stack(); |
343 | dbg_dump_node(c, dent); | 343 | ubifs_dump_node(c, dent); |
344 | return err; | 344 | return err; |
345 | } | 345 | } |
346 | 346 | ||
@@ -372,8 +372,8 @@ static int lnc_add_directly(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
372 | 372 | ||
373 | err = ubifs_validate_entry(c, node); | 373 | err = ubifs_validate_entry(c, node); |
374 | if (err) { | 374 | if (err) { |
375 | dbg_dump_stack(); | 375 | dump_stack(); |
376 | dbg_dump_node(c, node); | 376 | ubifs_dump_node(c, node); |
377 | return err; | 377 | return err; |
378 | } | 378 | } |
379 | 379 | ||
@@ -1733,8 +1733,8 @@ out_err: | |||
1733 | err = -EINVAL; | 1733 | err = -EINVAL; |
1734 | out: | 1734 | out: |
1735 | ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); | 1735 | ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); |
1736 | dbg_dump_node(c, buf); | 1736 | ubifs_dump_node(c, buf); |
1737 | dbg_dump_stack(); | 1737 | dump_stack(); |
1738 | return err; | 1738 | return err; |
1739 | } | 1739 | } |
1740 | 1740 | ||
@@ -1775,7 +1775,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu) | |||
1775 | if (err && err != -EBADMSG) { | 1775 | if (err && err != -EBADMSG) { |
1776 | ubifs_err("failed to read from LEB %d:%d, error %d", | 1776 | ubifs_err("failed to read from LEB %d:%d, error %d", |
1777 | lnum, offs, err); | 1777 | lnum, offs, err); |
1778 | dbg_dump_stack(); | 1778 | dump_stack(); |
1779 | dbg_tnck(&bu->key, "key "); | 1779 | dbg_tnck(&bu->key, "key "); |
1780 | return err; | 1780 | return err; |
1781 | } | 1781 | } |
@@ -2403,7 +2403,7 @@ static int tnc_delete(struct ubifs_info *c, struct ubifs_znode *znode, int n) | |||
2403 | 2403 | ||
2404 | err = ubifs_add_dirt(c, zbr->lnum, zbr->len); | 2404 | err = ubifs_add_dirt(c, zbr->lnum, zbr->len); |
2405 | if (err) { | 2405 | if (err) { |
2406 | dbg_dump_znode(c, znode); | 2406 | ubifs_dump_znode(c, znode); |
2407 | return err; | 2407 | return err; |
2408 | } | 2408 | } |
2409 | 2409 | ||
@@ -2649,7 +2649,7 @@ int ubifs_tnc_remove_range(struct ubifs_info *c, union ubifs_key *from_key, | |||
2649 | err = ubifs_add_dirt(c, znode->zbranch[i].lnum, | 2649 | err = ubifs_add_dirt(c, znode->zbranch[i].lnum, |
2650 | znode->zbranch[i].len); | 2650 | znode->zbranch[i].len); |
2651 | if (err) { | 2651 | if (err) { |
2652 | dbg_dump_znode(c, znode); | 2652 | ubifs_dump_znode(c, znode); |
2653 | goto out_unlock; | 2653 | goto out_unlock; |
2654 | } | 2654 | } |
2655 | dbg_tnck(key, "removing key "); | 2655 | dbg_tnck(key, "removing key "); |
@@ -3275,8 +3275,6 @@ out_unlock: | |||
3275 | return err; | 3275 | return err; |
3276 | } | 3276 | } |
3277 | 3277 | ||
3278 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
3279 | |||
3280 | /** | 3278 | /** |
3281 | * dbg_check_inode_size - check if inode size is correct. | 3279 | * dbg_check_inode_size - check if inode size is correct. |
3282 | * @c: UBIFS file-system description object | 3280 | * @c: UBIFS file-system description object |
@@ -3335,13 +3333,11 @@ out_dump: | |||
3335 | (unsigned long)inode->i_ino, size, | 3333 | (unsigned long)inode->i_ino, size, |
3336 | ((loff_t)block) << UBIFS_BLOCK_SHIFT); | 3334 | ((loff_t)block) << UBIFS_BLOCK_SHIFT); |
3337 | mutex_unlock(&c->tnc_mutex); | 3335 | mutex_unlock(&c->tnc_mutex); |
3338 | dbg_dump_inode(c, inode); | 3336 | ubifs_dump_inode(c, inode); |
3339 | dbg_dump_stack(); | 3337 | dump_stack(); |
3340 | return -EINVAL; | 3338 | return -EINVAL; |
3341 | 3339 | ||
3342 | out_unlock: | 3340 | out_unlock: |
3343 | mutex_unlock(&c->tnc_mutex); | 3341 | mutex_unlock(&c->tnc_mutex); |
3344 | return err; | 3342 | return err; |
3345 | } | 3343 | } |
3346 | |||
3347 | #endif /* CONFIG_UBIFS_FS_DEBUG */ | ||
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index 4c15f07a8bb2..523bbad69c0c 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -54,18 +54,16 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, | |||
54 | br->len = cpu_to_le32(zbr->len); | 54 | br->len = cpu_to_le32(zbr->len); |
55 | if (!zbr->lnum || !zbr->len) { | 55 | if (!zbr->lnum || !zbr->len) { |
56 | ubifs_err("bad ref in znode"); | 56 | ubifs_err("bad ref in znode"); |
57 | dbg_dump_znode(c, znode); | 57 | ubifs_dump_znode(c, znode); |
58 | if (zbr->znode) | 58 | if (zbr->znode) |
59 | dbg_dump_znode(c, zbr->znode); | 59 | ubifs_dump_znode(c, zbr->znode); |
60 | } | 60 | } |
61 | } | 61 | } |
62 | ubifs_prepare_node(c, idx, len, 0); | 62 | ubifs_prepare_node(c, idx, len, 0); |
63 | 63 | ||
64 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
65 | znode->lnum = lnum; | 64 | znode->lnum = lnum; |
66 | znode->offs = offs; | 65 | znode->offs = offs; |
67 | znode->len = len; | 66 | znode->len = len; |
68 | #endif | ||
69 | 67 | ||
70 | err = insert_old_idx_znode(c, znode); | 68 | err = insert_old_idx_znode(c, znode); |
71 | 69 | ||
@@ -322,8 +320,7 @@ static int layout_leb_in_gaps(struct ubifs_info *c, int *p) | |||
322 | 0, 0, 0); | 320 | 0, 0, 0); |
323 | if (err) | 321 | if (err) |
324 | return err; | 322 | return err; |
325 | err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len, | 323 | err = ubifs_leb_change(c, lnum, c->ileb_buf, c->ileb_len); |
326 | UBI_SHORTTERM); | ||
327 | if (err) | 324 | if (err) |
328 | return err; | 325 | return err; |
329 | dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); | 326 | dbg_gc("LEB %d wrote %d index nodes", lnum, tot_written); |
@@ -388,8 +385,8 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
388 | * option which forces in-the-gaps is enabled. | 385 | * option which forces in-the-gaps is enabled. |
389 | */ | 386 | */ |
390 | ubifs_warn("out of space"); | 387 | ubifs_warn("out of space"); |
391 | dbg_dump_budg(c, &c->bi); | 388 | ubifs_dump_budg(c, &c->bi); |
392 | dbg_dump_lprops(c); | 389 | ubifs_dump_lprops(c); |
393 | } | 390 | } |
394 | /* Try to commit anyway */ | 391 | /* Try to commit anyway */ |
395 | err = 0; | 392 | err = 0; |
@@ -456,11 +453,9 @@ static int layout_in_empty_space(struct ubifs_info *c) | |||
456 | 453 | ||
457 | offs = buf_offs + used; | 454 | offs = buf_offs + used; |
458 | 455 | ||
459 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
460 | znode->lnum = lnum; | 456 | znode->lnum = lnum; |
461 | znode->offs = offs; | 457 | znode->offs = offs; |
462 | znode->len = len; | 458 | znode->len = len; |
463 | #endif | ||
464 | 459 | ||
465 | /* Update the parent */ | 460 | /* Update the parent */ |
466 | zp = znode->parent; | 461 | zp = znode->parent; |
@@ -536,10 +531,8 @@ static int layout_in_empty_space(struct ubifs_info *c) | |||
536 | break; | 531 | break; |
537 | } | 532 | } |
538 | 533 | ||
539 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
540 | c->dbg->new_ihead_lnum = lnum; | 534 | c->dbg->new_ihead_lnum = lnum; |
541 | c->dbg->new_ihead_offs = buf_offs; | 535 | c->dbg->new_ihead_offs = buf_offs; |
542 | #endif | ||
543 | 536 | ||
544 | return 0; | 537 | return 0; |
545 | } | 538 | } |
@@ -864,9 +857,9 @@ static int write_index(struct ubifs_info *c) | |||
864 | br->len = cpu_to_le32(zbr->len); | 857 | br->len = cpu_to_le32(zbr->len); |
865 | if (!zbr->lnum || !zbr->len) { | 858 | if (!zbr->lnum || !zbr->len) { |
866 | ubifs_err("bad ref in znode"); | 859 | ubifs_err("bad ref in znode"); |
867 | dbg_dump_znode(c, znode); | 860 | ubifs_dump_znode(c, znode); |
868 | if (zbr->znode) | 861 | if (zbr->znode) |
869 | dbg_dump_znode(c, zbr->znode); | 862 | ubifs_dump_znode(c, zbr->znode); |
870 | } | 863 | } |
871 | } | 864 | } |
872 | len = ubifs_idx_node_sz(c, znode->child_cnt); | 865 | len = ubifs_idx_node_sz(c, znode->child_cnt); |
@@ -881,13 +874,11 @@ static int write_index(struct ubifs_info *c) | |||
881 | } | 874 | } |
882 | offs = buf_offs + used; | 875 | offs = buf_offs + used; |
883 | 876 | ||
884 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
885 | if (lnum != znode->lnum || offs != znode->offs || | 877 | if (lnum != znode->lnum || offs != znode->offs || |
886 | len != znode->len) { | 878 | len != znode->len) { |
887 | ubifs_err("inconsistent znode posn"); | 879 | ubifs_err("inconsistent znode posn"); |
888 | return -EINVAL; | 880 | return -EINVAL; |
889 | } | 881 | } |
890 | #endif | ||
891 | 882 | ||
892 | /* Grab some stuff from znode while we still can */ | 883 | /* Grab some stuff from znode while we still can */ |
893 | cnext = znode->cnext; | 884 | cnext = znode->cnext; |
@@ -959,8 +950,7 @@ static int write_index(struct ubifs_info *c) | |||
959 | } | 950 | } |
960 | 951 | ||
961 | /* The buffer is full or there are no more znodes to do */ | 952 | /* The buffer is full or there are no more znodes to do */ |
962 | err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen, | 953 | err = ubifs_leb_write(c, lnum, c->cbuf, buf_offs, blen); |
963 | UBI_SHORTTERM); | ||
964 | if (err) | 954 | if (err) |
965 | return err; | 955 | return err; |
966 | buf_offs += blen; | 956 | buf_offs += blen; |
@@ -982,13 +972,11 @@ static int write_index(struct ubifs_info *c) | |||
982 | break; | 972 | break; |
983 | } | 973 | } |
984 | 974 | ||
985 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
986 | if (lnum != c->dbg->new_ihead_lnum || | 975 | if (lnum != c->dbg->new_ihead_lnum || |
987 | buf_offs != c->dbg->new_ihead_offs) { | 976 | buf_offs != c->dbg->new_ihead_offs) { |
988 | ubifs_err("inconsistent ihead"); | 977 | ubifs_err("inconsistent ihead"); |
989 | return -EINVAL; | 978 | return -EINVAL; |
990 | } | 979 | } |
991 | #endif | ||
992 | 980 | ||
993 | c->ihead_lnum = lnum; | 981 | c->ihead_lnum = lnum; |
994 | c->ihead_offs = buf_offs; | 982 | c->ihead_offs = buf_offs; |
diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c index dc28fe6ec07a..d38ac7f9654b 100644 --- a/fs/ubifs/tnc_misc.c +++ b/fs/ubifs/tnc_misc.c | |||
@@ -293,10 +293,10 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
293 | lnum, offs, znode->level, znode->child_cnt); | 293 | lnum, offs, znode->level, znode->child_cnt); |
294 | 294 | ||
295 | if (znode->child_cnt > c->fanout || znode->level > UBIFS_MAX_LEVELS) { | 295 | if (znode->child_cnt > c->fanout || znode->level > UBIFS_MAX_LEVELS) { |
296 | dbg_err("current fanout %d, branch count %d", | 296 | ubifs_err("current fanout %d, branch count %d", |
297 | c->fanout, znode->child_cnt); | 297 | c->fanout, znode->child_cnt); |
298 | dbg_err("max levels %d, znode level %d", | 298 | ubifs_err("max levels %d, znode level %d", |
299 | UBIFS_MAX_LEVELS, znode->level); | 299 | UBIFS_MAX_LEVELS, znode->level); |
300 | err = 1; | 300 | err = 1; |
301 | goto out_dump; | 301 | goto out_dump; |
302 | } | 302 | } |
@@ -316,7 +316,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
316 | if (zbr->lnum < c->main_first || | 316 | if (zbr->lnum < c->main_first || |
317 | zbr->lnum >= c->leb_cnt || zbr->offs < 0 || | 317 | zbr->lnum >= c->leb_cnt || zbr->offs < 0 || |
318 | zbr->offs + zbr->len > c->leb_size || zbr->offs & 7) { | 318 | zbr->offs + zbr->len > c->leb_size || zbr->offs & 7) { |
319 | dbg_err("bad branch %d", i); | 319 | ubifs_err("bad branch %d", i); |
320 | err = 2; | 320 | err = 2; |
321 | goto out_dump; | 321 | goto out_dump; |
322 | } | 322 | } |
@@ -340,19 +340,19 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
340 | type = key_type(c, &zbr->key); | 340 | type = key_type(c, &zbr->key); |
341 | if (c->ranges[type].max_len == 0) { | 341 | if (c->ranges[type].max_len == 0) { |
342 | if (zbr->len != c->ranges[type].len) { | 342 | if (zbr->len != c->ranges[type].len) { |
343 | dbg_err("bad target node (type %d) length (%d)", | 343 | ubifs_err("bad target node (type %d) length (%d)", |
344 | type, zbr->len); | 344 | type, zbr->len); |
345 | dbg_err("have to be %d", c->ranges[type].len); | 345 | ubifs_err("have to be %d", c->ranges[type].len); |
346 | err = 4; | 346 | err = 4; |
347 | goto out_dump; | 347 | goto out_dump; |
348 | } | 348 | } |
349 | } else if (zbr->len < c->ranges[type].min_len || | 349 | } else if (zbr->len < c->ranges[type].min_len || |
350 | zbr->len > c->ranges[type].max_len) { | 350 | zbr->len > c->ranges[type].max_len) { |
351 | dbg_err("bad target node (type %d) length (%d)", | 351 | ubifs_err("bad target node (type %d) length (%d)", |
352 | type, zbr->len); | 352 | type, zbr->len); |
353 | dbg_err("have to be in range of %d-%d", | 353 | ubifs_err("have to be in range of %d-%d", |
354 | c->ranges[type].min_len, | 354 | c->ranges[type].min_len, |
355 | c->ranges[type].max_len); | 355 | c->ranges[type].max_len); |
356 | err = 5; | 356 | err = 5; |
357 | goto out_dump; | 357 | goto out_dump; |
358 | } | 358 | } |
@@ -370,13 +370,13 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
370 | 370 | ||
371 | cmp = keys_cmp(c, key1, key2); | 371 | cmp = keys_cmp(c, key1, key2); |
372 | if (cmp > 0) { | 372 | if (cmp > 0) { |
373 | dbg_err("bad key order (keys %d and %d)", i, i + 1); | 373 | ubifs_err("bad key order (keys %d and %d)", i, i + 1); |
374 | err = 6; | 374 | err = 6; |
375 | goto out_dump; | 375 | goto out_dump; |
376 | } else if (cmp == 0 && !is_hash_key(c, key1)) { | 376 | } else if (cmp == 0 && !is_hash_key(c, key1)) { |
377 | /* These can only be keys with colliding hash */ | 377 | /* These can only be keys with colliding hash */ |
378 | dbg_err("keys %d and %d are not hashed but equivalent", | 378 | ubifs_err("keys %d and %d are not hashed but equivalent", |
379 | i, i + 1); | 379 | i, i + 1); |
380 | err = 7; | 380 | err = 7; |
381 | goto out_dump; | 381 | goto out_dump; |
382 | } | 382 | } |
@@ -387,7 +387,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
387 | 387 | ||
388 | out_dump: | 388 | out_dump: |
389 | ubifs_err("bad indexing node at LEB %d:%d, error %d", lnum, offs, err); | 389 | ubifs_err("bad indexing node at LEB %d:%d, error %d", lnum, offs, err); |
390 | dbg_dump_node(c, idx); | 390 | ubifs_dump_node(c, idx); |
391 | kfree(idx); | 391 | kfree(idx); |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | } | 393 | } |
@@ -486,7 +486,7 @@ int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
486 | zbr->lnum, zbr->offs); | 486 | zbr->lnum, zbr->offs); |
487 | dbg_tnck(key, "looked for key "); | 487 | dbg_tnck(key, "looked for key "); |
488 | dbg_tnck(&key1, "but found node's key "); | 488 | dbg_tnck(&key1, "but found node's key "); |
489 | dbg_dump_node(c, node); | 489 | ubifs_dump_node(c, node); |
490 | return -EINVAL; | 490 | return -EINVAL; |
491 | } | 491 | } |
492 | 492 | ||
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 93d59aceaaef..1e5a08623d11 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -650,8 +650,6 @@ typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, | |||
650 | * @avail: number of bytes available in the write-buffer | 650 | * @avail: number of bytes available in the write-buffer |
651 | * @used: number of used bytes in the write-buffer | 651 | * @used: number of used bytes in the write-buffer |
652 | * @size: write-buffer size (in [@c->min_io_size, @c->max_write_size] range) | 652 | * @size: write-buffer size (in [@c->min_io_size, @c->max_write_size] range) |
653 | * @dtype: type of data stored in this LEB (%UBI_LONGTERM, %UBI_SHORTTERM, | ||
654 | * %UBI_UNKNOWN) | ||
655 | * @jhead: journal head the mutex belongs to (note, needed only to shut lockdep | 653 | * @jhead: journal head the mutex belongs to (note, needed only to shut lockdep |
656 | * up by 'mutex_lock_nested()). | 654 | * up by 'mutex_lock_nested()). |
657 | * @sync_callback: write-buffer synchronization callback | 655 | * @sync_callback: write-buffer synchronization callback |
@@ -685,7 +683,6 @@ struct ubifs_wbuf { | |||
685 | int avail; | 683 | int avail; |
686 | int used; | 684 | int used; |
687 | int size; | 685 | int size; |
688 | int dtype; | ||
689 | int jhead; | 686 | int jhead; |
690 | int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); | 687 | int (*sync_callback)(struct ubifs_info *c, int lnum, int free, int pad); |
691 | struct mutex io_mutex; | 688 | struct mutex io_mutex; |
@@ -762,6 +759,9 @@ struct ubifs_zbranch { | |||
762 | * @offs: offset of the corresponding indexing node | 759 | * @offs: offset of the corresponding indexing node |
763 | * @len: length of the corresponding indexing node | 760 | * @len: length of the corresponding indexing node |
764 | * @zbranch: array of znode branches (@c->fanout elements) | 761 | * @zbranch: array of znode branches (@c->fanout elements) |
762 | * | ||
763 | * Note! The @lnum, @offs, and @len fields are not really needed - we have them | ||
764 | * only for internal consistency check. They could be removed to save some RAM. | ||
765 | */ | 765 | */ |
766 | struct ubifs_znode { | 766 | struct ubifs_znode { |
767 | struct ubifs_znode *parent; | 767 | struct ubifs_znode *parent; |
@@ -772,9 +772,9 @@ struct ubifs_znode { | |||
772 | int child_cnt; | 772 | int child_cnt; |
773 | int iip; | 773 | int iip; |
774 | int alt; | 774 | int alt; |
775 | #ifdef CONFIG_UBIFS_FS_DEBUG | 775 | int lnum; |
776 | int lnum, offs, len; | 776 | int offs; |
777 | #endif | 777 | int len; |
778 | struct ubifs_zbranch zbranch[]; | 778 | struct ubifs_zbranch zbranch[]; |
779 | }; | 779 | }; |
780 | 780 | ||
@@ -1444,9 +1444,7 @@ struct ubifs_info { | |||
1444 | struct rb_root size_tree; | 1444 | struct rb_root size_tree; |
1445 | struct ubifs_mount_opts mount_opts; | 1445 | struct ubifs_mount_opts mount_opts; |
1446 | 1446 | ||
1447 | #ifdef CONFIG_UBIFS_FS_DEBUG | ||
1448 | struct ubifs_debug_info *dbg; | 1447 | struct ubifs_debug_info *dbg; |
1449 | #endif | ||
1450 | }; | 1448 | }; |
1451 | 1449 | ||
1452 | extern struct list_head ubifs_infos; | 1450 | extern struct list_head ubifs_infos; |
@@ -1468,22 +1466,20 @@ void ubifs_ro_mode(struct ubifs_info *c, int err); | |||
1468 | int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, | 1466 | int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, |
1469 | int len, int even_ebadmsg); | 1467 | int len, int even_ebadmsg); |
1470 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | 1468 | int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, |
1471 | int len, int dtype); | 1469 | int len); |
1472 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len, | 1470 | int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len); |
1473 | int dtype); | ||
1474 | int ubifs_leb_unmap(struct ubifs_info *c, int lnum); | 1471 | int ubifs_leb_unmap(struct ubifs_info *c, int lnum); |
1475 | int ubifs_leb_map(struct ubifs_info *c, int lnum, int dtype); | 1472 | int ubifs_leb_map(struct ubifs_info *c, int lnum); |
1476 | int ubifs_is_mapped(const struct ubifs_info *c, int lnum); | 1473 | int ubifs_is_mapped(const struct ubifs_info *c, int lnum); |
1477 | int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len); | 1474 | int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len); |
1478 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | 1475 | int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs); |
1479 | int dtype); | ||
1480 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf); | 1476 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf); |
1481 | int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, | 1477 | int ubifs_read_node(const struct ubifs_info *c, void *buf, int type, int len, |
1482 | int lnum, int offs); | 1478 | int lnum, int offs); |
1483 | int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | 1479 | int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, |
1484 | int lnum, int offs); | 1480 | int lnum, int offs); |
1485 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, | 1481 | int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum, |
1486 | int offs, int dtype); | 1482 | int offs); |
1487 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | 1483 | int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, |
1488 | int offs, int quiet, int must_chk_crc); | 1484 | int offs, int quiet, int must_chk_crc); |
1489 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); | 1485 | void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad); |
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index 7a8bafa19c9f..0f7139bdb2c2 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
@@ -399,8 +399,8 @@ ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, | |||
399 | if (buf) { | 399 | if (buf) { |
400 | /* If @buf is %NULL we are supposed to return the length */ | 400 | /* If @buf is %NULL we are supposed to return the length */ |
401 | if (ui->data_len > size) { | 401 | if (ui->data_len > size) { |
402 | dbg_err("buffer size %zd, xattr len %d", | 402 | ubifs_err("buffer size %zd, xattr len %d", |
403 | size, ui->data_len); | 403 | size, ui->data_len); |
404 | err = -ERANGE; | 404 | err = -ERANGE; |
405 | goto out_iput; | 405 | goto out_iput; |
406 | } | 406 | } |