diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ubifs/budget.c | 2 | ||||
-rw-r--r-- | fs/ubifs/commit.c | 12 | ||||
-rw-r--r-- | fs/ubifs/compress.c | 22 | ||||
-rw-r--r-- | fs/ubifs/debug.c | 186 | ||||
-rw-r--r-- | fs/ubifs/dir.c | 12 | ||||
-rw-r--r-- | fs/ubifs/file.c | 17 | ||||
-rw-r--r-- | fs/ubifs/io.c | 40 | ||||
-rw-r--r-- | fs/ubifs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/ubifs/journal.c | 17 | ||||
-rw-r--r-- | fs/ubifs/log.c | 4 | ||||
-rw-r--r-- | fs/ubifs/lprops.c | 62 | ||||
-rw-r--r-- | fs/ubifs/lpt.c | 59 | ||||
-rw-r--r-- | fs/ubifs/lpt_commit.c | 34 | ||||
-rw-r--r-- | fs/ubifs/master.c | 6 | ||||
-rw-r--r-- | fs/ubifs/orphan.c | 26 | ||||
-rw-r--r-- | fs/ubifs/recovery.c | 34 | ||||
-rw-r--r-- | fs/ubifs/replay.c | 34 | ||||
-rw-r--r-- | fs/ubifs/sb.c | 30 | ||||
-rw-r--r-- | fs/ubifs/scan.c | 24 | ||||
-rw-r--r-- | fs/ubifs/super.c | 105 | ||||
-rw-r--r-- | fs/ubifs/tnc.c | 20 | ||||
-rw-r--r-- | fs/ubifs/tnc_commit.c | 12 | ||||
-rw-r--r-- | fs/ubifs/tnc_misc.c | 24 | ||||
-rw-r--r-- | fs/ubifs/ubifs.h | 26 | ||||
-rw-r--r-- | fs/ubifs/xattr.c | 18 |
25 files changed, 419 insertions, 409 deletions
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c index eb997e9c4ab0..11a11b32a2a9 100644 --- a/fs/ubifs/budget.c +++ b/fs/ubifs/budget.c | |||
@@ -509,7 +509,7 @@ again: | |||
509 | c->bi.nospace_rp = 1; | 509 | c->bi.nospace_rp = 1; |
510 | smp_wmb(); | 510 | smp_wmb(); |
511 | } else | 511 | } else |
512 | ubifs_err("cannot budget space, error %d", err); | 512 | ubifs_err(c, "cannot budget space, error %d", err); |
513 | return err; | 513 | return err; |
514 | } | 514 | } |
515 | 515 | ||
diff --git a/fs/ubifs/commit.c b/fs/ubifs/commit.c index 26b69b2d4a45..63f56619991d 100644 --- a/fs/ubifs/commit.c +++ b/fs/ubifs/commit.c | |||
@@ -225,7 +225,7 @@ out_cancel: | |||
225 | out_up: | 225 | out_up: |
226 | up_write(&c->commit_sem); | 226 | up_write(&c->commit_sem); |
227 | out: | 227 | out: |
228 | ubifs_err("commit failed, error %d", err); | 228 | ubifs_err(c, "commit failed, error %d", err); |
229 | spin_lock(&c->cs_lock); | 229 | spin_lock(&c->cs_lock); |
230 | c->cmt_state = COMMIT_BROKEN; | 230 | c->cmt_state = COMMIT_BROKEN; |
231 | wake_up(&c->cmt_wq); | 231 | wake_up(&c->cmt_wq); |
@@ -289,7 +289,7 @@ int ubifs_bg_thread(void *info) | |||
289 | int err; | 289 | int err; |
290 | struct ubifs_info *c = info; | 290 | struct ubifs_info *c = info; |
291 | 291 | ||
292 | ubifs_msg("background thread \"%s\" started, PID %d", | 292 | ubifs_msg(c, "background thread \"%s\" started, PID %d", |
293 | c->bgt_name, current->pid); | 293 | c->bgt_name, current->pid); |
294 | set_freezable(); | 294 | set_freezable(); |
295 | 295 | ||
@@ -324,7 +324,7 @@ int ubifs_bg_thread(void *info) | |||
324 | cond_resched(); | 324 | cond_resched(); |
325 | } | 325 | } |
326 | 326 | ||
327 | ubifs_msg("background thread \"%s\" stops", c->bgt_name); | 327 | ubifs_msg(c, "background thread \"%s\" stops", c->bgt_name); |
328 | return 0; | 328 | return 0; |
329 | } | 329 | } |
330 | 330 | ||
@@ -712,13 +712,13 @@ out: | |||
712 | return 0; | 712 | return 0; |
713 | 713 | ||
714 | out_dump: | 714 | out_dump: |
715 | ubifs_err("dumping index node (iip=%d)", i->iip); | 715 | ubifs_err(c, "dumping index node (iip=%d)", i->iip); |
716 | ubifs_dump_node(c, idx); | 716 | ubifs_dump_node(c, idx); |
717 | list_del(&i->list); | 717 | list_del(&i->list); |
718 | kfree(i); | 718 | kfree(i); |
719 | if (!list_empty(&list)) { | 719 | if (!list_empty(&list)) { |
720 | i = list_entry(list.prev, struct idx_node, list); | 720 | i = list_entry(list.prev, struct idx_node, list); |
721 | ubifs_err("dumping parent index node"); | 721 | ubifs_err(c, "dumping parent index node"); |
722 | ubifs_dump_node(c, &i->idx); | 722 | ubifs_dump_node(c, &i->idx); |
723 | } | 723 | } |
724 | out_free: | 724 | out_free: |
@@ -727,7 +727,7 @@ out_free: | |||
727 | list_del(&i->list); | 727 | list_del(&i->list); |
728 | kfree(i); | 728 | kfree(i); |
729 | } | 729 | } |
730 | ubifs_err("failed, error %d", err); | 730 | ubifs_err(c, "failed, error %d", err); |
731 | if (err > 0) | 731 | if (err > 0) |
732 | err = -EINVAL; | 732 | err = -EINVAL; |
733 | return err; | 733 | return err; |
diff --git a/fs/ubifs/compress.c b/fs/ubifs/compress.c index 2bfa0953335d..565cb56d7225 100644 --- a/fs/ubifs/compress.c +++ b/fs/ubifs/compress.c | |||
@@ -92,8 +92,8 @@ struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT]; | |||
92 | * Note, if the input buffer was not compressed, it is copied to the output | 92 | * Note, if the input buffer was not compressed, it is copied to the output |
93 | * buffer and %UBIFS_COMPR_NONE is returned in @compr_type. | 93 | * buffer and %UBIFS_COMPR_NONE is returned in @compr_type. |
94 | */ | 94 | */ |
95 | void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, | 95 | void ubifs_compress(const struct ubifs_info *c, const void *in_buf, |
96 | int *compr_type) | 96 | int in_len, void *out_buf, int *out_len, int *compr_type) |
97 | { | 97 | { |
98 | int err; | 98 | int err; |
99 | struct ubifs_compressor *compr = ubifs_compressors[*compr_type]; | 99 | struct ubifs_compressor *compr = ubifs_compressors[*compr_type]; |
@@ -112,9 +112,9 @@ void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, | |||
112 | if (compr->comp_mutex) | 112 | if (compr->comp_mutex) |
113 | mutex_unlock(compr->comp_mutex); | 113 | mutex_unlock(compr->comp_mutex); |
114 | if (unlikely(err)) { | 114 | if (unlikely(err)) { |
115 | ubifs_warn("cannot compress %d bytes, compressor %s, error %d, leave data uncompressed", | 115 | ubifs_warn(c, "cannot compress %d bytes, compressor %s, error %d, leave data uncompressed", |
116 | in_len, compr->name, err); | 116 | in_len, compr->name, err); |
117 | goto no_compr; | 117 | goto no_compr; |
118 | } | 118 | } |
119 | 119 | ||
120 | /* | 120 | /* |
@@ -144,21 +144,21 @@ no_compr: | |||
144 | * The length of the uncompressed data is returned in @out_len. This functions | 144 | * The length of the uncompressed data is returned in @out_len. This functions |
145 | * returns %0 on success or a negative error code on failure. | 145 | * returns %0 on success or a negative error code on failure. |
146 | */ | 146 | */ |
147 | int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, | 147 | int ubifs_decompress(const struct ubifs_info *c, const void *in_buf, |
148 | int *out_len, int compr_type) | 148 | int in_len, void *out_buf, int *out_len, int compr_type) |
149 | { | 149 | { |
150 | int err; | 150 | int err; |
151 | struct ubifs_compressor *compr; | 151 | struct ubifs_compressor *compr; |
152 | 152 | ||
153 | if (unlikely(compr_type < 0 || compr_type >= UBIFS_COMPR_TYPES_CNT)) { | 153 | if (unlikely(compr_type < 0 || compr_type >= UBIFS_COMPR_TYPES_CNT)) { |
154 | ubifs_err("invalid compression type %d", compr_type); | 154 | ubifs_err(c, "invalid compression type %d", compr_type); |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
158 | compr = ubifs_compressors[compr_type]; | 158 | compr = ubifs_compressors[compr_type]; |
159 | 159 | ||
160 | if (unlikely(!compr->capi_name)) { | 160 | if (unlikely(!compr->capi_name)) { |
161 | ubifs_err("%s compression is not compiled in", compr->name); | 161 | ubifs_err(c, "%s compression is not compiled in", compr->name); |
162 | return -EINVAL; | 162 | return -EINVAL; |
163 | } | 163 | } |
164 | 164 | ||
@@ -175,7 +175,7 @@ int ubifs_decompress(const void *in_buf, int in_len, void *out_buf, | |||
175 | if (compr->decomp_mutex) | 175 | if (compr->decomp_mutex) |
176 | mutex_unlock(compr->decomp_mutex); | 176 | mutex_unlock(compr->decomp_mutex); |
177 | if (err) | 177 | if (err) |
178 | ubifs_err("cannot decompress %d bytes, compressor %s, error %d", | 178 | ubifs_err(c, "cannot decompress %d bytes, compressor %s, error %d", |
179 | in_len, compr->name, err); | 179 | in_len, compr->name, err); |
180 | 180 | ||
181 | return err; | 181 | return err; |
@@ -193,8 +193,8 @@ static int __init compr_init(struct ubifs_compressor *compr) | |||
193 | if (compr->capi_name) { | 193 | if (compr->capi_name) { |
194 | compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0); | 194 | compr->cc = crypto_alloc_comp(compr->capi_name, 0, 0); |
195 | if (IS_ERR(compr->cc)) { | 195 | if (IS_ERR(compr->cc)) { |
196 | ubifs_err("cannot initialize compressor %s, error %ld", | 196 | pr_err("UBIFS error (pid %d): cannot initialize compressor %s, error %ld", |
197 | compr->name, PTR_ERR(compr->cc)); | 197 | current->pid, compr->name, PTR_ERR(compr->cc)); |
198 | return PTR_ERR(compr->cc); | 198 | return PTR_ERR(compr->cc); |
199 | } | 199 | } |
200 | } | 200 | } |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 4cfb3e82c56f..4c46a9865fa7 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -746,7 +746,7 @@ void ubifs_dump_lprops(struct ubifs_info *c) | |||
746 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { | 746 | for (lnum = c->main_first; lnum < c->leb_cnt; lnum++) { |
747 | err = ubifs_read_one_lp(c, lnum, &lp); | 747 | err = ubifs_read_one_lp(c, lnum, &lp); |
748 | if (err) { | 748 | if (err) { |
749 | ubifs_err("cannot read lprops for LEB %d", lnum); | 749 | ubifs_err(c, "cannot read lprops for LEB %d", lnum); |
750 | continue; | 750 | continue; |
751 | } | 751 | } |
752 | 752 | ||
@@ -819,13 +819,13 @@ void ubifs_dump_leb(const struct ubifs_info *c, int lnum) | |||
819 | 819 | ||
820 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 820 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
821 | if (!buf) { | 821 | if (!buf) { |
822 | ubifs_err("cannot allocate memory for dumping LEB %d", lnum); | 822 | ubifs_err(c, "cannot allocate memory for dumping LEB %d", lnum); |
823 | return; | 823 | return; |
824 | } | 824 | } |
825 | 825 | ||
826 | sleb = ubifs_scan(c, lnum, 0, buf, 0); | 826 | sleb = ubifs_scan(c, lnum, 0, buf, 0); |
827 | if (IS_ERR(sleb)) { | 827 | if (IS_ERR(sleb)) { |
828 | ubifs_err("scan error %d", (int)PTR_ERR(sleb)); | 828 | ubifs_err(c, "scan error %d", (int)PTR_ERR(sleb)); |
829 | goto out; | 829 | goto out; |
830 | } | 830 | } |
831 | 831 | ||
@@ -1032,7 +1032,7 @@ int dbg_check_space_info(struct ubifs_info *c) | |||
1032 | spin_unlock(&c->space_lock); | 1032 | spin_unlock(&c->space_lock); |
1033 | 1033 | ||
1034 | if (free != d->saved_free) { | 1034 | if (free != d->saved_free) { |
1035 | ubifs_err("free space changed from %lld to %lld", | 1035 | ubifs_err(c, "free space changed from %lld to %lld", |
1036 | d->saved_free, free); | 1036 | d->saved_free, free); |
1037 | goto out; | 1037 | goto out; |
1038 | } | 1038 | } |
@@ -1040,15 +1040,15 @@ int dbg_check_space_info(struct ubifs_info *c) | |||
1040 | return 0; | 1040 | return 0; |
1041 | 1041 | ||
1042 | out: | 1042 | out: |
1043 | ubifs_msg("saved lprops statistics dump"); | 1043 | ubifs_msg(c, "saved lprops statistics dump"); |
1044 | ubifs_dump_lstats(&d->saved_lst); | 1044 | ubifs_dump_lstats(&d->saved_lst); |
1045 | ubifs_msg("saved budgeting info dump"); | 1045 | ubifs_msg(c, "saved budgeting info dump"); |
1046 | ubifs_dump_budg(c, &d->saved_bi); | 1046 | ubifs_dump_budg(c, &d->saved_bi); |
1047 | ubifs_msg("saved idx_gc_cnt %d", d->saved_idx_gc_cnt); | 1047 | ubifs_msg(c, "saved idx_gc_cnt %d", d->saved_idx_gc_cnt); |
1048 | ubifs_msg("current lprops statistics dump"); | 1048 | ubifs_msg(c, "current lprops statistics dump"); |
1049 | ubifs_get_lp_stats(c, &lst); | 1049 | ubifs_get_lp_stats(c, &lst); |
1050 | ubifs_dump_lstats(&lst); | 1050 | ubifs_dump_lstats(&lst); |
1051 | ubifs_msg("current budgeting info dump"); | 1051 | ubifs_msg(c, "current budgeting info dump"); |
1052 | ubifs_dump_budg(c, &c->bi); | 1052 | ubifs_dump_budg(c, &c->bi); |
1053 | dump_stack(); | 1053 | dump_stack(); |
1054 | return -EINVAL; | 1054 | return -EINVAL; |
@@ -1077,9 +1077,9 @@ int dbg_check_synced_i_size(const struct ubifs_info *c, struct inode *inode) | |||
1077 | mutex_lock(&ui->ui_mutex); | 1077 | mutex_lock(&ui->ui_mutex); |
1078 | spin_lock(&ui->ui_lock); | 1078 | spin_lock(&ui->ui_lock); |
1079 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { | 1079 | if (ui->ui_size != ui->synced_i_size && !ui->dirty) { |
1080 | ubifs_err("ui_size is %lld, synced_i_size is %lld, but inode is clean", | 1080 | ubifs_err(c, "ui_size is %lld, synced_i_size is %lld, but inode is clean", |
1081 | ui->ui_size, ui->synced_i_size); | 1081 | ui->ui_size, ui->synced_i_size); |
1082 | ubifs_err("i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, | 1082 | ubifs_err(c, "i_ino %lu, i_mode %#x, i_size %lld", inode->i_ino, |
1083 | inode->i_mode, i_size_read(inode)); | 1083 | inode->i_mode, i_size_read(inode)); |
1084 | dump_stack(); | 1084 | dump_stack(); |
1085 | err = -EINVAL; | 1085 | err = -EINVAL; |
@@ -1140,7 +1140,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1140 | kfree(pdent); | 1140 | kfree(pdent); |
1141 | 1141 | ||
1142 | if (i_size_read(dir) != size) { | 1142 | if (i_size_read(dir) != size) { |
1143 | ubifs_err("directory inode %lu has size %llu, but calculated size is %llu", | 1143 | ubifs_err(c, "directory inode %lu has size %llu, but calculated size is %llu", |
1144 | dir->i_ino, (unsigned long long)i_size_read(dir), | 1144 | dir->i_ino, (unsigned long long)i_size_read(dir), |
1145 | (unsigned long long)size); | 1145 | (unsigned long long)size); |
1146 | ubifs_dump_inode(c, dir); | 1146 | ubifs_dump_inode(c, dir); |
@@ -1148,7 +1148,7 @@ int dbg_check_dir(struct ubifs_info *c, const struct inode *dir) | |||
1148 | return -EINVAL; | 1148 | return -EINVAL; |
1149 | } | 1149 | } |
1150 | if (dir->i_nlink != nlink) { | 1150 | if (dir->i_nlink != nlink) { |
1151 | ubifs_err("directory inode %lu has nlink %u, but calculated nlink is %u", | 1151 | ubifs_err(c, "directory inode %lu has nlink %u, but calculated nlink is %u", |
1152 | dir->i_ino, dir->i_nlink, nlink); | 1152 | dir->i_ino, dir->i_nlink, nlink); |
1153 | ubifs_dump_inode(c, dir); | 1153 | ubifs_dump_inode(c, dir); |
1154 | dump_stack(); | 1154 | dump_stack(); |
@@ -1207,10 +1207,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1207 | err = 1; | 1207 | err = 1; |
1208 | key_read(c, &dent1->key, &key); | 1208 | key_read(c, &dent1->key, &key); |
1209 | if (keys_cmp(c, &zbr1->key, &key)) { | 1209 | if (keys_cmp(c, &zbr1->key, &key)) { |
1210 | ubifs_err("1st entry at %d:%d has key %s", zbr1->lnum, | 1210 | ubifs_err(c, "1st entry at %d:%d has key %s", zbr1->lnum, |
1211 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1211 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1212 | DBG_KEY_BUF_LEN)); | 1212 | DBG_KEY_BUF_LEN)); |
1213 | ubifs_err("but it should have key %s according to tnc", | 1213 | ubifs_err(c, "but it should have key %s according to tnc", |
1214 | dbg_snprintf_key(c, &zbr1->key, key_buf, | 1214 | dbg_snprintf_key(c, &zbr1->key, key_buf, |
1215 | DBG_KEY_BUF_LEN)); | 1215 | DBG_KEY_BUF_LEN)); |
1216 | ubifs_dump_node(c, dent1); | 1216 | ubifs_dump_node(c, dent1); |
@@ -1219,10 +1219,10 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1219 | 1219 | ||
1220 | key_read(c, &dent2->key, &key); | 1220 | key_read(c, &dent2->key, &key); |
1221 | if (keys_cmp(c, &zbr2->key, &key)) { | 1221 | if (keys_cmp(c, &zbr2->key, &key)) { |
1222 | ubifs_err("2nd entry at %d:%d has key %s", zbr1->lnum, | 1222 | ubifs_err(c, "2nd entry at %d:%d has key %s", zbr1->lnum, |
1223 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, | 1223 | zbr1->offs, dbg_snprintf_key(c, &key, key_buf, |
1224 | DBG_KEY_BUF_LEN)); | 1224 | DBG_KEY_BUF_LEN)); |
1225 | ubifs_err("but it should have key %s according to tnc", | 1225 | ubifs_err(c, "but it should have key %s according to tnc", |
1226 | dbg_snprintf_key(c, &zbr2->key, key_buf, | 1226 | dbg_snprintf_key(c, &zbr2->key, key_buf, |
1227 | DBG_KEY_BUF_LEN)); | 1227 | DBG_KEY_BUF_LEN)); |
1228 | ubifs_dump_node(c, dent2); | 1228 | ubifs_dump_node(c, dent2); |
@@ -1238,14 +1238,14 @@ static int dbg_check_key_order(struct ubifs_info *c, struct ubifs_zbranch *zbr1, | |||
1238 | goto out_free; | 1238 | goto out_free; |
1239 | } | 1239 | } |
1240 | if (cmp == 0 && nlen1 == nlen2) | 1240 | if (cmp == 0 && nlen1 == nlen2) |
1241 | ubifs_err("2 xent/dent nodes with the same name"); | 1241 | ubifs_err(c, "2 xent/dent nodes with the same name"); |
1242 | else | 1242 | else |
1243 | ubifs_err("bad order of colliding key %s", | 1243 | ubifs_err(c, "bad order of colliding key %s", |
1244 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); | 1244 | dbg_snprintf_key(c, &key, key_buf, DBG_KEY_BUF_LEN)); |
1245 | 1245 | ||
1246 | ubifs_msg("first node at %d:%d\n", zbr1->lnum, zbr1->offs); | 1246 | ubifs_msg(c, "first node at %d:%d\n", zbr1->lnum, zbr1->offs); |
1247 | ubifs_dump_node(c, dent1); | 1247 | ubifs_dump_node(c, dent1); |
1248 | ubifs_msg("second node at %d:%d\n", zbr2->lnum, zbr2->offs); | 1248 | ubifs_msg(c, "second node at %d:%d\n", zbr2->lnum, zbr2->offs); |
1249 | ubifs_dump_node(c, dent2); | 1249 | ubifs_dump_node(c, dent2); |
1250 | 1250 | ||
1251 | out_free: | 1251 | out_free: |
@@ -1447,11 +1447,11 @@ static int dbg_check_znode(struct ubifs_info *c, struct ubifs_zbranch *zbr) | |||
1447 | return 0; | 1447 | return 0; |
1448 | 1448 | ||
1449 | out: | 1449 | out: |
1450 | ubifs_err("failed, error %d", err); | 1450 | ubifs_err(c, "failed, error %d", err); |
1451 | ubifs_msg("dump of the znode"); | 1451 | ubifs_msg(c, "dump of the znode"); |
1452 | ubifs_dump_znode(c, znode); | 1452 | ubifs_dump_znode(c, znode); |
1453 | if (zp) { | 1453 | if (zp) { |
1454 | ubifs_msg("dump of the parent znode"); | 1454 | ubifs_msg(c, "dump of the parent znode"); |
1455 | ubifs_dump_znode(c, zp); | 1455 | ubifs_dump_znode(c, zp); |
1456 | } | 1456 | } |
1457 | dump_stack(); | 1457 | dump_stack(); |
@@ -1518,9 +1518,9 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1518 | if (err < 0) | 1518 | if (err < 0) |
1519 | return err; | 1519 | return err; |
1520 | if (err) { | 1520 | if (err) { |
1521 | ubifs_msg("first znode"); | 1521 | ubifs_msg(c, "first znode"); |
1522 | ubifs_dump_znode(c, prev); | 1522 | ubifs_dump_znode(c, prev); |
1523 | ubifs_msg("second znode"); | 1523 | ubifs_msg(c, "second znode"); |
1524 | ubifs_dump_znode(c, znode); | 1524 | ubifs_dump_znode(c, znode); |
1525 | return -EINVAL; | 1525 | return -EINVAL; |
1526 | } | 1526 | } |
@@ -1529,13 +1529,13 @@ int dbg_check_tnc(struct ubifs_info *c, int extra) | |||
1529 | 1529 | ||
1530 | if (extra) { | 1530 | if (extra) { |
1531 | if (clean_cnt != atomic_long_read(&c->clean_zn_cnt)) { | 1531 | if (clean_cnt != atomic_long_read(&c->clean_zn_cnt)) { |
1532 | ubifs_err("incorrect clean_zn_cnt %ld, calculated %ld", | 1532 | ubifs_err(c, "incorrect clean_zn_cnt %ld, calculated %ld", |
1533 | atomic_long_read(&c->clean_zn_cnt), | 1533 | atomic_long_read(&c->clean_zn_cnt), |
1534 | clean_cnt); | 1534 | clean_cnt); |
1535 | return -EINVAL; | 1535 | return -EINVAL; |
1536 | } | 1536 | } |
1537 | if (dirty_cnt != atomic_long_read(&c->dirty_zn_cnt)) { | 1537 | if (dirty_cnt != atomic_long_read(&c->dirty_zn_cnt)) { |
1538 | ubifs_err("incorrect dirty_zn_cnt %ld, calculated %ld", | 1538 | ubifs_err(c, "incorrect dirty_zn_cnt %ld, calculated %ld", |
1539 | atomic_long_read(&c->dirty_zn_cnt), | 1539 | atomic_long_read(&c->dirty_zn_cnt), |
1540 | dirty_cnt); | 1540 | dirty_cnt); |
1541 | return -EINVAL; | 1541 | return -EINVAL; |
@@ -1608,7 +1608,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1608 | if (znode_cb) { | 1608 | if (znode_cb) { |
1609 | err = znode_cb(c, znode, priv); | 1609 | err = znode_cb(c, znode, priv); |
1610 | if (err) { | 1610 | if (err) { |
1611 | ubifs_err("znode checking function returned error %d", | 1611 | ubifs_err(c, "znode checking function returned error %d", |
1612 | err); | 1612 | err); |
1613 | ubifs_dump_znode(c, znode); | 1613 | ubifs_dump_znode(c, znode); |
1614 | goto out_dump; | 1614 | goto out_dump; |
@@ -1619,7 +1619,7 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb, | |||
1619 | zbr = &znode->zbranch[idx]; | 1619 | zbr = &znode->zbranch[idx]; |
1620 | err = leaf_cb(c, zbr, priv); | 1620 | err = leaf_cb(c, zbr, priv); |
1621 | if (err) { | 1621 | if (err) { |
1622 | ubifs_err("leaf checking function returned error %d, for leaf at LEB %d:%d", | 1622 | ubifs_err(c, "leaf checking function returned error %d, for leaf at LEB %d:%d", |
1623 | err, zbr->lnum, zbr->offs); | 1623 | err, zbr->lnum, zbr->offs); |
1624 | goto out_dump; | 1624 | goto out_dump; |
1625 | } | 1625 | } |
@@ -1675,7 +1675,7 @@ out_dump: | |||
1675 | zbr = &znode->parent->zbranch[znode->iip]; | 1675 | zbr = &znode->parent->zbranch[znode->iip]; |
1676 | else | 1676 | else |
1677 | zbr = &c->zroot; | 1677 | zbr = &c->zroot; |
1678 | ubifs_msg("dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); | 1678 | ubifs_msg(c, "dump of znode at LEB %d:%d", zbr->lnum, zbr->offs); |
1679 | ubifs_dump_znode(c, znode); | 1679 | ubifs_dump_znode(c, znode); |
1680 | out_unlock: | 1680 | out_unlock: |
1681 | mutex_unlock(&c->tnc_mutex); | 1681 | mutex_unlock(&c->tnc_mutex); |
@@ -1722,12 +1722,12 @@ int dbg_check_idx_size(struct ubifs_info *c, long long idx_size) | |||
1722 | 1722 | ||
1723 | err = dbg_walk_index(c, NULL, add_size, &calc); | 1723 | err = dbg_walk_index(c, NULL, add_size, &calc); |
1724 | if (err) { | 1724 | if (err) { |
1725 | ubifs_err("error %d while walking the index", err); | 1725 | ubifs_err(c, "error %d while walking the index", err); |
1726 | return err; | 1726 | return err; |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | if (calc != idx_size) { | 1729 | if (calc != idx_size) { |
1730 | ubifs_err("index size check failed: calculated size is %lld, should be %lld", | 1730 | ubifs_err(c, "index size check failed: calculated size is %lld, should be %lld", |
1731 | calc, idx_size); | 1731 | calc, idx_size); |
1732 | dump_stack(); | 1732 | dump_stack(); |
1733 | return -EINVAL; | 1733 | return -EINVAL; |
@@ -1814,7 +1814,7 @@ static struct fsck_inode *add_inode(struct ubifs_info *c, | |||
1814 | } | 1814 | } |
1815 | 1815 | ||
1816 | if (inum > c->highest_inum) { | 1816 | if (inum > c->highest_inum) { |
1817 | ubifs_err("too high inode number, max. is %lu", | 1817 | ubifs_err(c, "too high inode number, max. is %lu", |
1818 | (unsigned long)c->highest_inum); | 1818 | (unsigned long)c->highest_inum); |
1819 | return ERR_PTR(-EINVAL); | 1819 | return ERR_PTR(-EINVAL); |
1820 | } | 1820 | } |
@@ -1921,17 +1921,17 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1921 | ino_key_init(c, &key, inum); | 1921 | ino_key_init(c, &key, inum); |
1922 | err = ubifs_lookup_level0(c, &key, &znode, &n); | 1922 | err = ubifs_lookup_level0(c, &key, &znode, &n); |
1923 | if (!err) { | 1923 | if (!err) { |
1924 | ubifs_err("inode %lu not found in index", (unsigned long)inum); | 1924 | ubifs_err(c, "inode %lu not found in index", (unsigned long)inum); |
1925 | return ERR_PTR(-ENOENT); | 1925 | return ERR_PTR(-ENOENT); |
1926 | } else if (err < 0) { | 1926 | } else if (err < 0) { |
1927 | ubifs_err("error %d while looking up inode %lu", | 1927 | ubifs_err(c, "error %d while looking up inode %lu", |
1928 | err, (unsigned long)inum); | 1928 | err, (unsigned long)inum); |
1929 | return ERR_PTR(err); | 1929 | return ERR_PTR(err); |
1930 | } | 1930 | } |
1931 | 1931 | ||
1932 | zbr = &znode->zbranch[n]; | 1932 | zbr = &znode->zbranch[n]; |
1933 | if (zbr->len < UBIFS_INO_NODE_SZ) { | 1933 | if (zbr->len < UBIFS_INO_NODE_SZ) { |
1934 | ubifs_err("bad node %lu node length %d", | 1934 | ubifs_err(c, "bad node %lu node length %d", |
1935 | (unsigned long)inum, zbr->len); | 1935 | (unsigned long)inum, zbr->len); |
1936 | return ERR_PTR(-EINVAL); | 1936 | return ERR_PTR(-EINVAL); |
1937 | } | 1937 | } |
@@ -1942,7 +1942,7 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1942 | 1942 | ||
1943 | err = ubifs_tnc_read_node(c, zbr, ino); | 1943 | err = ubifs_tnc_read_node(c, zbr, ino); |
1944 | if (err) { | 1944 | if (err) { |
1945 | ubifs_err("cannot read inode node at LEB %d:%d, error %d", | 1945 | ubifs_err(c, "cannot read inode node at LEB %d:%d, error %d", |
1946 | zbr->lnum, zbr->offs, err); | 1946 | zbr->lnum, zbr->offs, err); |
1947 | kfree(ino); | 1947 | kfree(ino); |
1948 | return ERR_PTR(err); | 1948 | return ERR_PTR(err); |
@@ -1951,7 +1951,7 @@ static struct fsck_inode *read_add_inode(struct ubifs_info *c, | |||
1951 | fscki = add_inode(c, fsckd, ino); | 1951 | fscki = add_inode(c, fsckd, ino); |
1952 | kfree(ino); | 1952 | kfree(ino); |
1953 | if (IS_ERR(fscki)) { | 1953 | if (IS_ERR(fscki)) { |
1954 | ubifs_err("error %ld while adding inode %lu node", | 1954 | ubifs_err(c, "error %ld while adding inode %lu node", |
1955 | PTR_ERR(fscki), (unsigned long)inum); | 1955 | PTR_ERR(fscki), (unsigned long)inum); |
1956 | return fscki; | 1956 | return fscki; |
1957 | } | 1957 | } |
@@ -1985,7 +1985,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
1985 | struct fsck_inode *fscki; | 1985 | struct fsck_inode *fscki; |
1986 | 1986 | ||
1987 | if (zbr->len < UBIFS_CH_SZ) { | 1987 | if (zbr->len < UBIFS_CH_SZ) { |
1988 | ubifs_err("bad leaf length %d (LEB %d:%d)", | 1988 | ubifs_err(c, "bad leaf length %d (LEB %d:%d)", |
1989 | zbr->len, zbr->lnum, zbr->offs); | 1989 | zbr->len, zbr->lnum, zbr->offs); |
1990 | return -EINVAL; | 1990 | return -EINVAL; |
1991 | } | 1991 | } |
@@ -1996,7 +1996,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
1996 | 1996 | ||
1997 | err = ubifs_tnc_read_node(c, zbr, node); | 1997 | err = ubifs_tnc_read_node(c, zbr, node); |
1998 | if (err) { | 1998 | if (err) { |
1999 | ubifs_err("cannot read leaf node at LEB %d:%d, error %d", | 1999 | ubifs_err(c, "cannot read leaf node at LEB %d:%d, error %d", |
2000 | zbr->lnum, zbr->offs, err); | 2000 | zbr->lnum, zbr->offs, err); |
2001 | goto out_free; | 2001 | goto out_free; |
2002 | } | 2002 | } |
@@ -2006,7 +2006,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2006 | fscki = add_inode(c, priv, node); | 2006 | fscki = add_inode(c, priv, node); |
2007 | if (IS_ERR(fscki)) { | 2007 | if (IS_ERR(fscki)) { |
2008 | err = PTR_ERR(fscki); | 2008 | err = PTR_ERR(fscki); |
2009 | ubifs_err("error %d while adding inode node", err); | 2009 | ubifs_err(c, "error %d while adding inode node", err); |
2010 | goto out_dump; | 2010 | goto out_dump; |
2011 | } | 2011 | } |
2012 | goto out; | 2012 | goto out; |
@@ -2014,7 +2014,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2014 | 2014 | ||
2015 | if (type != UBIFS_DENT_KEY && type != UBIFS_XENT_KEY && | 2015 | if (type != UBIFS_DENT_KEY && type != UBIFS_XENT_KEY && |
2016 | type != UBIFS_DATA_KEY) { | 2016 | type != UBIFS_DATA_KEY) { |
2017 | ubifs_err("unexpected node type %d at LEB %d:%d", | 2017 | ubifs_err(c, "unexpected node type %d at LEB %d:%d", |
2018 | type, zbr->lnum, zbr->offs); | 2018 | type, zbr->lnum, zbr->offs); |
2019 | err = -EINVAL; | 2019 | err = -EINVAL; |
2020 | goto out_free; | 2020 | goto out_free; |
@@ -2022,7 +2022,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2022 | 2022 | ||
2023 | ch = node; | 2023 | ch = node; |
2024 | if (le64_to_cpu(ch->sqnum) > c->max_sqnum) { | 2024 | if (le64_to_cpu(ch->sqnum) > c->max_sqnum) { |
2025 | ubifs_err("too high sequence number, max. is %llu", | 2025 | ubifs_err(c, "too high sequence number, max. is %llu", |
2026 | c->max_sqnum); | 2026 | c->max_sqnum); |
2027 | err = -EINVAL; | 2027 | err = -EINVAL; |
2028 | goto out_dump; | 2028 | goto out_dump; |
@@ -2042,7 +2042,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2042 | fscki = read_add_inode(c, priv, inum); | 2042 | fscki = read_add_inode(c, priv, inum); |
2043 | if (IS_ERR(fscki)) { | 2043 | if (IS_ERR(fscki)) { |
2044 | err = PTR_ERR(fscki); | 2044 | err = PTR_ERR(fscki); |
2045 | ubifs_err("error %d while processing data node and trying to find inode node %lu", | 2045 | ubifs_err(c, "error %d while processing data node and trying to find inode node %lu", |
2046 | err, (unsigned long)inum); | 2046 | err, (unsigned long)inum); |
2047 | goto out_dump; | 2047 | goto out_dump; |
2048 | } | 2048 | } |
@@ -2052,7 +2052,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2052 | blk_offs <<= UBIFS_BLOCK_SHIFT; | 2052 | blk_offs <<= UBIFS_BLOCK_SHIFT; |
2053 | blk_offs += le32_to_cpu(dn->size); | 2053 | blk_offs += le32_to_cpu(dn->size); |
2054 | if (blk_offs > fscki->size) { | 2054 | if (blk_offs > fscki->size) { |
2055 | ubifs_err("data node at LEB %d:%d is not within inode size %lld", | 2055 | ubifs_err(c, "data node at LEB %d:%d is not within inode size %lld", |
2056 | zbr->lnum, zbr->offs, fscki->size); | 2056 | zbr->lnum, zbr->offs, fscki->size); |
2057 | err = -EINVAL; | 2057 | err = -EINVAL; |
2058 | goto out_dump; | 2058 | goto out_dump; |
@@ -2076,7 +2076,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2076 | fscki = read_add_inode(c, priv, inum); | 2076 | fscki = read_add_inode(c, priv, inum); |
2077 | if (IS_ERR(fscki)) { | 2077 | if (IS_ERR(fscki)) { |
2078 | err = PTR_ERR(fscki); | 2078 | err = PTR_ERR(fscki); |
2079 | ubifs_err("error %d while processing entry node and trying to find inode node %lu", | 2079 | ubifs_err(c, "error %d while processing entry node and trying to find inode node %lu", |
2080 | err, (unsigned long)inum); | 2080 | err, (unsigned long)inum); |
2081 | goto out_dump; | 2081 | goto out_dump; |
2082 | } | 2082 | } |
@@ -2088,7 +2088,7 @@ static int check_leaf(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
2088 | fscki1 = read_add_inode(c, priv, inum); | 2088 | fscki1 = read_add_inode(c, priv, inum); |
2089 | if (IS_ERR(fscki1)) { | 2089 | if (IS_ERR(fscki1)) { |
2090 | err = PTR_ERR(fscki1); | 2090 | err = PTR_ERR(fscki1); |
2091 | ubifs_err("error %d while processing entry node and trying to find parent inode node %lu", | 2091 | ubifs_err(c, "error %d while processing entry node and trying to find parent inode node %lu", |
2092 | err, (unsigned long)inum); | 2092 | err, (unsigned long)inum); |
2093 | goto out_dump; | 2093 | goto out_dump; |
2094 | } | 2094 | } |
@@ -2111,7 +2111,7 @@ out: | |||
2111 | return 0; | 2111 | return 0; |
2112 | 2112 | ||
2113 | out_dump: | 2113 | out_dump: |
2114 | ubifs_msg("dump of node at LEB %d:%d", zbr->lnum, zbr->offs); | 2114 | ubifs_msg(c, "dump of node at LEB %d:%d", zbr->lnum, zbr->offs); |
2115 | ubifs_dump_node(c, node); | 2115 | ubifs_dump_node(c, node); |
2116 | out_free: | 2116 | out_free: |
2117 | kfree(node); | 2117 | kfree(node); |
@@ -2162,52 +2162,52 @@ static int check_inodes(struct ubifs_info *c, struct fsck_data *fsckd) | |||
2162 | */ | 2162 | */ |
2163 | if (fscki->inum != UBIFS_ROOT_INO && | 2163 | if (fscki->inum != UBIFS_ROOT_INO && |
2164 | fscki->references != 1) { | 2164 | fscki->references != 1) { |
2165 | ubifs_err("directory inode %lu has %d direntries which refer it, but should be 1", | 2165 | ubifs_err(c, "directory inode %lu has %d direntries which refer it, but should be 1", |
2166 | (unsigned long)fscki->inum, | 2166 | (unsigned long)fscki->inum, |
2167 | fscki->references); | 2167 | fscki->references); |
2168 | goto out_dump; | 2168 | goto out_dump; |
2169 | } | 2169 | } |
2170 | if (fscki->inum == UBIFS_ROOT_INO && | 2170 | if (fscki->inum == UBIFS_ROOT_INO && |
2171 | fscki->references != 0) { | 2171 | fscki->references != 0) { |
2172 | ubifs_err("root inode %lu has non-zero (%d) direntries which refer it", | 2172 | ubifs_err(c, "root inode %lu has non-zero (%d) direntries which refer it", |
2173 | (unsigned long)fscki->inum, | 2173 | (unsigned long)fscki->inum, |
2174 | fscki->references); | 2174 | fscki->references); |
2175 | goto out_dump; | 2175 | goto out_dump; |
2176 | } | 2176 | } |
2177 | if (fscki->calc_sz != fscki->size) { | 2177 | if (fscki->calc_sz != fscki->size) { |
2178 | ubifs_err("directory inode %lu size is %lld, but calculated size is %lld", | 2178 | ubifs_err(c, "directory inode %lu size is %lld, but calculated size is %lld", |
2179 | (unsigned long)fscki->inum, | 2179 | (unsigned long)fscki->inum, |
2180 | fscki->size, fscki->calc_sz); | 2180 | fscki->size, fscki->calc_sz); |
2181 | goto out_dump; | 2181 | goto out_dump; |
2182 | } | 2182 | } |
2183 | if (fscki->calc_cnt != fscki->nlink) { | 2183 | if (fscki->calc_cnt != fscki->nlink) { |
2184 | ubifs_err("directory inode %lu nlink is %d, but calculated nlink is %d", | 2184 | ubifs_err(c, "directory inode %lu nlink is %d, but calculated nlink is %d", |
2185 | (unsigned long)fscki->inum, | 2185 | (unsigned long)fscki->inum, |
2186 | fscki->nlink, fscki->calc_cnt); | 2186 | fscki->nlink, fscki->calc_cnt); |
2187 | goto out_dump; | 2187 | goto out_dump; |
2188 | } | 2188 | } |
2189 | } else { | 2189 | } else { |
2190 | if (fscki->references != fscki->nlink) { | 2190 | if (fscki->references != fscki->nlink) { |
2191 | ubifs_err("inode %lu nlink is %d, but calculated nlink is %d", | 2191 | ubifs_err(c, "inode %lu nlink is %d, but calculated nlink is %d", |
2192 | (unsigned long)fscki->inum, | 2192 | (unsigned long)fscki->inum, |
2193 | fscki->nlink, fscki->references); | 2193 | fscki->nlink, fscki->references); |
2194 | goto out_dump; | 2194 | goto out_dump; |
2195 | } | 2195 | } |
2196 | } | 2196 | } |
2197 | if (fscki->xattr_sz != fscki->calc_xsz) { | 2197 | if (fscki->xattr_sz != fscki->calc_xsz) { |
2198 | ubifs_err("inode %lu has xattr size %u, but calculated size is %lld", | 2198 | ubifs_err(c, "inode %lu has xattr size %u, but calculated size is %lld", |
2199 | (unsigned long)fscki->inum, fscki->xattr_sz, | 2199 | (unsigned long)fscki->inum, fscki->xattr_sz, |
2200 | fscki->calc_xsz); | 2200 | fscki->calc_xsz); |
2201 | goto out_dump; | 2201 | goto out_dump; |
2202 | } | 2202 | } |
2203 | if (fscki->xattr_cnt != fscki->calc_xcnt) { | 2203 | if (fscki->xattr_cnt != fscki->calc_xcnt) { |
2204 | ubifs_err("inode %lu has %u xattrs, but calculated count is %lld", | 2204 | ubifs_err(c, "inode %lu has %u xattrs, but calculated count is %lld", |
2205 | (unsigned long)fscki->inum, | 2205 | (unsigned long)fscki->inum, |
2206 | fscki->xattr_cnt, fscki->calc_xcnt); | 2206 | fscki->xattr_cnt, fscki->calc_xcnt); |
2207 | goto out_dump; | 2207 | goto out_dump; |
2208 | } | 2208 | } |
2209 | if (fscki->xattr_nms != fscki->calc_xnms) { | 2209 | if (fscki->xattr_nms != fscki->calc_xnms) { |
2210 | ubifs_err("inode %lu has xattr names' size %u, but calculated names' size is %lld", | 2210 | ubifs_err(c, "inode %lu has xattr names' size %u, but calculated names' size is %lld", |
2211 | (unsigned long)fscki->inum, fscki->xattr_nms, | 2211 | (unsigned long)fscki->inum, fscki->xattr_nms, |
2212 | fscki->calc_xnms); | 2212 | fscki->calc_xnms); |
2213 | goto out_dump; | 2213 | goto out_dump; |
@@ -2221,11 +2221,11 @@ out_dump: | |||
2221 | ino_key_init(c, &key, fscki->inum); | 2221 | ino_key_init(c, &key, fscki->inum); |
2222 | err = ubifs_lookup_level0(c, &key, &znode, &n); | 2222 | err = ubifs_lookup_level0(c, &key, &znode, &n); |
2223 | if (!err) { | 2223 | if (!err) { |
2224 | ubifs_err("inode %lu not found in index", | 2224 | ubifs_err(c, "inode %lu not found in index", |
2225 | (unsigned long)fscki->inum); | 2225 | (unsigned long)fscki->inum); |
2226 | return -ENOENT; | 2226 | return -ENOENT; |
2227 | } else if (err < 0) { | 2227 | } else if (err < 0) { |
2228 | ubifs_err("error %d while looking up inode %lu", | 2228 | ubifs_err(c, "error %d while looking up inode %lu", |
2229 | err, (unsigned long)fscki->inum); | 2229 | err, (unsigned long)fscki->inum); |
2230 | return err; | 2230 | return err; |
2231 | } | 2231 | } |
@@ -2237,13 +2237,13 @@ out_dump: | |||
2237 | 2237 | ||
2238 | err = ubifs_tnc_read_node(c, zbr, ino); | 2238 | err = ubifs_tnc_read_node(c, zbr, ino); |
2239 | if (err) { | 2239 | if (err) { |
2240 | ubifs_err("cannot read inode node at LEB %d:%d, error %d", | 2240 | ubifs_err(c, "cannot read inode node at LEB %d:%d, error %d", |
2241 | zbr->lnum, zbr->offs, err); | 2241 | zbr->lnum, zbr->offs, err); |
2242 | kfree(ino); | 2242 | kfree(ino); |
2243 | return err; | 2243 | return err; |
2244 | } | 2244 | } |
2245 | 2245 | ||
2246 | ubifs_msg("dump of the inode %lu sitting in LEB %d:%d", | 2246 | ubifs_msg(c, "dump of the inode %lu sitting in LEB %d:%d", |
2247 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); | 2247 | (unsigned long)fscki->inum, zbr->lnum, zbr->offs); |
2248 | ubifs_dump_node(c, ino); | 2248 | ubifs_dump_node(c, ino); |
2249 | kfree(ino); | 2249 | kfree(ino); |
@@ -2284,7 +2284,7 @@ int dbg_check_filesystem(struct ubifs_info *c) | |||
2284 | return 0; | 2284 | return 0; |
2285 | 2285 | ||
2286 | out_free: | 2286 | out_free: |
2287 | ubifs_err("file-system check failed with error %d", err); | 2287 | ubifs_err(c, "file-system check failed with error %d", err); |
2288 | dump_stack(); | 2288 | dump_stack(); |
2289 | free_inodes(&fsckd); | 2289 | free_inodes(&fsckd); |
2290 | return err; | 2290 | return err; |
@@ -2315,12 +2315,12 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2315 | sb = container_of(cur->next, struct ubifs_scan_node, list); | 2315 | sb = container_of(cur->next, struct ubifs_scan_node, list); |
2316 | 2316 | ||
2317 | if (sa->type != UBIFS_DATA_NODE) { | 2317 | if (sa->type != UBIFS_DATA_NODE) { |
2318 | ubifs_err("bad node type %d", sa->type); | 2318 | ubifs_err(c, "bad node type %d", sa->type); |
2319 | ubifs_dump_node(c, sa->node); | 2319 | ubifs_dump_node(c, sa->node); |
2320 | return -EINVAL; | 2320 | return -EINVAL; |
2321 | } | 2321 | } |
2322 | if (sb->type != UBIFS_DATA_NODE) { | 2322 | if (sb->type != UBIFS_DATA_NODE) { |
2323 | ubifs_err("bad node type %d", sb->type); | 2323 | ubifs_err(c, "bad node type %d", sb->type); |
2324 | ubifs_dump_node(c, sb->node); | 2324 | ubifs_dump_node(c, sb->node); |
2325 | return -EINVAL; | 2325 | return -EINVAL; |
2326 | } | 2326 | } |
@@ -2331,7 +2331,7 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2331 | if (inuma < inumb) | 2331 | if (inuma < inumb) |
2332 | continue; | 2332 | continue; |
2333 | if (inuma > inumb) { | 2333 | if (inuma > inumb) { |
2334 | ubifs_err("larger inum %lu goes before inum %lu", | 2334 | ubifs_err(c, "larger inum %lu goes before inum %lu", |
2335 | (unsigned long)inuma, (unsigned long)inumb); | 2335 | (unsigned long)inuma, (unsigned long)inumb); |
2336 | goto error_dump; | 2336 | goto error_dump; |
2337 | } | 2337 | } |
@@ -2340,11 +2340,11 @@ int dbg_check_data_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2340 | blkb = key_block(c, &sb->key); | 2340 | blkb = key_block(c, &sb->key); |
2341 | 2341 | ||
2342 | if (blka > blkb) { | 2342 | if (blka > blkb) { |
2343 | ubifs_err("larger block %u goes before %u", blka, blkb); | 2343 | ubifs_err(c, "larger block %u goes before %u", blka, blkb); |
2344 | goto error_dump; | 2344 | goto error_dump; |
2345 | } | 2345 | } |
2346 | if (blka == blkb) { | 2346 | if (blka == blkb) { |
2347 | ubifs_err("two data nodes for the same block"); | 2347 | ubifs_err(c, "two data nodes for the same block"); |
2348 | goto error_dump; | 2348 | goto error_dump; |
2349 | } | 2349 | } |
2350 | } | 2350 | } |
@@ -2383,19 +2383,19 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2383 | 2383 | ||
2384 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2384 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2385 | sa->type != UBIFS_XENT_NODE) { | 2385 | sa->type != UBIFS_XENT_NODE) { |
2386 | ubifs_err("bad node type %d", sa->type); | 2386 | ubifs_err(c, "bad node type %d", sa->type); |
2387 | ubifs_dump_node(c, sa->node); | 2387 | ubifs_dump_node(c, sa->node); |
2388 | return -EINVAL; | 2388 | return -EINVAL; |
2389 | } | 2389 | } |
2390 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && | 2390 | if (sa->type != UBIFS_INO_NODE && sa->type != UBIFS_DENT_NODE && |
2391 | sa->type != UBIFS_XENT_NODE) { | 2391 | sa->type != UBIFS_XENT_NODE) { |
2392 | ubifs_err("bad node type %d", sb->type); | 2392 | ubifs_err(c, "bad node type %d", sb->type); |
2393 | ubifs_dump_node(c, sb->node); | 2393 | ubifs_dump_node(c, sb->node); |
2394 | return -EINVAL; | 2394 | return -EINVAL; |
2395 | } | 2395 | } |
2396 | 2396 | ||
2397 | if (sa->type != UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { | 2397 | if (sa->type != UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { |
2398 | ubifs_err("non-inode node goes before inode node"); | 2398 | ubifs_err(c, "non-inode node goes before inode node"); |
2399 | goto error_dump; | 2399 | goto error_dump; |
2400 | } | 2400 | } |
2401 | 2401 | ||
@@ -2405,7 +2405,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2405 | if (sa->type == UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { | 2405 | if (sa->type == UBIFS_INO_NODE && sb->type == UBIFS_INO_NODE) { |
2406 | /* Inode nodes are sorted in descending size order */ | 2406 | /* Inode nodes are sorted in descending size order */ |
2407 | if (sa->len < sb->len) { | 2407 | if (sa->len < sb->len) { |
2408 | ubifs_err("smaller inode node goes first"); | 2408 | ubifs_err(c, "smaller inode node goes first"); |
2409 | goto error_dump; | 2409 | goto error_dump; |
2410 | } | 2410 | } |
2411 | continue; | 2411 | continue; |
@@ -2421,7 +2421,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2421 | if (inuma < inumb) | 2421 | if (inuma < inumb) |
2422 | continue; | 2422 | continue; |
2423 | if (inuma > inumb) { | 2423 | if (inuma > inumb) { |
2424 | ubifs_err("larger inum %lu goes before inum %lu", | 2424 | ubifs_err(c, "larger inum %lu goes before inum %lu", |
2425 | (unsigned long)inuma, (unsigned long)inumb); | 2425 | (unsigned long)inuma, (unsigned long)inumb); |
2426 | goto error_dump; | 2426 | goto error_dump; |
2427 | } | 2427 | } |
@@ -2430,7 +2430,7 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2430 | hashb = key_block(c, &sb->key); | 2430 | hashb = key_block(c, &sb->key); |
2431 | 2431 | ||
2432 | if (hasha > hashb) { | 2432 | if (hasha > hashb) { |
2433 | ubifs_err("larger hash %u goes before %u", | 2433 | ubifs_err(c, "larger hash %u goes before %u", |
2434 | hasha, hashb); | 2434 | hasha, hashb); |
2435 | goto error_dump; | 2435 | goto error_dump; |
2436 | } | 2436 | } |
@@ -2439,9 +2439,9 @@ int dbg_check_nondata_nodes_order(struct ubifs_info *c, struct list_head *head) | |||
2439 | return 0; | 2439 | return 0; |
2440 | 2440 | ||
2441 | error_dump: | 2441 | error_dump: |
2442 | ubifs_msg("dumping first node"); | 2442 | ubifs_msg(c, "dumping first node"); |
2443 | ubifs_dump_node(c, sa->node); | 2443 | ubifs_dump_node(c, sa->node); |
2444 | ubifs_msg("dumping second node"); | 2444 | ubifs_msg(c, "dumping second node"); |
2445 | ubifs_dump_node(c, sb->node); | 2445 | ubifs_dump_node(c, sb->node); |
2446 | return -EINVAL; | 2446 | return -EINVAL; |
2447 | return 0; | 2447 | return 0; |
@@ -2470,13 +2470,13 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2470 | delay = prandom_u32() % 60000; | 2470 | delay = prandom_u32() % 60000; |
2471 | d->pc_timeout = jiffies; | 2471 | d->pc_timeout = jiffies; |
2472 | d->pc_timeout += msecs_to_jiffies(delay); | 2472 | d->pc_timeout += msecs_to_jiffies(delay); |
2473 | ubifs_warn("failing after %lums", delay); | 2473 | ubifs_warn(c, "failing after %lums", delay); |
2474 | } else { | 2474 | } else { |
2475 | d->pc_delay = 2; | 2475 | d->pc_delay = 2; |
2476 | delay = prandom_u32() % 10000; | 2476 | delay = prandom_u32() % 10000; |
2477 | /* Fail within 10000 operations */ | 2477 | /* Fail within 10000 operations */ |
2478 | d->pc_cnt_max = delay; | 2478 | d->pc_cnt_max = delay; |
2479 | ubifs_warn("failing after %lu calls", delay); | 2479 | ubifs_warn(c, "failing after %lu calls", delay); |
2480 | } | 2480 | } |
2481 | } | 2481 | } |
2482 | 2482 | ||
@@ -2494,55 +2494,55 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2494 | return 0; | 2494 | return 0; |
2495 | if (chance(19, 20)) | 2495 | if (chance(19, 20)) |
2496 | return 0; | 2496 | return 0; |
2497 | ubifs_warn("failing in super block LEB %d", lnum); | 2497 | ubifs_warn(c, "failing in super block LEB %d", lnum); |
2498 | } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) { | 2498 | } else if (lnum == UBIFS_MST_LNUM || lnum == UBIFS_MST_LNUM + 1) { |
2499 | if (chance(19, 20)) | 2499 | if (chance(19, 20)) |
2500 | return 0; | 2500 | return 0; |
2501 | ubifs_warn("failing in master LEB %d", lnum); | 2501 | ubifs_warn(c, "failing in master LEB %d", lnum); |
2502 | } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) { | 2502 | } else if (lnum >= UBIFS_LOG_LNUM && lnum <= c->log_last) { |
2503 | if (write && chance(99, 100)) | 2503 | if (write && chance(99, 100)) |
2504 | return 0; | 2504 | return 0; |
2505 | if (chance(399, 400)) | 2505 | if (chance(399, 400)) |
2506 | return 0; | 2506 | return 0; |
2507 | ubifs_warn("failing in log LEB %d", lnum); | 2507 | ubifs_warn(c, "failing in log LEB %d", lnum); |
2508 | } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) { | 2508 | } else if (lnum >= c->lpt_first && lnum <= c->lpt_last) { |
2509 | if (write && chance(7, 8)) | 2509 | if (write && chance(7, 8)) |
2510 | return 0; | 2510 | return 0; |
2511 | if (chance(19, 20)) | 2511 | if (chance(19, 20)) |
2512 | return 0; | 2512 | return 0; |
2513 | ubifs_warn("failing in LPT LEB %d", lnum); | 2513 | ubifs_warn(c, "failing in LPT LEB %d", lnum); |
2514 | } else if (lnum >= c->orph_first && lnum <= c->orph_last) { | 2514 | } else if (lnum >= c->orph_first && lnum <= c->orph_last) { |
2515 | if (write && chance(1, 2)) | 2515 | if (write && chance(1, 2)) |
2516 | return 0; | 2516 | return 0; |
2517 | if (chance(9, 10)) | 2517 | if (chance(9, 10)) |
2518 | return 0; | 2518 | return 0; |
2519 | ubifs_warn("failing in orphan LEB %d", lnum); | 2519 | ubifs_warn(c, "failing in orphan LEB %d", lnum); |
2520 | } else if (lnum == c->ihead_lnum) { | 2520 | } else if (lnum == c->ihead_lnum) { |
2521 | if (chance(99, 100)) | 2521 | if (chance(99, 100)) |
2522 | return 0; | 2522 | return 0; |
2523 | ubifs_warn("failing in index head LEB %d", lnum); | 2523 | ubifs_warn(c, "failing in index head LEB %d", lnum); |
2524 | } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) { | 2524 | } else if (c->jheads && lnum == c->jheads[GCHD].wbuf.lnum) { |
2525 | if (chance(9, 10)) | 2525 | if (chance(9, 10)) |
2526 | return 0; | 2526 | return 0; |
2527 | ubifs_warn("failing in GC head LEB %d", lnum); | 2527 | ubifs_warn(c, "failing in GC head LEB %d", lnum); |
2528 | } else if (write && !RB_EMPTY_ROOT(&c->buds) && | 2528 | } else if (write && !RB_EMPTY_ROOT(&c->buds) && |
2529 | !ubifs_search_bud(c, lnum)) { | 2529 | !ubifs_search_bud(c, lnum)) { |
2530 | if (chance(19, 20)) | 2530 | if (chance(19, 20)) |
2531 | return 0; | 2531 | return 0; |
2532 | ubifs_warn("failing in non-bud LEB %d", lnum); | 2532 | ubifs_warn(c, "failing in non-bud LEB %d", lnum); |
2533 | } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND || | 2533 | } else if (c->cmt_state == COMMIT_RUNNING_BACKGROUND || |
2534 | c->cmt_state == COMMIT_RUNNING_REQUIRED) { | 2534 | c->cmt_state == COMMIT_RUNNING_REQUIRED) { |
2535 | if (chance(999, 1000)) | 2535 | if (chance(999, 1000)) |
2536 | return 0; | 2536 | return 0; |
2537 | ubifs_warn("failing in bud LEB %d commit running", lnum); | 2537 | ubifs_warn(c, "failing in bud LEB %d commit running", lnum); |
2538 | } else { | 2538 | } else { |
2539 | if (chance(9999, 10000)) | 2539 | if (chance(9999, 10000)) |
2540 | return 0; | 2540 | return 0; |
2541 | ubifs_warn("failing in bud LEB %d commit not running", lnum); | 2541 | ubifs_warn(c, "failing in bud LEB %d commit not running", lnum); |
2542 | } | 2542 | } |
2543 | 2543 | ||
2544 | d->pc_happened = 1; | 2544 | d->pc_happened = 1; |
2545 | ubifs_warn("========== Power cut emulated =========="); | 2545 | ubifs_warn(c, "========== Power cut emulated =========="); |
2546 | dump_stack(); | 2546 | dump_stack(); |
2547 | return 1; | 2547 | return 1; |
2548 | } | 2548 | } |
@@ -2557,7 +2557,7 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf, | |||
2557 | /* Corruption span max to end of write unit */ | 2557 | /* Corruption span max to end of write unit */ |
2558 | to = min(len, ALIGN(from + 1, c->max_write_size)); | 2558 | to = min(len, ALIGN(from + 1, c->max_write_size)); |
2559 | 2559 | ||
2560 | ubifs_warn("filled bytes %u-%u with %s", from, to - 1, | 2560 | ubifs_warn(c, "filled bytes %u-%u with %s", from, to - 1, |
2561 | ffs ? "0xFFs" : "random data"); | 2561 | ffs ? "0xFFs" : "random data"); |
2562 | 2562 | ||
2563 | if (ffs) | 2563 | if (ffs) |
@@ -2579,7 +2579,7 @@ int dbg_leb_write(struct ubifs_info *c, int lnum, const void *buf, | |||
2579 | failing = power_cut_emulated(c, lnum, 1); | 2579 | failing = power_cut_emulated(c, lnum, 1); |
2580 | if (failing) { | 2580 | if (failing) { |
2581 | len = corrupt_data(c, buf, len); | 2581 | len = corrupt_data(c, buf, len); |
2582 | ubifs_warn("actually write %d bytes to LEB %d:%d (the buffer was corrupted)", | 2582 | ubifs_warn(c, "actually write %d bytes to LEB %d:%d (the buffer was corrupted)", |
2583 | len, lnum, offs); | 2583 | len, lnum, offs); |
2584 | } | 2584 | } |
2585 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); | 2585 | err = ubi_leb_write(c->ubi, lnum, buf, offs, len); |
@@ -2909,7 +2909,7 @@ out_remove: | |||
2909 | debugfs_remove_recursive(d->dfs_dir); | 2909 | debugfs_remove_recursive(d->dfs_dir); |
2910 | out: | 2910 | out: |
2911 | err = dent ? PTR_ERR(dent) : -ENODEV; | 2911 | err = dent ? PTR_ERR(dent) : -ENODEV; |
2912 | ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n", | 2912 | ubifs_err(c, "cannot create \"%s\" debugfs file or directory, error %d\n", |
2913 | fname, err); | 2913 | fname, err); |
2914 | return err; | 2914 | return err; |
2915 | } | 2915 | } |
@@ -3063,8 +3063,8 @@ out_remove: | |||
3063 | debugfs_remove_recursive(dfs_rootdir); | 3063 | debugfs_remove_recursive(dfs_rootdir); |
3064 | out: | 3064 | out: |
3065 | err = dent ? PTR_ERR(dent) : -ENODEV; | 3065 | err = dent ? PTR_ERR(dent) : -ENODEV; |
3066 | ubifs_err("cannot create \"%s\" debugfs file or directory, error %d\n", | 3066 | pr_err("UBIFS error (pid %d): cannot create \"%s\" debugfs file or directory, error %d\n", |
3067 | fname, err); | 3067 | current->pid, fname, err); |
3068 | return err; | 3068 | return err; |
3069 | } | 3069 | } |
3070 | 3070 | ||
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 5b24bc42cad9..90fe60c2f112 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -146,12 +146,12 @@ struct inode *ubifs_new_inode(struct ubifs_info *c, const struct inode *dir, | |||
146 | if (c->highest_inum >= INUM_WARN_WATERMARK) { | 146 | if (c->highest_inum >= INUM_WARN_WATERMARK) { |
147 | if (c->highest_inum >= INUM_WATERMARK) { | 147 | if (c->highest_inum >= INUM_WATERMARK) { |
148 | spin_unlock(&c->cnt_lock); | 148 | spin_unlock(&c->cnt_lock); |
149 | ubifs_err("out of inode numbers"); | 149 | ubifs_err(c, "out of inode numbers"); |
150 | make_bad_inode(inode); | 150 | make_bad_inode(inode); |
151 | iput(inode); | 151 | iput(inode); |
152 | return ERR_PTR(-EINVAL); | 152 | return ERR_PTR(-EINVAL); |
153 | } | 153 | } |
154 | ubifs_warn("running out of inode numbers (current %lu, max %d)", | 154 | ubifs_warn(c, "running out of inode numbers (current %lu, max %d)", |
155 | (unsigned long)c->highest_inum, INUM_WATERMARK); | 155 | (unsigned long)c->highest_inum, INUM_WATERMARK); |
156 | } | 156 | } |
157 | 157 | ||
@@ -222,7 +222,7 @@ static struct dentry *ubifs_lookup(struct inode *dir, struct dentry *dentry, | |||
222 | * checking. | 222 | * checking. |
223 | */ | 223 | */ |
224 | err = PTR_ERR(inode); | 224 | err = PTR_ERR(inode); |
225 | ubifs_err("dead directory entry '%pd', error %d", | 225 | ubifs_err(c, "dead directory entry '%pd', error %d", |
226 | dentry, err); | 226 | dentry, err); |
227 | ubifs_ro_mode(c, err); | 227 | ubifs_ro_mode(c, err); |
228 | goto out; | 228 | goto out; |
@@ -297,7 +297,7 @@ out_inode: | |||
297 | iput(inode); | 297 | iput(inode); |
298 | out_budg: | 298 | out_budg: |
299 | ubifs_release_budget(c, &req); | 299 | ubifs_release_budget(c, &req); |
300 | ubifs_err("cannot create regular file, error %d", err); | 300 | ubifs_err(c, "cannot create regular file, error %d", err); |
301 | return err; | 301 | return err; |
302 | } | 302 | } |
303 | 303 | ||
@@ -450,7 +450,7 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) | |||
450 | 450 | ||
451 | out: | 451 | out: |
452 | if (err != -ENOENT) { | 452 | if (err != -ENOENT) { |
453 | ubifs_err("cannot find next direntry, error %d", err); | 453 | ubifs_err(c, "cannot find next direntry, error %d", err); |
454 | return err; | 454 | return err; |
455 | } | 455 | } |
456 | 456 | ||
@@ -744,7 +744,7 @@ static int ubifs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) | |||
744 | dir->i_mtime = dir->i_ctime = inode->i_ctime; | 744 | dir->i_mtime = dir->i_ctime = inode->i_ctime; |
745 | err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); | 745 | err = ubifs_jnl_update(c, dir, &dentry->d_name, inode, 0, 0); |
746 | if (err) { | 746 | if (err) { |
747 | ubifs_err("cannot create directory, error %d", err); | 747 | ubifs_err(c, "cannot create directory, error %d", err); |
748 | goto out_cancel; | 748 | goto out_cancel; |
749 | } | 749 | } |
750 | mutex_unlock(&dir_ui->ui_mutex); | 750 | mutex_unlock(&dir_ui->ui_mutex); |
diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index e627c0acf626..9cd12976ed1b 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c | |||
@@ -80,7 +80,7 @@ static int read_block(struct inode *inode, void *addr, unsigned int block, | |||
80 | 80 | ||
81 | dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; | 81 | dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; |
82 | out_len = UBIFS_BLOCK_SIZE; | 82 | out_len = UBIFS_BLOCK_SIZE; |
83 | err = ubifs_decompress(&dn->data, dlen, addr, &out_len, | 83 | err = ubifs_decompress(c, &dn->data, dlen, addr, &out_len, |
84 | le16_to_cpu(dn->compr_type)); | 84 | le16_to_cpu(dn->compr_type)); |
85 | if (err || len != out_len) | 85 | if (err || len != out_len) |
86 | goto dump; | 86 | goto dump; |
@@ -96,7 +96,7 @@ static int read_block(struct inode *inode, void *addr, unsigned int block, | |||
96 | return 0; | 96 | return 0; |
97 | 97 | ||
98 | dump: | 98 | dump: |
99 | ubifs_err("bad data node (block %u, inode %lu)", | 99 | ubifs_err(c, "bad data node (block %u, inode %lu)", |
100 | block, inode->i_ino); | 100 | block, inode->i_ino); |
101 | ubifs_dump_node(c, dn); | 101 | ubifs_dump_node(c, dn); |
102 | return -EINVAL; | 102 | return -EINVAL; |
@@ -161,13 +161,14 @@ static int do_readpage(struct page *page) | |||
161 | addr += UBIFS_BLOCK_SIZE; | 161 | addr += UBIFS_BLOCK_SIZE; |
162 | } | 162 | } |
163 | if (err) { | 163 | if (err) { |
164 | struct ubifs_info *c = inode->i_sb->s_fs_info; | ||
164 | if (err == -ENOENT) { | 165 | if (err == -ENOENT) { |
165 | /* Not found, so it must be a hole */ | 166 | /* Not found, so it must be a hole */ |
166 | SetPageChecked(page); | 167 | SetPageChecked(page); |
167 | dbg_gen("hole"); | 168 | dbg_gen("hole"); |
168 | goto out_free; | 169 | goto out_free; |
169 | } | 170 | } |
170 | ubifs_err("cannot read page %lu of inode %lu, error %d", | 171 | ubifs_err(c, "cannot read page %lu of inode %lu, error %d", |
171 | page->index, inode->i_ino, err); | 172 | page->index, inode->i_ino, err); |
172 | goto error; | 173 | goto error; |
173 | } | 174 | } |
@@ -650,7 +651,7 @@ static int populate_page(struct ubifs_info *c, struct page *page, | |||
650 | 651 | ||
651 | dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; | 652 | dlen = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; |
652 | out_len = UBIFS_BLOCK_SIZE; | 653 | out_len = UBIFS_BLOCK_SIZE; |
653 | err = ubifs_decompress(&dn->data, dlen, addr, &out_len, | 654 | err = ubifs_decompress(c, &dn->data, dlen, addr, &out_len, |
654 | le16_to_cpu(dn->compr_type)); | 655 | le16_to_cpu(dn->compr_type)); |
655 | if (err || len != out_len) | 656 | if (err || len != out_len) |
656 | goto out_err; | 657 | goto out_err; |
@@ -698,7 +699,7 @@ out_err: | |||
698 | SetPageError(page); | 699 | SetPageError(page); |
699 | flush_dcache_page(page); | 700 | flush_dcache_page(page); |
700 | kunmap(page); | 701 | kunmap(page); |
701 | ubifs_err("bad data node (block %u, inode %lu)", | 702 | ubifs_err(c, "bad data node (block %u, inode %lu)", |
702 | page_block, inode->i_ino); | 703 | page_block, inode->i_ino); |
703 | return -EINVAL; | 704 | return -EINVAL; |
704 | } | 705 | } |
@@ -802,7 +803,7 @@ out_free: | |||
802 | return ret; | 803 | return ret; |
803 | 804 | ||
804 | out_warn: | 805 | out_warn: |
805 | ubifs_warn("ignoring error %d and skipping bulk-read", err); | 806 | ubifs_warn(c, "ignoring error %d and skipping bulk-read", err); |
806 | goto out_free; | 807 | goto out_free; |
807 | 808 | ||
808 | out_bu_off: | 809 | out_bu_off: |
@@ -930,7 +931,7 @@ static int do_writepage(struct page *page, int len) | |||
930 | } | 931 | } |
931 | if (err) { | 932 | if (err) { |
932 | SetPageError(page); | 933 | SetPageError(page); |
933 | ubifs_err("cannot write page %lu of inode %lu, error %d", | 934 | ubifs_err(c, "cannot write page %lu of inode %lu, error %d", |
934 | page->index, inode->i_ino, err); | 935 | page->index, inode->i_ino, err); |
935 | ubifs_ro_mode(c, err); | 936 | ubifs_ro_mode(c, err); |
936 | } | 937 | } |
@@ -1485,7 +1486,7 @@ static int ubifs_vm_page_mkwrite(struct vm_area_struct *vma, | |||
1485 | err = ubifs_budget_space(c, &req); | 1486 | err = ubifs_budget_space(c, &req); |
1486 | if (unlikely(err)) { | 1487 | if (unlikely(err)) { |
1487 | if (err == -ENOSPC) | 1488 | if (err == -ENOSPC) |
1488 | ubifs_warn("out of space for mmapped file (inode number %lu)", | 1489 | ubifs_warn(c, "out of space for mmapped file (inode number %lu)", |
1489 | inode->i_ino); | 1490 | inode->i_ino); |
1490 | return VM_FAULT_SIGBUS; | 1491 | return VM_FAULT_SIGBUS; |
1491 | } | 1492 | } |
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index fb08b0c514b6..97be41215332 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -85,7 +85,7 @@ void ubifs_ro_mode(struct ubifs_info *c, int err) | |||
85 | c->ro_error = 1; | 85 | c->ro_error = 1; |
86 | c->no_chk_data_crc = 0; | 86 | c->no_chk_data_crc = 0; |
87 | c->vfs_sb->s_flags |= MS_RDONLY; | 87 | c->vfs_sb->s_flags |= MS_RDONLY; |
88 | ubifs_warn("switched to read-only mode, error %d", err); | 88 | ubifs_warn(c, "switched to read-only mode, error %d", err); |
89 | dump_stack(); | 89 | dump_stack(); |
90 | } | 90 | } |
91 | } | 91 | } |
@@ -107,7 +107,7 @@ int ubifs_leb_read(const struct ubifs_info *c, int lnum, void *buf, int offs, | |||
107 | * @even_ebadmsg is true. | 107 | * @even_ebadmsg is true. |
108 | */ | 108 | */ |
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(c, "reading %d bytes from LEB %d:%d failed, error %d", |
111 | len, lnum, offs, err); | 111 | len, lnum, offs, err); |
112 | dump_stack(); | 112 | dump_stack(); |
113 | } | 113 | } |
@@ -127,7 +127,7 @@ int ubifs_leb_write(struct ubifs_info *c, int lnum, const void *buf, int offs, | |||
127 | else | 127 | else |
128 | err = dbg_leb_write(c, lnum, buf, offs, len); | 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(c, "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 | dump_stack(); | 133 | dump_stack(); |
@@ -147,7 +147,7 @@ int ubifs_leb_change(struct ubifs_info *c, int lnum, const void *buf, int len) | |||
147 | else | 147 | else |
148 | err = dbg_leb_change(c, lnum, buf, len); | 148 | err = dbg_leb_change(c, lnum, buf, len); |
149 | if (err) { | 149 | if (err) { |
150 | ubifs_err("changing %d bytes in LEB %d failed, error %d", | 150 | ubifs_err(c, "changing %d bytes in LEB %d failed, error %d", |
151 | len, lnum, err); | 151 | len, lnum, err); |
152 | ubifs_ro_mode(c, err); | 152 | ubifs_ro_mode(c, err); |
153 | dump_stack(); | 153 | dump_stack(); |
@@ -167,7 +167,7 @@ int ubifs_leb_unmap(struct ubifs_info *c, int lnum) | |||
167 | else | 167 | else |
168 | err = dbg_leb_unmap(c, lnum); | 168 | err = dbg_leb_unmap(c, lnum); |
169 | if (err) { | 169 | if (err) { |
170 | ubifs_err("unmap LEB %d failed, error %d", lnum, err); | 170 | ubifs_err(c, "unmap LEB %d failed, error %d", lnum, err); |
171 | ubifs_ro_mode(c, err); | 171 | ubifs_ro_mode(c, err); |
172 | dump_stack(); | 172 | dump_stack(); |
173 | } | 173 | } |
@@ -186,7 +186,7 @@ int ubifs_leb_map(struct ubifs_info *c, int lnum) | |||
186 | else | 186 | else |
187 | err = dbg_leb_map(c, lnum); | 187 | err = dbg_leb_map(c, lnum); |
188 | if (err) { | 188 | if (err) { |
189 | ubifs_err("mapping LEB %d failed, error %d", lnum, err); | 189 | ubifs_err(c, "mapping LEB %d failed, error %d", lnum, err); |
190 | ubifs_ro_mode(c, err); | 190 | ubifs_ro_mode(c, err); |
191 | dump_stack(); | 191 | dump_stack(); |
192 | } | 192 | } |
@@ -199,7 +199,7 @@ int ubifs_is_mapped(const struct ubifs_info *c, int lnum) | |||
199 | 199 | ||
200 | err = ubi_is_mapped(c->ubi, lnum); | 200 | err = ubi_is_mapped(c->ubi, lnum); |
201 | if (err < 0) { | 201 | if (err < 0) { |
202 | ubifs_err("ubi_is_mapped failed for LEB %d, error %d", | 202 | ubifs_err(c, "ubi_is_mapped failed for LEB %d, error %d", |
203 | lnum, err); | 203 | lnum, err); |
204 | dump_stack(); | 204 | dump_stack(); |
205 | } | 205 | } |
@@ -247,7 +247,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
247 | magic = le32_to_cpu(ch->magic); | 247 | magic = le32_to_cpu(ch->magic); |
248 | if (magic != UBIFS_NODE_MAGIC) { | 248 | if (magic != UBIFS_NODE_MAGIC) { |
249 | if (!quiet) | 249 | if (!quiet) |
250 | ubifs_err("bad magic %#08x, expected %#08x", | 250 | ubifs_err(c, "bad magic %#08x, expected %#08x", |
251 | magic, UBIFS_NODE_MAGIC); | 251 | magic, UBIFS_NODE_MAGIC); |
252 | err = -EUCLEAN; | 252 | err = -EUCLEAN; |
253 | goto out; | 253 | goto out; |
@@ -256,7 +256,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
256 | type = ch->node_type; | 256 | type = ch->node_type; |
257 | if (type < 0 || type >= UBIFS_NODE_TYPES_CNT) { | 257 | if (type < 0 || type >= UBIFS_NODE_TYPES_CNT) { |
258 | if (!quiet) | 258 | if (!quiet) |
259 | ubifs_err("bad node type %d", type); | 259 | ubifs_err(c, "bad node type %d", type); |
260 | goto out; | 260 | goto out; |
261 | } | 261 | } |
262 | 262 | ||
@@ -279,7 +279,7 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
279 | node_crc = le32_to_cpu(ch->crc); | 279 | node_crc = le32_to_cpu(ch->crc); |
280 | if (crc != node_crc) { | 280 | if (crc != node_crc) { |
281 | if (!quiet) | 281 | if (!quiet) |
282 | ubifs_err("bad CRC: calculated %#08x, read %#08x", | 282 | ubifs_err(c, "bad CRC: calculated %#08x, read %#08x", |
283 | crc, node_crc); | 283 | crc, node_crc); |
284 | err = -EUCLEAN; | 284 | err = -EUCLEAN; |
285 | goto out; | 285 | goto out; |
@@ -289,10 +289,10 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum, | |||
289 | 289 | ||
290 | out_len: | 290 | out_len: |
291 | if (!quiet) | 291 | if (!quiet) |
292 | ubifs_err("bad node length %d", node_len); | 292 | ubifs_err(c, "bad node length %d", node_len); |
293 | out: | 293 | out: |
294 | if (!quiet) { | 294 | if (!quiet) { |
295 | ubifs_err("bad node at LEB %d:%d", lnum, offs); | 295 | ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); |
296 | ubifs_dump_node(c, buf); | 296 | ubifs_dump_node(c, buf); |
297 | dump_stack(); | 297 | dump_stack(); |
298 | } | 298 | } |
@@ -355,11 +355,11 @@ static unsigned long long next_sqnum(struct ubifs_info *c) | |||
355 | 355 | ||
356 | if (unlikely(sqnum >= SQNUM_WARN_WATERMARK)) { | 356 | if (unlikely(sqnum >= SQNUM_WARN_WATERMARK)) { |
357 | if (sqnum >= SQNUM_WATERMARK) { | 357 | if (sqnum >= SQNUM_WATERMARK) { |
358 | ubifs_err("sequence number overflow %llu, end of life", | 358 | ubifs_err(c, "sequence number overflow %llu, end of life", |
359 | sqnum); | 359 | sqnum); |
360 | ubifs_ro_mode(c, -EINVAL); | 360 | ubifs_ro_mode(c, -EINVAL); |
361 | } | 361 | } |
362 | ubifs_warn("running out of sequence numbers, end of life soon"); | 362 | ubifs_warn(c, "running out of sequence numbers, end of life soon"); |
363 | } | 363 | } |
364 | 364 | ||
365 | return sqnum; | 365 | return sqnum; |
@@ -636,7 +636,7 @@ int ubifs_bg_wbufs_sync(struct ubifs_info *c) | |||
636 | err = ubifs_wbuf_sync_nolock(wbuf); | 636 | err = ubifs_wbuf_sync_nolock(wbuf); |
637 | mutex_unlock(&wbuf->io_mutex); | 637 | mutex_unlock(&wbuf->io_mutex); |
638 | if (err) { | 638 | if (err) { |
639 | ubifs_err("cannot sync write-buffer, error %d", err); | 639 | ubifs_err(c, "cannot sync write-buffer, error %d", err); |
640 | ubifs_ro_mode(c, err); | 640 | ubifs_ro_mode(c, err); |
641 | goto out_timers; | 641 | goto out_timers; |
642 | } | 642 | } |
@@ -833,7 +833,7 @@ exit: | |||
833 | return 0; | 833 | return 0; |
834 | 834 | ||
835 | out: | 835 | out: |
836 | ubifs_err("cannot write %d bytes to LEB %d:%d, error %d", | 836 | ubifs_err(c, "cannot write %d bytes to LEB %d:%d, error %d", |
837 | len, wbuf->lnum, wbuf->offs, err); | 837 | len, wbuf->lnum, wbuf->offs, err); |
838 | ubifs_dump_node(c, buf); | 838 | ubifs_dump_node(c, buf); |
839 | dump_stack(); | 839 | dump_stack(); |
@@ -932,27 +932,27 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | |||
932 | } | 932 | } |
933 | 933 | ||
934 | if (type != ch->node_type) { | 934 | if (type != ch->node_type) { |
935 | ubifs_err("bad node type (%d but expected %d)", | 935 | ubifs_err(c, "bad node type (%d but expected %d)", |
936 | ch->node_type, type); | 936 | ch->node_type, type); |
937 | goto out; | 937 | goto out; |
938 | } | 938 | } |
939 | 939 | ||
940 | err = ubifs_check_node(c, buf, lnum, offs, 0, 0); | 940 | err = ubifs_check_node(c, buf, lnum, offs, 0, 0); |
941 | if (err) { | 941 | if (err) { |
942 | ubifs_err("expected node type %d", type); | 942 | ubifs_err(c, "expected node type %d", type); |
943 | return err; | 943 | return err; |
944 | } | 944 | } |
945 | 945 | ||
946 | rlen = le32_to_cpu(ch->len); | 946 | rlen = le32_to_cpu(ch->len); |
947 | if (rlen != len) { | 947 | if (rlen != len) { |
948 | ubifs_err("bad node length %d, expected %d", rlen, len); | 948 | ubifs_err(c, "bad node length %d, expected %d", rlen, len); |
949 | goto out; | 949 | goto out; |
950 | } | 950 | } |
951 | 951 | ||
952 | return 0; | 952 | return 0; |
953 | 953 | ||
954 | out: | 954 | out: |
955 | ubifs_err("bad node at LEB %d:%d", lnum, offs); | 955 | ubifs_err(c, "bad node at LEB %d:%d", lnum, offs); |
956 | ubifs_dump_node(c, buf); | 956 | ubifs_dump_node(c, buf); |
957 | dump_stack(); | 957 | dump_stack(); |
958 | return -EINVAL; | 958 | return -EINVAL; |
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 648b143606cc..3c7b29de0ca7 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c | |||
@@ -138,7 +138,7 @@ static int setflags(struct inode *inode, int flags) | |||
138 | return err; | 138 | return err; |
139 | 139 | ||
140 | out_unlock: | 140 | out_unlock: |
141 | ubifs_err("can't modify inode %lu attributes", inode->i_ino); | 141 | ubifs_err(c, "can't modify inode %lu attributes", inode->i_ino); |
142 | mutex_unlock(&ui->ui_mutex); | 142 | mutex_unlock(&ui->ui_mutex); |
143 | ubifs_release_budget(c, &req); | 143 | ubifs_release_budget(c, &req); |
144 | return err; | 144 | return err; |
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c index f6ac3f29323c..90ae1a8439d9 100644 --- a/fs/ubifs/journal.c +++ b/fs/ubifs/journal.c | |||
@@ -363,11 +363,11 @@ again: | |||
363 | * This should not happen unless the journal size limitations | 363 | * This should not happen unless the journal size limitations |
364 | * are too tough. | 364 | * are too tough. |
365 | */ | 365 | */ |
366 | ubifs_err("stuck in space allocation"); | 366 | ubifs_err(c, "stuck in space allocation"); |
367 | err = -ENOSPC; | 367 | err = -ENOSPC; |
368 | goto out; | 368 | goto out; |
369 | } else if (cmt_retries > 32) | 369 | } else if (cmt_retries > 32) |
370 | ubifs_warn("too many space allocation re-tries (%d)", | 370 | ubifs_warn(c, "too many space allocation re-tries (%d)", |
371 | cmt_retries); | 371 | cmt_retries); |
372 | 372 | ||
373 | dbg_jnl("-EAGAIN, commit and retry (retried %d times)", | 373 | dbg_jnl("-EAGAIN, commit and retry (retried %d times)", |
@@ -380,7 +380,7 @@ again: | |||
380 | goto again; | 380 | goto again; |
381 | 381 | ||
382 | out: | 382 | out: |
383 | ubifs_err("cannot reserve %d bytes in jhead %d, error %d", | 383 | ubifs_err(c, "cannot reserve %d bytes in jhead %d, error %d", |
384 | len, jhead, err); | 384 | len, jhead, err); |
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 */ |
@@ -731,7 +731,7 @@ int ubifs_jnl_write_data(struct ubifs_info *c, const struct inode *inode, | |||
731 | compr_type = ui->compr_type; | 731 | compr_type = ui->compr_type; |
732 | 732 | ||
733 | out_len = dlen - UBIFS_DATA_NODE_SZ; | 733 | out_len = dlen - UBIFS_DATA_NODE_SZ; |
734 | ubifs_compress(buf, len, &data->data, &out_len, &compr_type); | 734 | ubifs_compress(c, buf, len, &data->data, &out_len, &compr_type); |
735 | ubifs_assert(out_len <= UBIFS_BLOCK_SIZE); | 735 | ubifs_assert(out_len <= UBIFS_BLOCK_SIZE); |
736 | 736 | ||
737 | dlen = UBIFS_DATA_NODE_SZ + out_len; | 737 | dlen = UBIFS_DATA_NODE_SZ + out_len; |
@@ -1100,7 +1100,8 @@ out_free: | |||
1100 | * This function is used when an inode is truncated and the last data node of | 1100 | * This function is used when an inode is truncated and the last data node of |
1101 | * the inode has to be re-compressed and re-written. | 1101 | * the inode has to be re-compressed and re-written. |
1102 | */ | 1102 | */ |
1103 | static int recomp_data_node(struct ubifs_data_node *dn, int *new_len) | 1103 | static int recomp_data_node(const struct ubifs_info *c, |
1104 | struct ubifs_data_node *dn, int *new_len) | ||
1104 | { | 1105 | { |
1105 | void *buf; | 1106 | void *buf; |
1106 | int err, len, compr_type, out_len; | 1107 | int err, len, compr_type, out_len; |
@@ -1112,11 +1113,11 @@ static int recomp_data_node(struct ubifs_data_node *dn, int *new_len) | |||
1112 | 1113 | ||
1113 | len = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; | 1114 | len = le32_to_cpu(dn->ch.len) - UBIFS_DATA_NODE_SZ; |
1114 | compr_type = le16_to_cpu(dn->compr_type); | 1115 | compr_type = le16_to_cpu(dn->compr_type); |
1115 | err = ubifs_decompress(&dn->data, len, buf, &out_len, compr_type); | 1116 | err = ubifs_decompress(c, &dn->data, len, buf, &out_len, compr_type); |
1116 | if (err) | 1117 | if (err) |
1117 | goto out; | 1118 | goto out; |
1118 | 1119 | ||
1119 | ubifs_compress(buf, *new_len, &dn->data, &out_len, &compr_type); | 1120 | ubifs_compress(c, buf, *new_len, &dn->data, &out_len, &compr_type); |
1120 | ubifs_assert(out_len <= UBIFS_BLOCK_SIZE); | 1121 | ubifs_assert(out_len <= UBIFS_BLOCK_SIZE); |
1121 | dn->compr_type = cpu_to_le16(compr_type); | 1122 | dn->compr_type = cpu_to_le16(compr_type); |
1122 | dn->size = cpu_to_le32(*new_len); | 1123 | dn->size = cpu_to_le32(*new_len); |
@@ -1191,7 +1192,7 @@ int ubifs_jnl_truncate(struct ubifs_info *c, const struct inode *inode, | |||
1191 | int compr_type = le16_to_cpu(dn->compr_type); | 1192 | int compr_type = le16_to_cpu(dn->compr_type); |
1192 | 1193 | ||
1193 | if (compr_type != UBIFS_COMPR_NONE) { | 1194 | if (compr_type != UBIFS_COMPR_NONE) { |
1194 | err = recomp_data_node(dn, &dlen); | 1195 | err = recomp_data_node(c, dn, &dlen); |
1195 | if (err) | 1196 | if (err) |
1196 | goto out_free; | 1197 | goto out_free; |
1197 | } else { | 1198 | } else { |
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index c14628fbeee2..8c795e6392b1 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c | |||
@@ -696,7 +696,7 @@ int ubifs_consolidate_log(struct ubifs_info *c) | |||
696 | destroy_done_tree(&done_tree); | 696 | destroy_done_tree(&done_tree); |
697 | vfree(buf); | 697 | vfree(buf); |
698 | if (write_lnum == c->lhead_lnum) { | 698 | if (write_lnum == c->lhead_lnum) { |
699 | ubifs_err("log is too full"); | 699 | ubifs_err(c, "log is too full"); |
700 | return -EINVAL; | 700 | return -EINVAL; |
701 | } | 701 | } |
702 | /* Unmap remaining LEBs */ | 702 | /* Unmap remaining LEBs */ |
@@ -743,7 +743,7 @@ static int dbg_check_bud_bytes(struct ubifs_info *c) | |||
743 | bud_bytes += c->leb_size - bud->start; | 743 | bud_bytes += c->leb_size - bud->start; |
744 | 744 | ||
745 | if (c->bud_bytes != bud_bytes) { | 745 | if (c->bud_bytes != bud_bytes) { |
746 | ubifs_err("bad bud_bytes %lld, calculated %lld", | 746 | ubifs_err(c, "bad bud_bytes %lld, calculated %lld", |
747 | c->bud_bytes, bud_bytes); | 747 | c->bud_bytes, bud_bytes); |
748 | err = -EINVAL; | 748 | err = -EINVAL; |
749 | } | 749 | } |
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 46190a7c42a6..a0011aa3a779 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c | |||
@@ -682,7 +682,7 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, | |||
682 | out: | 682 | out: |
683 | ubifs_release_lprops(c); | 683 | ubifs_release_lprops(c); |
684 | if (err) | 684 | if (err) |
685 | ubifs_err("cannot change properties of LEB %d, error %d", | 685 | ubifs_err(c, "cannot change properties of LEB %d, error %d", |
686 | lnum, err); | 686 | lnum, err); |
687 | return err; | 687 | return err; |
688 | } | 688 | } |
@@ -721,7 +721,7 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty, | |||
721 | out: | 721 | out: |
722 | ubifs_release_lprops(c); | 722 | ubifs_release_lprops(c); |
723 | if (err) | 723 | if (err) |
724 | ubifs_err("cannot update properties of LEB %d, error %d", | 724 | ubifs_err(c, "cannot update properties of LEB %d, error %d", |
725 | lnum, err); | 725 | lnum, err); |
726 | return err; | 726 | return err; |
727 | } | 727 | } |
@@ -746,7 +746,7 @@ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp) | |||
746 | lpp = ubifs_lpt_lookup(c, lnum); | 746 | lpp = ubifs_lpt_lookup(c, lnum); |
747 | if (IS_ERR(lpp)) { | 747 | if (IS_ERR(lpp)) { |
748 | err = PTR_ERR(lpp); | 748 | err = PTR_ERR(lpp); |
749 | ubifs_err("cannot read properties of LEB %d, error %d", | 749 | ubifs_err(c, "cannot read properties of LEB %d, error %d", |
750 | lnum, err); | 750 | lnum, err); |
751 | goto out; | 751 | goto out; |
752 | } | 752 | } |
@@ -873,13 +873,13 @@ int dbg_check_cats(struct ubifs_info *c) | |||
873 | 873 | ||
874 | list_for_each_entry(lprops, &c->empty_list, list) { | 874 | list_for_each_entry(lprops, &c->empty_list, list) { |
875 | if (lprops->free != c->leb_size) { | 875 | if (lprops->free != c->leb_size) { |
876 | ubifs_err("non-empty LEB %d on empty list (free %d dirty %d flags %d)", | 876 | ubifs_err(c, "non-empty LEB %d on empty list (free %d dirty %d flags %d)", |
877 | lprops->lnum, lprops->free, lprops->dirty, | 877 | lprops->lnum, lprops->free, lprops->dirty, |
878 | lprops->flags); | 878 | lprops->flags); |
879 | return -EINVAL; | 879 | return -EINVAL; |
880 | } | 880 | } |
881 | if (lprops->flags & LPROPS_TAKEN) { | 881 | if (lprops->flags & LPROPS_TAKEN) { |
882 | ubifs_err("taken LEB %d on empty list (free %d dirty %d flags %d)", | 882 | ubifs_err(c, "taken LEB %d on empty list (free %d dirty %d flags %d)", |
883 | lprops->lnum, lprops->free, lprops->dirty, | 883 | lprops->lnum, lprops->free, lprops->dirty, |
884 | lprops->flags); | 884 | lprops->flags); |
885 | return -EINVAL; | 885 | return -EINVAL; |
@@ -889,13 +889,13 @@ int dbg_check_cats(struct ubifs_info *c) | |||
889 | i = 0; | 889 | i = 0; |
890 | list_for_each_entry(lprops, &c->freeable_list, list) { | 890 | list_for_each_entry(lprops, &c->freeable_list, list) { |
891 | if (lprops->free + lprops->dirty != c->leb_size) { | 891 | if (lprops->free + lprops->dirty != c->leb_size) { |
892 | ubifs_err("non-freeable LEB %d on freeable list (free %d dirty %d flags %d)", | 892 | ubifs_err(c, "non-freeable LEB %d on freeable list (free %d dirty %d flags %d)", |
893 | lprops->lnum, lprops->free, lprops->dirty, | 893 | lprops->lnum, lprops->free, lprops->dirty, |
894 | lprops->flags); | 894 | lprops->flags); |
895 | return -EINVAL; | 895 | return -EINVAL; |
896 | } | 896 | } |
897 | if (lprops->flags & LPROPS_TAKEN) { | 897 | if (lprops->flags & LPROPS_TAKEN) { |
898 | ubifs_err("taken LEB %d on freeable list (free %d dirty %d flags %d)", | 898 | ubifs_err(c, "taken LEB %d on freeable list (free %d dirty %d flags %d)", |
899 | lprops->lnum, lprops->free, lprops->dirty, | 899 | lprops->lnum, lprops->free, lprops->dirty, |
900 | lprops->flags); | 900 | lprops->flags); |
901 | return -EINVAL; | 901 | return -EINVAL; |
@@ -903,7 +903,7 @@ int dbg_check_cats(struct ubifs_info *c) | |||
903 | i += 1; | 903 | i += 1; |
904 | } | 904 | } |
905 | if (i != c->freeable_cnt) { | 905 | if (i != c->freeable_cnt) { |
906 | ubifs_err("freeable list count %d expected %d", i, | 906 | ubifs_err(c, "freeable list count %d expected %d", i, |
907 | c->freeable_cnt); | 907 | c->freeable_cnt); |
908 | return -EINVAL; | 908 | return -EINVAL; |
909 | } | 909 | } |
@@ -912,26 +912,26 @@ int dbg_check_cats(struct ubifs_info *c) | |||
912 | list_for_each(pos, &c->idx_gc) | 912 | list_for_each(pos, &c->idx_gc) |
913 | i += 1; | 913 | i += 1; |
914 | if (i != c->idx_gc_cnt) { | 914 | if (i != c->idx_gc_cnt) { |
915 | ubifs_err("idx_gc list count %d expected %d", i, | 915 | ubifs_err(c, "idx_gc list count %d expected %d", i, |
916 | c->idx_gc_cnt); | 916 | c->idx_gc_cnt); |
917 | return -EINVAL; | 917 | return -EINVAL; |
918 | } | 918 | } |
919 | 919 | ||
920 | list_for_each_entry(lprops, &c->frdi_idx_list, list) { | 920 | list_for_each_entry(lprops, &c->frdi_idx_list, list) { |
921 | if (lprops->free + lprops->dirty != c->leb_size) { | 921 | if (lprops->free + lprops->dirty != c->leb_size) { |
922 | ubifs_err("non-freeable LEB %d on frdi_idx list (free %d dirty %d flags %d)", | 922 | ubifs_err(c, "non-freeable LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
923 | lprops->lnum, lprops->free, lprops->dirty, | 923 | lprops->lnum, lprops->free, lprops->dirty, |
924 | lprops->flags); | 924 | lprops->flags); |
925 | return -EINVAL; | 925 | return -EINVAL; |
926 | } | 926 | } |
927 | if (lprops->flags & LPROPS_TAKEN) { | 927 | if (lprops->flags & LPROPS_TAKEN) { |
928 | ubifs_err("taken LEB %d on frdi_idx list (free %d dirty %d flags %d)", | 928 | ubifs_err(c, "taken LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
929 | lprops->lnum, lprops->free, lprops->dirty, | 929 | lprops->lnum, lprops->free, lprops->dirty, |
930 | lprops->flags); | 930 | lprops->flags); |
931 | return -EINVAL; | 931 | return -EINVAL; |
932 | } | 932 | } |
933 | if (!(lprops->flags & LPROPS_INDEX)) { | 933 | if (!(lprops->flags & LPROPS_INDEX)) { |
934 | ubifs_err("non-index LEB %d on frdi_idx list (free %d dirty %d flags %d)", | 934 | ubifs_err(c, "non-index LEB %d on frdi_idx list (free %d dirty %d flags %d)", |
935 | lprops->lnum, lprops->free, lprops->dirty, | 935 | lprops->lnum, lprops->free, lprops->dirty, |
936 | lprops->flags); | 936 | lprops->flags); |
937 | return -EINVAL; | 937 | return -EINVAL; |
@@ -944,15 +944,15 @@ int dbg_check_cats(struct ubifs_info *c) | |||
944 | for (i = 0; i < heap->cnt; i++) { | 944 | for (i = 0; i < heap->cnt; i++) { |
945 | lprops = heap->arr[i]; | 945 | lprops = heap->arr[i]; |
946 | if (!lprops) { | 946 | if (!lprops) { |
947 | ubifs_err("null ptr in LPT heap cat %d", cat); | 947 | ubifs_err(c, "null ptr in LPT heap cat %d", cat); |
948 | return -EINVAL; | 948 | return -EINVAL; |
949 | } | 949 | } |
950 | if (lprops->hpos != i) { | 950 | if (lprops->hpos != i) { |
951 | ubifs_err("bad ptr in LPT heap cat %d", cat); | 951 | ubifs_err(c, "bad ptr in LPT heap cat %d", cat); |
952 | return -EINVAL; | 952 | return -EINVAL; |
953 | } | 953 | } |
954 | if (lprops->flags & LPROPS_TAKEN) { | 954 | if (lprops->flags & LPROPS_TAKEN) { |
955 | ubifs_err("taken LEB in LPT heap cat %d", cat); | 955 | ubifs_err(c, "taken LEB in LPT heap cat %d", cat); |
956 | return -EINVAL; | 956 | return -EINVAL; |
957 | } | 957 | } |
958 | } | 958 | } |
@@ -988,7 +988,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
988 | goto out; | 988 | goto out; |
989 | } | 989 | } |
990 | if (lprops != lp) { | 990 | if (lprops != lp) { |
991 | ubifs_err("lprops %zx lp %zx lprops->lnum %d lp->lnum %d", | 991 | ubifs_err(c, "lprops %zx lp %zx lprops->lnum %d lp->lnum %d", |
992 | (size_t)lprops, (size_t)lp, lprops->lnum, | 992 | (size_t)lprops, (size_t)lp, lprops->lnum, |
993 | lp->lnum); | 993 | lp->lnum); |
994 | err = 4; | 994 | err = 4; |
@@ -1008,7 +1008,7 @@ void dbg_check_heap(struct ubifs_info *c, struct ubifs_lpt_heap *heap, int cat, | |||
1008 | } | 1008 | } |
1009 | out: | 1009 | out: |
1010 | if (err) { | 1010 | if (err) { |
1011 | ubifs_err("failed cat %d hpos %d err %d", cat, i, err); | 1011 | ubifs_err(c, "failed cat %d hpos %d err %d", cat, i, err); |
1012 | dump_stack(); | 1012 | dump_stack(); |
1013 | ubifs_dump_heap(c, heap, cat); | 1013 | ubifs_dump_heap(c, heap, cat); |
1014 | } | 1014 | } |
@@ -1039,7 +1039,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1039 | if (cat != LPROPS_UNCAT) { | 1039 | if (cat != LPROPS_UNCAT) { |
1040 | cat = ubifs_categorize_lprops(c, lp); | 1040 | cat = ubifs_categorize_lprops(c, lp); |
1041 | if (cat != (lp->flags & LPROPS_CAT_MASK)) { | 1041 | if (cat != (lp->flags & LPROPS_CAT_MASK)) { |
1042 | ubifs_err("bad LEB category %d expected %d", | 1042 | ubifs_err(c, "bad LEB category %d expected %d", |
1043 | (lp->flags & LPROPS_CAT_MASK), cat); | 1043 | (lp->flags & LPROPS_CAT_MASK), cat); |
1044 | return -EINVAL; | 1044 | return -EINVAL; |
1045 | } | 1045 | } |
@@ -1074,7 +1074,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1074 | } | 1074 | } |
1075 | } | 1075 | } |
1076 | if (!found) { | 1076 | if (!found) { |
1077 | ubifs_err("bad LPT list (category %d)", cat); | 1077 | ubifs_err(c, "bad LPT list (category %d)", cat); |
1078 | return -EINVAL; | 1078 | return -EINVAL; |
1079 | } | 1079 | } |
1080 | } | 1080 | } |
@@ -1086,7 +1086,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1086 | 1086 | ||
1087 | if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || | 1087 | if ((lp->hpos != -1 && heap->arr[lp->hpos]->lnum != lnum) || |
1088 | lp != heap->arr[lp->hpos]) { | 1088 | lp != heap->arr[lp->hpos]) { |
1089 | ubifs_err("bad LPT heap (category %d)", cat); | 1089 | ubifs_err(c, "bad LPT heap (category %d)", cat); |
1090 | return -EINVAL; | 1090 | return -EINVAL; |
1091 | } | 1091 | } |
1092 | } | 1092 | } |
@@ -1133,7 +1133,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1133 | is_idx = (snod->type == UBIFS_IDX_NODE) ? 1 : 0; | 1133 | is_idx = (snod->type == UBIFS_IDX_NODE) ? 1 : 0; |
1134 | 1134 | ||
1135 | if (is_idx && snod->type != UBIFS_IDX_NODE) { | 1135 | if (is_idx && snod->type != UBIFS_IDX_NODE) { |
1136 | ubifs_err("indexing node in data LEB %d:%d", | 1136 | ubifs_err(c, "indexing node in data LEB %d:%d", |
1137 | lnum, snod->offs); | 1137 | lnum, snod->offs); |
1138 | goto out_destroy; | 1138 | goto out_destroy; |
1139 | } | 1139 | } |
@@ -1159,7 +1159,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1159 | 1159 | ||
1160 | if (free > c->leb_size || free < 0 || dirty > c->leb_size || | 1160 | if (free > c->leb_size || free < 0 || dirty > c->leb_size || |
1161 | dirty < 0) { | 1161 | dirty < 0) { |
1162 | ubifs_err("bad calculated accounting for LEB %d: free %d, dirty %d", | 1162 | ubifs_err(c, "bad calculated accounting for LEB %d: free %d, dirty %d", |
1163 | lnum, free, dirty); | 1163 | lnum, free, dirty); |
1164 | goto out_destroy; | 1164 | goto out_destroy; |
1165 | } | 1165 | } |
@@ -1206,13 +1206,13 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1206 | /* Free but not unmapped LEB, it's fine */ | 1206 | /* Free but not unmapped LEB, it's fine */ |
1207 | is_idx = 0; | 1207 | is_idx = 0; |
1208 | else { | 1208 | else { |
1209 | ubifs_err("indexing node without indexing flag"); | 1209 | ubifs_err(c, "indexing node without indexing flag"); |
1210 | goto out_print; | 1210 | goto out_print; |
1211 | } | 1211 | } |
1212 | } | 1212 | } |
1213 | 1213 | ||
1214 | if (!is_idx && (lp->flags & LPROPS_INDEX)) { | 1214 | if (!is_idx && (lp->flags & LPROPS_INDEX)) { |
1215 | ubifs_err("data node with indexing flag"); | 1215 | ubifs_err(c, "data node with indexing flag"); |
1216 | goto out_print; | 1216 | goto out_print; |
1217 | } | 1217 | } |
1218 | 1218 | ||
@@ -1241,7 +1241,7 @@ static int scan_check_cb(struct ubifs_info *c, | |||
1241 | return LPT_SCAN_CONTINUE; | 1241 | return LPT_SCAN_CONTINUE; |
1242 | 1242 | ||
1243 | out_print: | 1243 | out_print: |
1244 | ubifs_err("bad accounting of LEB %d: free %d, dirty %d flags %#x, should be free %d, dirty %d", | 1244 | ubifs_err(c, "bad accounting of LEB %d: free %d, dirty %d flags %#x, should be free %d, dirty %d", |
1245 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); | 1245 | lnum, lp->free, lp->dirty, lp->flags, free, dirty); |
1246 | ubifs_dump_leb(c, lnum); | 1246 | ubifs_dump_leb(c, lnum); |
1247 | out_destroy: | 1247 | out_destroy: |
@@ -1293,11 +1293,11 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1293 | lst.total_free != c->lst.total_free || | 1293 | lst.total_free != c->lst.total_free || |
1294 | lst.total_dirty != c->lst.total_dirty || | 1294 | lst.total_dirty != c->lst.total_dirty || |
1295 | lst.total_used != c->lst.total_used) { | 1295 | lst.total_used != c->lst.total_used) { |
1296 | ubifs_err("bad overall accounting"); | 1296 | ubifs_err(c, "bad overall accounting"); |
1297 | ubifs_err("calculated: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", | 1297 | ubifs_err(c, "calculated: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", |
1298 | lst.empty_lebs, lst.idx_lebs, lst.total_free, | 1298 | lst.empty_lebs, lst.idx_lebs, lst.total_free, |
1299 | lst.total_dirty, lst.total_used); | 1299 | lst.total_dirty, lst.total_used); |
1300 | ubifs_err("read from lprops: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", | 1300 | ubifs_err(c, "read from lprops: empty_lebs %d, idx_lebs %d, total_free %lld, total_dirty %lld, total_used %lld", |
1301 | c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free, | 1301 | c->lst.empty_lebs, c->lst.idx_lebs, c->lst.total_free, |
1302 | c->lst.total_dirty, c->lst.total_used); | 1302 | c->lst.total_dirty, c->lst.total_used); |
1303 | err = -EINVAL; | 1303 | err = -EINVAL; |
@@ -1306,10 +1306,10 @@ int dbg_check_lprops(struct ubifs_info *c) | |||
1306 | 1306 | ||
1307 | if (lst.total_dead != c->lst.total_dead || | 1307 | if (lst.total_dead != c->lst.total_dead || |
1308 | lst.total_dark != c->lst.total_dark) { | 1308 | lst.total_dark != c->lst.total_dark) { |
1309 | ubifs_err("bad dead/dark space accounting"); | 1309 | ubifs_err(c, "bad dead/dark space accounting"); |
1310 | ubifs_err("calculated: total_dead %lld, total_dark %lld", | 1310 | ubifs_err(c, "calculated: total_dead %lld, total_dark %lld", |
1311 | lst.total_dead, lst.total_dark); | 1311 | lst.total_dead, lst.total_dark); |
1312 | ubifs_err("read from lprops: total_dead %lld, total_dark %lld", | 1312 | ubifs_err(c, "read from lprops: total_dead %lld, total_dark %lld", |
1313 | c->lst.total_dead, c->lst.total_dark); | 1313 | c->lst.total_dead, c->lst.total_dark); |
1314 | err = -EINVAL; | 1314 | err = -EINVAL; |
1315 | goto out; | 1315 | goto out; |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index 421bd0a80424..dc9f27e9d61b 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
@@ -145,13 +145,13 @@ int ubifs_calc_lpt_geom(struct ubifs_info *c) | |||
145 | sz = c->lpt_sz * 2; /* Must have at least 2 times the size */ | 145 | sz = c->lpt_sz * 2; /* Must have at least 2 times the size */ |
146 | lebs_needed = div_u64(sz + c->leb_size - 1, c->leb_size); | 146 | lebs_needed = div_u64(sz + c->leb_size - 1, c->leb_size); |
147 | if (lebs_needed > c->lpt_lebs) { | 147 | if (lebs_needed > c->lpt_lebs) { |
148 | ubifs_err("too few LPT LEBs"); | 148 | ubifs_err(c, "too few LPT LEBs"); |
149 | return -EINVAL; | 149 | return -EINVAL; |
150 | } | 150 | } |
151 | 151 | ||
152 | /* Verify that ltab fits in a single LEB (since ltab is a single node */ | 152 | /* Verify that ltab fits in a single LEB (since ltab is a single node */ |
153 | if (c->ltab_sz > c->leb_size) { | 153 | if (c->ltab_sz > c->leb_size) { |
154 | ubifs_err("LPT ltab too big"); | 154 | ubifs_err(c, "LPT ltab too big"); |
155 | return -EINVAL; | 155 | return -EINVAL; |
156 | } | 156 | } |
157 | 157 | ||
@@ -213,7 +213,7 @@ static int calc_dflt_lpt_geom(struct ubifs_info *c, int *main_lebs, | |||
213 | continue; | 213 | continue; |
214 | } | 214 | } |
215 | if (c->ltab_sz > c->leb_size) { | 215 | if (c->ltab_sz > c->leb_size) { |
216 | ubifs_err("LPT ltab too big"); | 216 | ubifs_err(c, "LPT ltab too big"); |
217 | return -EINVAL; | 217 | return -EINVAL; |
218 | } | 218 | } |
219 | *main_lebs = c->main_lebs; | 219 | *main_lebs = c->main_lebs; |
@@ -911,7 +911,7 @@ static void replace_cats(struct ubifs_info *c, struct ubifs_pnode *old_pnode, | |||
911 | * | 911 | * |
912 | * This function returns %0 on success and a negative error code on failure. | 912 | * This function returns %0 on success and a negative error code on failure. |
913 | */ | 913 | */ |
914 | static int check_lpt_crc(void *buf, int len) | 914 | static int check_lpt_crc(const struct ubifs_info *c, void *buf, int len) |
915 | { | 915 | { |
916 | int pos = 0; | 916 | int pos = 0; |
917 | uint8_t *addr = buf; | 917 | uint8_t *addr = buf; |
@@ -921,8 +921,8 @@ static int check_lpt_crc(void *buf, int len) | |||
921 | calc_crc = crc16(-1, buf + UBIFS_LPT_CRC_BYTES, | 921 | calc_crc = crc16(-1, buf + UBIFS_LPT_CRC_BYTES, |
922 | len - UBIFS_LPT_CRC_BYTES); | 922 | len - UBIFS_LPT_CRC_BYTES); |
923 | if (crc != calc_crc) { | 923 | if (crc != calc_crc) { |
924 | ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc, | 924 | ubifs_err(c, "invalid crc in LPT node: crc %hx calc %hx", |
925 | calc_crc); | 925 | crc, calc_crc); |
926 | dump_stack(); | 926 | dump_stack(); |
927 | return -EINVAL; | 927 | return -EINVAL; |
928 | } | 928 | } |
@@ -938,14 +938,15 @@ static int check_lpt_crc(void *buf, int len) | |||
938 | * | 938 | * |
939 | * This function returns %0 on success and a negative error code on failure. | 939 | * This function returns %0 on success and a negative error code on failure. |
940 | */ | 940 | */ |
941 | static int check_lpt_type(uint8_t **addr, int *pos, int type) | 941 | static int check_lpt_type(const struct ubifs_info *c, uint8_t **addr, |
942 | int *pos, int type) | ||
942 | { | 943 | { |
943 | int node_type; | 944 | int node_type; |
944 | 945 | ||
945 | node_type = ubifs_unpack_bits(addr, pos, UBIFS_LPT_TYPE_BITS); | 946 | node_type = ubifs_unpack_bits(addr, pos, UBIFS_LPT_TYPE_BITS); |
946 | if (node_type != type) { | 947 | if (node_type != type) { |
947 | ubifs_err("invalid type (%d) in LPT node type %d", node_type, | 948 | ubifs_err(c, "invalid type (%d) in LPT node type %d", |
948 | type); | 949 | node_type, type); |
949 | dump_stack(); | 950 | dump_stack(); |
950 | return -EINVAL; | 951 | return -EINVAL; |
951 | } | 952 | } |
@@ -966,7 +967,7 @@ static int unpack_pnode(const struct ubifs_info *c, void *buf, | |||
966 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 967 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
967 | int i, pos = 0, err; | 968 | int i, pos = 0, err; |
968 | 969 | ||
969 | err = check_lpt_type(&addr, &pos, UBIFS_LPT_PNODE); | 970 | err = check_lpt_type(c, &addr, &pos, UBIFS_LPT_PNODE); |
970 | if (err) | 971 | if (err) |
971 | return err; | 972 | return err; |
972 | if (c->big_lpt) | 973 | if (c->big_lpt) |
@@ -985,7 +986,7 @@ static int unpack_pnode(const struct ubifs_info *c, void *buf, | |||
985 | lprops->flags = 0; | 986 | lprops->flags = 0; |
986 | lprops->flags |= ubifs_categorize_lprops(c, lprops); | 987 | lprops->flags |= ubifs_categorize_lprops(c, lprops); |
987 | } | 988 | } |
988 | err = check_lpt_crc(buf, c->pnode_sz); | 989 | err = check_lpt_crc(c, buf, c->pnode_sz); |
989 | return err; | 990 | return err; |
990 | } | 991 | } |
991 | 992 | ||
@@ -1003,7 +1004,7 @@ int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf, | |||
1003 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1004 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1004 | int i, pos = 0, err; | 1005 | int i, pos = 0, err; |
1005 | 1006 | ||
1006 | err = check_lpt_type(&addr, &pos, UBIFS_LPT_NNODE); | 1007 | err = check_lpt_type(c, &addr, &pos, UBIFS_LPT_NNODE); |
1007 | if (err) | 1008 | if (err) |
1008 | return err; | 1009 | return err; |
1009 | if (c->big_lpt) | 1010 | if (c->big_lpt) |
@@ -1019,7 +1020,7 @@ int ubifs_unpack_nnode(const struct ubifs_info *c, void *buf, | |||
1019 | nnode->nbranch[i].offs = ubifs_unpack_bits(&addr, &pos, | 1020 | nnode->nbranch[i].offs = ubifs_unpack_bits(&addr, &pos, |
1020 | c->lpt_offs_bits); | 1021 | c->lpt_offs_bits); |
1021 | } | 1022 | } |
1022 | err = check_lpt_crc(buf, c->nnode_sz); | 1023 | err = check_lpt_crc(c, buf, c->nnode_sz); |
1023 | return err; | 1024 | return err; |
1024 | } | 1025 | } |
1025 | 1026 | ||
@@ -1035,7 +1036,7 @@ static int unpack_ltab(const struct ubifs_info *c, void *buf) | |||
1035 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1036 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1036 | int i, pos = 0, err; | 1037 | int i, pos = 0, err; |
1037 | 1038 | ||
1038 | err = check_lpt_type(&addr, &pos, UBIFS_LPT_LTAB); | 1039 | err = check_lpt_type(c, &addr, &pos, UBIFS_LPT_LTAB); |
1039 | if (err) | 1040 | if (err) |
1040 | return err; | 1041 | return err; |
1041 | for (i = 0; i < c->lpt_lebs; i++) { | 1042 | for (i = 0; i < c->lpt_lebs; i++) { |
@@ -1051,7 +1052,7 @@ static int unpack_ltab(const struct ubifs_info *c, void *buf) | |||
1051 | c->ltab[i].tgc = 0; | 1052 | c->ltab[i].tgc = 0; |
1052 | c->ltab[i].cmt = 0; | 1053 | c->ltab[i].cmt = 0; |
1053 | } | 1054 | } |
1054 | err = check_lpt_crc(buf, c->ltab_sz); | 1055 | err = check_lpt_crc(c, buf, c->ltab_sz); |
1055 | return err; | 1056 | return err; |
1056 | } | 1057 | } |
1057 | 1058 | ||
@@ -1067,7 +1068,7 @@ static int unpack_lsave(const struct ubifs_info *c, void *buf) | |||
1067 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; | 1068 | uint8_t *addr = buf + UBIFS_LPT_CRC_BYTES; |
1068 | int i, pos = 0, err; | 1069 | int i, pos = 0, err; |
1069 | 1070 | ||
1070 | err = check_lpt_type(&addr, &pos, UBIFS_LPT_LSAVE); | 1071 | err = check_lpt_type(c, &addr, &pos, UBIFS_LPT_LSAVE); |
1071 | if (err) | 1072 | if (err) |
1072 | return err; | 1073 | return err; |
1073 | for (i = 0; i < c->lsave_cnt; i++) { | 1074 | for (i = 0; i < c->lsave_cnt; i++) { |
@@ -1077,7 +1078,7 @@ static int unpack_lsave(const struct ubifs_info *c, void *buf) | |||
1077 | return -EINVAL; | 1078 | return -EINVAL; |
1078 | c->lsave[i] = lnum; | 1079 | c->lsave[i] = lnum; |
1079 | } | 1080 | } |
1080 | err = check_lpt_crc(buf, c->lsave_sz); | 1081 | err = check_lpt_crc(c, buf, c->lsave_sz); |
1081 | return err; | 1082 | return err; |
1082 | } | 1083 | } |
1083 | 1084 | ||
@@ -1243,7 +1244,7 @@ int ubifs_read_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1243 | return 0; | 1244 | return 0; |
1244 | 1245 | ||
1245 | out: | 1246 | out: |
1246 | ubifs_err("error %d reading nnode at %d:%d", err, lnum, offs); | 1247 | ubifs_err(c, "error %d reading nnode at %d:%d", err, lnum, offs); |
1247 | dump_stack(); | 1248 | dump_stack(); |
1248 | kfree(nnode); | 1249 | kfree(nnode); |
1249 | return err; | 1250 | return err; |
@@ -1308,10 +1309,10 @@ static int read_pnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip) | |||
1308 | return 0; | 1309 | return 0; |
1309 | 1310 | ||
1310 | out: | 1311 | out: |
1311 | ubifs_err("error %d reading pnode at %d:%d", err, lnum, offs); | 1312 | ubifs_err(c, "error %d reading pnode at %d:%d", err, lnum, offs); |
1312 | ubifs_dump_pnode(c, pnode, parent, iip); | 1313 | ubifs_dump_pnode(c, pnode, parent, iip); |
1313 | dump_stack(); | 1314 | dump_stack(); |
1314 | ubifs_err("calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); | 1315 | ubifs_err(c, "calc num: %d", calc_pnode_num_from_parent(c, parent, iip)); |
1315 | kfree(pnode); | 1316 | kfree(pnode); |
1316 | return err; | 1317 | return err; |
1317 | } | 1318 | } |
@@ -2095,7 +2096,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2095 | int i; | 2096 | int i; |
2096 | 2097 | ||
2097 | if (pnode->num != col) { | 2098 | if (pnode->num != col) { |
2098 | ubifs_err("pnode num %d expected %d parent num %d iip %d", | 2099 | ubifs_err(c, "pnode num %d expected %d parent num %d iip %d", |
2099 | pnode->num, col, pnode->parent->num, pnode->iip); | 2100 | pnode->num, col, pnode->parent->num, pnode->iip); |
2100 | return -EINVAL; | 2101 | return -EINVAL; |
2101 | } | 2102 | } |
@@ -2110,13 +2111,13 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2110 | if (lnum >= c->leb_cnt) | 2111 | if (lnum >= c->leb_cnt) |
2111 | continue; | 2112 | continue; |
2112 | if (lprops->lnum != lnum) { | 2113 | if (lprops->lnum != lnum) { |
2113 | ubifs_err("bad LEB number %d expected %d", | 2114 | ubifs_err(c, "bad LEB number %d expected %d", |
2114 | lprops->lnum, lnum); | 2115 | lprops->lnum, lnum); |
2115 | return -EINVAL; | 2116 | return -EINVAL; |
2116 | } | 2117 | } |
2117 | if (lprops->flags & LPROPS_TAKEN) { | 2118 | if (lprops->flags & LPROPS_TAKEN) { |
2118 | if (cat != LPROPS_UNCAT) { | 2119 | if (cat != LPROPS_UNCAT) { |
2119 | ubifs_err("LEB %d taken but not uncat %d", | 2120 | ubifs_err(c, "LEB %d taken but not uncat %d", |
2120 | lprops->lnum, cat); | 2121 | lprops->lnum, cat); |
2121 | return -EINVAL; | 2122 | return -EINVAL; |
2122 | } | 2123 | } |
@@ -2129,7 +2130,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2129 | case LPROPS_FRDI_IDX: | 2130 | case LPROPS_FRDI_IDX: |
2130 | break; | 2131 | break; |
2131 | default: | 2132 | default: |
2132 | ubifs_err("LEB %d index but cat %d", | 2133 | ubifs_err(c, "LEB %d index but cat %d", |
2133 | lprops->lnum, cat); | 2134 | lprops->lnum, cat); |
2134 | return -EINVAL; | 2135 | return -EINVAL; |
2135 | } | 2136 | } |
@@ -2142,7 +2143,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2142 | case LPROPS_FREEABLE: | 2143 | case LPROPS_FREEABLE: |
2143 | break; | 2144 | break; |
2144 | default: | 2145 | default: |
2145 | ubifs_err("LEB %d not index but cat %d", | 2146 | ubifs_err(c, "LEB %d not index but cat %d", |
2146 | lprops->lnum, cat); | 2147 | lprops->lnum, cat); |
2147 | return -EINVAL; | 2148 | return -EINVAL; |
2148 | } | 2149 | } |
@@ -2183,14 +2184,14 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2183 | break; | 2184 | break; |
2184 | } | 2185 | } |
2185 | if (!found) { | 2186 | if (!found) { |
2186 | ubifs_err("LEB %d cat %d not found in cat heap/list", | 2187 | ubifs_err(c, "LEB %d cat %d not found in cat heap/list", |
2187 | lprops->lnum, cat); | 2188 | lprops->lnum, cat); |
2188 | return -EINVAL; | 2189 | return -EINVAL; |
2189 | } | 2190 | } |
2190 | switch (cat) { | 2191 | switch (cat) { |
2191 | case LPROPS_EMPTY: | 2192 | case LPROPS_EMPTY: |
2192 | if (lprops->free != c->leb_size) { | 2193 | if (lprops->free != c->leb_size) { |
2193 | ubifs_err("LEB %d cat %d free %d dirty %d", | 2194 | ubifs_err(c, "LEB %d cat %d free %d dirty %d", |
2194 | lprops->lnum, cat, lprops->free, | 2195 | lprops->lnum, cat, lprops->free, |
2195 | lprops->dirty); | 2196 | lprops->dirty); |
2196 | return -EINVAL; | 2197 | return -EINVAL; |
@@ -2199,7 +2200,7 @@ static int dbg_chk_pnode(struct ubifs_info *c, struct ubifs_pnode *pnode, | |||
2199 | case LPROPS_FREEABLE: | 2200 | case LPROPS_FREEABLE: |
2200 | case LPROPS_FRDI_IDX: | 2201 | case LPROPS_FRDI_IDX: |
2201 | if (lprops->free + lprops->dirty != c->leb_size) { | 2202 | if (lprops->free + lprops->dirty != c->leb_size) { |
2202 | ubifs_err("LEB %d cat %d free %d dirty %d", | 2203 | ubifs_err(c, "LEB %d cat %d free %d dirty %d", |
2203 | lprops->lnum, cat, lprops->free, | 2204 | lprops->lnum, cat, lprops->free, |
2204 | lprops->dirty); | 2205 | lprops->dirty); |
2205 | return -EINVAL; | 2206 | return -EINVAL; |
@@ -2236,7 +2237,7 @@ int dbg_check_lpt_nodes(struct ubifs_info *c, struct ubifs_cnode *cnode, | |||
2236 | /* cnode is a nnode */ | 2237 | /* cnode is a nnode */ |
2237 | num = calc_nnode_num(row, col); | 2238 | num = calc_nnode_num(row, col); |
2238 | if (cnode->num != num) { | 2239 | if (cnode->num != num) { |
2239 | ubifs_err("nnode num %d expected %d parent num %d iip %d", | 2240 | ubifs_err(c, "nnode num %d expected %d parent num %d iip %d", |
2240 | cnode->num, num, | 2241 | cnode->num, num, |
2241 | (nnode ? nnode->num : 0), cnode->iip); | 2242 | (nnode ? nnode->num : 0), cnode->iip); |
2242 | return -EINVAL; | 2243 | return -EINVAL; |
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index d9c02928e992..ce89bdc3eb02 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c | |||
@@ -319,7 +319,7 @@ static int layout_cnodes(struct ubifs_info *c) | |||
319 | return 0; | 319 | return 0; |
320 | 320 | ||
321 | no_space: | 321 | no_space: |
322 | ubifs_err("LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", | 322 | ubifs_err(c, "LPT out of space at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", |
323 | lnum, offs, len, done_ltab, done_lsave); | 323 | lnum, offs, len, done_ltab, done_lsave); |
324 | ubifs_dump_lpt_info(c); | 324 | ubifs_dump_lpt_info(c); |
325 | ubifs_dump_lpt_lebs(c); | 325 | ubifs_dump_lpt_lebs(c); |
@@ -543,7 +543,7 @@ static int write_cnodes(struct ubifs_info *c) | |||
543 | return 0; | 543 | return 0; |
544 | 544 | ||
545 | no_space: | 545 | no_space: |
546 | ubifs_err("LPT out of space mismatch at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", | 546 | ubifs_err(c, "LPT out of space mismatch at LEB %d:%d needing %d, done_ltab %d, done_lsave %d", |
547 | lnum, offs, len, done_ltab, done_lsave); | 547 | lnum, offs, len, done_ltab, done_lsave); |
548 | ubifs_dump_lpt_info(c); | 548 | ubifs_dump_lpt_info(c); |
549 | ubifs_dump_lpt_lebs(c); | 549 | ubifs_dump_lpt_lebs(c); |
@@ -1638,7 +1638,7 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1638 | 1638 | ||
1639 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 1639 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
1640 | if (!buf) { | 1640 | if (!buf) { |
1641 | ubifs_err("cannot allocate memory for ltab checking"); | 1641 | ubifs_err(c, "cannot allocate memory for ltab checking"); |
1642 | return 0; | 1642 | return 0; |
1643 | } | 1643 | } |
1644 | 1644 | ||
@@ -1660,18 +1660,18 @@ static int dbg_check_ltab_lnum(struct ubifs_info *c, int lnum) | |||
1660 | continue; | 1660 | continue; |
1661 | } | 1661 | } |
1662 | if (!dbg_is_all_ff(p, len)) { | 1662 | if (!dbg_is_all_ff(p, len)) { |
1663 | ubifs_err("invalid empty space in LEB %d at %d", | 1663 | ubifs_err(c, "invalid empty space in LEB %d at %d", |
1664 | lnum, c->leb_size - len); | 1664 | lnum, c->leb_size - len); |
1665 | err = -EINVAL; | 1665 | err = -EINVAL; |
1666 | } | 1666 | } |
1667 | i = lnum - c->lpt_first; | 1667 | i = lnum - c->lpt_first; |
1668 | if (len != c->ltab[i].free) { | 1668 | if (len != c->ltab[i].free) { |
1669 | ubifs_err("invalid free space in LEB %d (free %d, expected %d)", | 1669 | ubifs_err(c, "invalid free space in LEB %d (free %d, expected %d)", |
1670 | lnum, len, c->ltab[i].free); | 1670 | lnum, len, c->ltab[i].free); |
1671 | err = -EINVAL; | 1671 | err = -EINVAL; |
1672 | } | 1672 | } |
1673 | if (dirty != c->ltab[i].dirty) { | 1673 | if (dirty != c->ltab[i].dirty) { |
1674 | ubifs_err("invalid dirty space in LEB %d (dirty %d, expected %d)", | 1674 | ubifs_err(c, "invalid dirty space in LEB %d (dirty %d, expected %d)", |
1675 | lnum, dirty, c->ltab[i].dirty); | 1675 | lnum, dirty, c->ltab[i].dirty); |
1676 | err = -EINVAL; | 1676 | err = -EINVAL; |
1677 | } | 1677 | } |
@@ -1725,7 +1725,7 @@ int dbg_check_ltab(struct ubifs_info *c) | |||
1725 | for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { | 1725 | for (lnum = c->lpt_first; lnum <= c->lpt_last; lnum++) { |
1726 | err = dbg_check_ltab_lnum(c, lnum); | 1726 | err = dbg_check_ltab_lnum(c, lnum); |
1727 | if (err) { | 1727 | if (err) { |
1728 | ubifs_err("failed at LEB %d", lnum); | 1728 | ubifs_err(c, "failed at LEB %d", lnum); |
1729 | return err; | 1729 | return err; |
1730 | } | 1730 | } |
1731 | } | 1731 | } |
@@ -1757,7 +1757,7 @@ int dbg_chk_lpt_free_spc(struct ubifs_info *c) | |||
1757 | free += c->leb_size; | 1757 | free += c->leb_size; |
1758 | } | 1758 | } |
1759 | if (free < c->lpt_sz) { | 1759 | if (free < c->lpt_sz) { |
1760 | ubifs_err("LPT space error: free %lld lpt_sz %lld", | 1760 | ubifs_err(c, "LPT space error: free %lld lpt_sz %lld", |
1761 | free, c->lpt_sz); | 1761 | free, c->lpt_sz); |
1762 | ubifs_dump_lpt_info(c); | 1762 | ubifs_dump_lpt_info(c); |
1763 | ubifs_dump_lpt_lebs(c); | 1763 | ubifs_dump_lpt_lebs(c); |
@@ -1797,12 +1797,12 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1797 | d->chk_lpt_lebs = 0; | 1797 | d->chk_lpt_lebs = 0; |
1798 | d->chk_lpt_wastage = 0; | 1798 | d->chk_lpt_wastage = 0; |
1799 | if (c->dirty_pn_cnt > c->pnode_cnt) { | 1799 | if (c->dirty_pn_cnt > c->pnode_cnt) { |
1800 | ubifs_err("dirty pnodes %d exceed max %d", | 1800 | ubifs_err(c, "dirty pnodes %d exceed max %d", |
1801 | c->dirty_pn_cnt, c->pnode_cnt); | 1801 | c->dirty_pn_cnt, c->pnode_cnt); |
1802 | err = -EINVAL; | 1802 | err = -EINVAL; |
1803 | } | 1803 | } |
1804 | if (c->dirty_nn_cnt > c->nnode_cnt) { | 1804 | if (c->dirty_nn_cnt > c->nnode_cnt) { |
1805 | ubifs_err("dirty nnodes %d exceed max %d", | 1805 | ubifs_err(c, "dirty nnodes %d exceed max %d", |
1806 | c->dirty_nn_cnt, c->nnode_cnt); | 1806 | c->dirty_nn_cnt, c->nnode_cnt); |
1807 | err = -EINVAL; | 1807 | err = -EINVAL; |
1808 | } | 1808 | } |
@@ -1820,22 +1820,22 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1820 | chk_lpt_sz *= d->chk_lpt_lebs; | 1820 | chk_lpt_sz *= d->chk_lpt_lebs; |
1821 | chk_lpt_sz += len - c->nhead_offs; | 1821 | chk_lpt_sz += len - c->nhead_offs; |
1822 | if (d->chk_lpt_sz != chk_lpt_sz) { | 1822 | if (d->chk_lpt_sz != chk_lpt_sz) { |
1823 | ubifs_err("LPT wrote %lld but space used was %lld", | 1823 | ubifs_err(c, "LPT wrote %lld but space used was %lld", |
1824 | d->chk_lpt_sz, chk_lpt_sz); | 1824 | d->chk_lpt_sz, chk_lpt_sz); |
1825 | err = -EINVAL; | 1825 | err = -EINVAL; |
1826 | } | 1826 | } |
1827 | if (d->chk_lpt_sz > c->lpt_sz) { | 1827 | if (d->chk_lpt_sz > c->lpt_sz) { |
1828 | ubifs_err("LPT wrote %lld but lpt_sz is %lld", | 1828 | ubifs_err(c, "LPT wrote %lld but lpt_sz is %lld", |
1829 | d->chk_lpt_sz, c->lpt_sz); | 1829 | d->chk_lpt_sz, c->lpt_sz); |
1830 | err = -EINVAL; | 1830 | err = -EINVAL; |
1831 | } | 1831 | } |
1832 | if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) { | 1832 | if (d->chk_lpt_sz2 && d->chk_lpt_sz != d->chk_lpt_sz2) { |
1833 | ubifs_err("LPT layout size %lld but wrote %lld", | 1833 | ubifs_err(c, "LPT layout size %lld but wrote %lld", |
1834 | d->chk_lpt_sz, d->chk_lpt_sz2); | 1834 | d->chk_lpt_sz, d->chk_lpt_sz2); |
1835 | err = -EINVAL; | 1835 | err = -EINVAL; |
1836 | } | 1836 | } |
1837 | if (d->chk_lpt_sz2 && d->new_nhead_offs != len) { | 1837 | if (d->chk_lpt_sz2 && d->new_nhead_offs != len) { |
1838 | ubifs_err("LPT new nhead offs: expected %d was %d", | 1838 | ubifs_err(c, "LPT new nhead offs: expected %d was %d", |
1839 | d->new_nhead_offs, len); | 1839 | d->new_nhead_offs, len); |
1840 | err = -EINVAL; | 1840 | err = -EINVAL; |
1841 | } | 1841 | } |
@@ -1845,7 +1845,7 @@ int dbg_chk_lpt_sz(struct ubifs_info *c, int action, int len) | |||
1845 | if (c->big_lpt) | 1845 | if (c->big_lpt) |
1846 | lpt_sz += c->lsave_sz; | 1846 | lpt_sz += c->lsave_sz; |
1847 | if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) { | 1847 | if (d->chk_lpt_sz - d->chk_lpt_wastage > lpt_sz) { |
1848 | ubifs_err("LPT chk_lpt_sz %lld + waste %lld exceeds %lld", | 1848 | ubifs_err(c, "LPT chk_lpt_sz %lld + waste %lld exceeds %lld", |
1849 | d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz); | 1849 | d->chk_lpt_sz, d->chk_lpt_wastage, lpt_sz); |
1850 | err = -EINVAL; | 1850 | err = -EINVAL; |
1851 | } | 1851 | } |
@@ -1887,7 +1887,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1887 | pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); | 1887 | pr_err("(pid %d) start dumping LEB %d\n", current->pid, lnum); |
1888 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 1888 | buf = p = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
1889 | if (!buf) { | 1889 | if (!buf) { |
1890 | ubifs_err("cannot allocate memory to dump LPT"); | 1890 | ubifs_err(c, "cannot allocate memory to dump LPT"); |
1891 | return; | 1891 | return; |
1892 | } | 1892 | } |
1893 | 1893 | ||
@@ -1962,7 +1962,7 @@ static void dump_lpt_leb(const struct ubifs_info *c, int lnum) | |||
1962 | pr_err("LEB %d:%d, lsave len\n", lnum, offs); | 1962 | pr_err("LEB %d:%d, lsave len\n", lnum, offs); |
1963 | break; | 1963 | break; |
1964 | default: | 1964 | default: |
1965 | ubifs_err("LPT node type %d not recognized", node_type); | 1965 | ubifs_err(c, "LPT node type %d not recognized", node_type); |
1966 | goto out; | 1966 | goto out; |
1967 | } | 1967 | } |
1968 | 1968 | ||
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 1a4bb9e8b3b8..c6a5e39e2ba5 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c | |||
@@ -82,7 +82,7 @@ out: | |||
82 | return -EUCLEAN; | 82 | return -EUCLEAN; |
83 | 83 | ||
84 | out_dump: | 84 | out_dump: |
85 | ubifs_err("unexpected node type %d master LEB %d:%d", | 85 | ubifs_err(c, "unexpected node type %d master LEB %d:%d", |
86 | snod->type, lnum, snod->offs); | 86 | snod->type, lnum, snod->offs); |
87 | ubifs_scan_destroy(sleb); | 87 | ubifs_scan_destroy(sleb); |
88 | return -EINVAL; | 88 | return -EINVAL; |
@@ -240,7 +240,7 @@ static int validate_master(const struct ubifs_info *c) | |||
240 | return 0; | 240 | return 0; |
241 | 241 | ||
242 | out: | 242 | out: |
243 | ubifs_err("bad master node at offset %d error %d", c->mst_offs, err); | 243 | ubifs_err(c, "bad master node at offset %d error %d", c->mst_offs, err); |
244 | ubifs_dump_node(c, c->mst_node); | 244 | ubifs_dump_node(c, c->mst_node); |
245 | return -EINVAL; | 245 | return -EINVAL; |
246 | } | 246 | } |
@@ -316,7 +316,7 @@ int ubifs_read_master(struct ubifs_info *c) | |||
316 | 316 | ||
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(c, "bad leb_cnt on master node"); |
320 | ubifs_dump_node(c, c->mst_node); | 320 | ubifs_dump_node(c, c->mst_node); |
321 | return -EINVAL; | 321 | return -EINVAL; |
322 | } | 322 | } |
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index 4409f486ecef..caf2d123e9ee 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c | |||
@@ -88,7 +88,7 @@ int ubifs_add_orphan(struct ubifs_info *c, ino_t inum) | |||
88 | else if (inum > o->inum) | 88 | else if (inum > o->inum) |
89 | p = &(*p)->rb_right; | 89 | p = &(*p)->rb_right; |
90 | else { | 90 | else { |
91 | ubifs_err("orphaned twice"); | 91 | ubifs_err(c, "orphaned twice"); |
92 | spin_unlock(&c->orphan_lock); | 92 | spin_unlock(&c->orphan_lock); |
93 | kfree(orphan); | 93 | kfree(orphan); |
94 | return 0; | 94 | return 0; |
@@ -155,7 +155,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum) | |||
155 | } | 155 | } |
156 | } | 156 | } |
157 | spin_unlock(&c->orphan_lock); | 157 | spin_unlock(&c->orphan_lock); |
158 | ubifs_err("missing orphan ino %lu", (unsigned long)inum); | 158 | ubifs_err(c, "missing orphan ino %lu", (unsigned long)inum); |
159 | dump_stack(); | 159 | dump_stack(); |
160 | } | 160 | } |
161 | 161 | ||
@@ -287,7 +287,7 @@ static int write_orph_node(struct ubifs_info *c, int atomic) | |||
287 | * We limit the number of orphans so that this should | 287 | * We limit the number of orphans so that this should |
288 | * never happen. | 288 | * never happen. |
289 | */ | 289 | */ |
290 | ubifs_err("out of space in orphan area"); | 290 | ubifs_err(c, "out of space in orphan area"); |
291 | return -EINVAL; | 291 | return -EINVAL; |
292 | } | 292 | } |
293 | } | 293 | } |
@@ -397,7 +397,7 @@ static int consolidate(struct ubifs_info *c) | |||
397 | * We limit the number of orphans so that this should | 397 | * We limit the number of orphans so that this should |
398 | * never happen. | 398 | * never happen. |
399 | */ | 399 | */ |
400 | ubifs_err("out of space in orphan area"); | 400 | ubifs_err(c, "out of space in orphan area"); |
401 | err = -EINVAL; | 401 | err = -EINVAL; |
402 | } | 402 | } |
403 | spin_unlock(&c->orphan_lock); | 403 | spin_unlock(&c->orphan_lock); |
@@ -569,7 +569,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
569 | 569 | ||
570 | list_for_each_entry(snod, &sleb->nodes, list) { | 570 | list_for_each_entry(snod, &sleb->nodes, list) { |
571 | if (snod->type != UBIFS_ORPH_NODE) { | 571 | if (snod->type != UBIFS_ORPH_NODE) { |
572 | ubifs_err("invalid node type %d in orphan area at %d:%d", | 572 | ubifs_err(c, "invalid node type %d in orphan area at %d:%d", |
573 | snod->type, sleb->lnum, snod->offs); | 573 | snod->type, sleb->lnum, snod->offs); |
574 | ubifs_dump_node(c, snod->node); | 574 | ubifs_dump_node(c, snod->node); |
575 | return -EINVAL; | 575 | return -EINVAL; |
@@ -596,7 +596,7 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb, | |||
596 | * number. That makes this orphan node, out of date. | 596 | * number. That makes this orphan node, out of date. |
597 | */ | 597 | */ |
598 | if (!first) { | 598 | if (!first) { |
599 | ubifs_err("out of order commit number %llu in orphan node at %d:%d", | 599 | ubifs_err(c, "out of order commit number %llu in orphan node at %d:%d", |
600 | cmt_no, sleb->lnum, snod->offs); | 600 | cmt_no, sleb->lnum, snod->offs); |
601 | ubifs_dump_node(c, snod->node); | 601 | ubifs_dump_node(c, snod->node); |
602 | return -EINVAL; | 602 | return -EINVAL; |
@@ -831,20 +831,20 @@ static int dbg_orphan_check(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
831 | if (inum != ci->last_ino) { | 831 | if (inum != ci->last_ino) { |
832 | /* Lowest node type is the inode node, so it comes first */ | 832 | /* Lowest node type is the inode node, so it comes first */ |
833 | if (key_type(c, &zbr->key) != UBIFS_INO_KEY) | 833 | if (key_type(c, &zbr->key) != UBIFS_INO_KEY) |
834 | ubifs_err("found orphan node ino %lu, type %d", | 834 | ubifs_err(c, "found orphan node ino %lu, type %d", |
835 | (unsigned long)inum, key_type(c, &zbr->key)); | 835 | (unsigned long)inum, key_type(c, &zbr->key)); |
836 | ci->last_ino = inum; | 836 | ci->last_ino = inum; |
837 | ci->tot_inos += 1; | 837 | ci->tot_inos += 1; |
838 | err = ubifs_tnc_read_node(c, zbr, ci->node); | 838 | err = ubifs_tnc_read_node(c, zbr, ci->node); |
839 | if (err) { | 839 | if (err) { |
840 | ubifs_err("node read failed, error %d", err); | 840 | ubifs_err(c, "node read failed, error %d", err); |
841 | return err; | 841 | return err; |
842 | } | 842 | } |
843 | if (ci->node->nlink == 0) | 843 | if (ci->node->nlink == 0) |
844 | /* Must be recorded as an orphan */ | 844 | /* Must be recorded as an orphan */ |
845 | if (!dbg_find_check_orphan(&ci->root, inum) && | 845 | if (!dbg_find_check_orphan(&ci->root, inum) && |
846 | !dbg_find_orphan(c, inum)) { | 846 | !dbg_find_orphan(c, inum)) { |
847 | ubifs_err("missing orphan, ino %lu", | 847 | ubifs_err(c, "missing orphan, ino %lu", |
848 | (unsigned long)inum); | 848 | (unsigned long)inum); |
849 | ci->missing += 1; | 849 | ci->missing += 1; |
850 | } | 850 | } |
@@ -887,7 +887,7 @@ static int dbg_scan_orphans(struct ubifs_info *c, struct check_info *ci) | |||
887 | 887 | ||
888 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); | 888 | buf = __vmalloc(c->leb_size, GFP_NOFS, PAGE_KERNEL); |
889 | if (!buf) { | 889 | if (!buf) { |
890 | ubifs_err("cannot allocate memory to check orphans"); | 890 | ubifs_err(c, "cannot allocate memory to check orphans"); |
891 | return 0; | 891 | return 0; |
892 | } | 892 | } |
893 | 893 | ||
@@ -925,7 +925,7 @@ static int dbg_check_orphans(struct ubifs_info *c) | |||
925 | ci.root = RB_ROOT; | 925 | ci.root = RB_ROOT; |
926 | ci.node = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS); | 926 | ci.node = kmalloc(UBIFS_MAX_INO_NODE_SZ, GFP_NOFS); |
927 | if (!ci.node) { | 927 | if (!ci.node) { |
928 | ubifs_err("out of memory"); | 928 | ubifs_err(c, "out of memory"); |
929 | return -ENOMEM; | 929 | return -ENOMEM; |
930 | } | 930 | } |
931 | 931 | ||
@@ -935,12 +935,12 @@ static int dbg_check_orphans(struct ubifs_info *c) | |||
935 | 935 | ||
936 | err = dbg_walk_index(c, &dbg_orphan_check, NULL, &ci); | 936 | err = dbg_walk_index(c, &dbg_orphan_check, NULL, &ci); |
937 | if (err) { | 937 | if (err) { |
938 | ubifs_err("cannot scan TNC, error %d", err); | 938 | ubifs_err(c, "cannot scan TNC, error %d", err); |
939 | goto out; | 939 | goto out; |
940 | } | 940 | } |
941 | 941 | ||
942 | if (ci.missing) { | 942 | if (ci.missing) { |
943 | ubifs_err("%lu missing orphan(s)", ci.missing); | 943 | ubifs_err(c, "%lu missing orphan(s)", ci.missing); |
944 | err = -EINVAL; | 944 | err = -EINVAL; |
945 | goto out; | 945 | goto out; |
946 | } | 946 | } |
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 13ca4dbc4d19..695fc71d5244 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -305,7 +305,7 @@ int ubifs_recover_master_node(struct ubifs_info *c) | |||
305 | mst = mst2; | 305 | mst = mst2; |
306 | } | 306 | } |
307 | 307 | ||
308 | ubifs_msg("recovered master node from LEB %d", | 308 | ubifs_msg(c, "recovered master node from LEB %d", |
309 | (mst == mst1 ? UBIFS_MST_LNUM : UBIFS_MST_LNUM + 1)); | 309 | (mst == mst1 ? UBIFS_MST_LNUM : UBIFS_MST_LNUM + 1)); |
310 | 310 | ||
311 | memcpy(c->mst_node, mst, UBIFS_MST_NODE_SZ); | 311 | memcpy(c->mst_node, mst, UBIFS_MST_NODE_SZ); |
@@ -360,13 +360,13 @@ int ubifs_recover_master_node(struct ubifs_info *c) | |||
360 | out_err: | 360 | out_err: |
361 | err = -EINVAL; | 361 | err = -EINVAL; |
362 | out_free: | 362 | out_free: |
363 | ubifs_err("failed to recover master node"); | 363 | ubifs_err(c, "failed to recover master node"); |
364 | if (mst1) { | 364 | if (mst1) { |
365 | ubifs_err("dumping first master node"); | 365 | ubifs_err(c, "dumping first master node"); |
366 | ubifs_dump_node(c, mst1); | 366 | ubifs_dump_node(c, mst1); |
367 | } | 367 | } |
368 | if (mst2) { | 368 | if (mst2) { |
369 | ubifs_err("dumping second master node"); | 369 | ubifs_err(c, "dumping second master node"); |
370 | ubifs_dump_node(c, mst2); | 370 | ubifs_dump_node(c, mst2); |
371 | } | 371 | } |
372 | vfree(buf2); | 372 | vfree(buf2); |
@@ -682,7 +682,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
682 | ret, lnum, offs); | 682 | ret, lnum, offs); |
683 | break; | 683 | break; |
684 | } else { | 684 | } else { |
685 | ubifs_err("unexpected return value %d", ret); | 685 | ubifs_err(c, "unexpected return value %d", ret); |
686 | err = -EINVAL; | 686 | err = -EINVAL; |
687 | goto error; | 687 | goto error; |
688 | } | 688 | } |
@@ -702,7 +702,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
702 | * See header comment for this file for more | 702 | * See header comment for this file for more |
703 | * explanations about the reasons we have this check. | 703 | * explanations about the reasons we have this check. |
704 | */ | 704 | */ |
705 | ubifs_err("corrupt empty space LEB %d:%d, corruption starts at %d", | 705 | ubifs_err(c, "corrupt empty space LEB %d:%d, corruption starts at %d", |
706 | lnum, offs, corruption); | 706 | lnum, offs, corruption); |
707 | /* Make sure we dump interesting non-0xFF data */ | 707 | /* Make sure we dump interesting non-0xFF data */ |
708 | offs += corruption; | 708 | offs += corruption; |
@@ -788,13 +788,13 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
788 | 788 | ||
789 | corrupted_rescan: | 789 | corrupted_rescan: |
790 | /* Re-scan the corrupted data with verbose messages */ | 790 | /* Re-scan the corrupted data with verbose messages */ |
791 | ubifs_err("corruption %d", ret); | 791 | ubifs_err(c, "corruption %d", ret); |
792 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); | 792 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); |
793 | corrupted: | 793 | corrupted: |
794 | ubifs_scanned_corruption(c, lnum, offs, buf); | 794 | ubifs_scanned_corruption(c, lnum, offs, buf); |
795 | err = -EUCLEAN; | 795 | err = -EUCLEAN; |
796 | error: | 796 | error: |
797 | ubifs_err("LEB %d scanning failed", lnum); | 797 | ubifs_err(c, "LEB %d scanning failed", lnum); |
798 | ubifs_scan_destroy(sleb); | 798 | ubifs_scan_destroy(sleb); |
799 | return ERR_PTR(err); | 799 | return ERR_PTR(err); |
800 | } | 800 | } |
@@ -826,15 +826,15 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, | |||
826 | goto out_free; | 826 | goto out_free; |
827 | 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); |
828 | if (ret != SCANNED_A_NODE) { | 828 | if (ret != SCANNED_A_NODE) { |
829 | ubifs_err("Not a valid node"); | 829 | ubifs_err(c, "Not a valid node"); |
830 | goto out_err; | 830 | goto out_err; |
831 | } | 831 | } |
832 | if (cs_node->ch.node_type != UBIFS_CS_NODE) { | 832 | if (cs_node->ch.node_type != UBIFS_CS_NODE) { |
833 | ubifs_err("Node a CS node, type is %d", cs_node->ch.node_type); | 833 | ubifs_err(c, "Node a CS node, type is %d", cs_node->ch.node_type); |
834 | goto out_err; | 834 | goto out_err; |
835 | } | 835 | } |
836 | if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { | 836 | if (le64_to_cpu(cs_node->cmt_no) != c->cmt_no) { |
837 | ubifs_err("CS node cmt_no %llu != current cmt_no %llu", | 837 | ubifs_err(c, "CS node cmt_no %llu != current cmt_no %llu", |
838 | (unsigned long long)le64_to_cpu(cs_node->cmt_no), | 838 | (unsigned long long)le64_to_cpu(cs_node->cmt_no), |
839 | c->cmt_no); | 839 | c->cmt_no); |
840 | goto out_err; | 840 | goto out_err; |
@@ -847,7 +847,7 @@ static int get_cs_sqnum(struct ubifs_info *c, int lnum, int offs, | |||
847 | out_err: | 847 | out_err: |
848 | err = -EINVAL; | 848 | err = -EINVAL; |
849 | out_free: | 849 | out_free: |
850 | ubifs_err("failed to get CS sqnum"); | 850 | ubifs_err(c, "failed to get CS sqnum"); |
851 | kfree(cs_node); | 851 | kfree(cs_node); |
852 | return err; | 852 | return err; |
853 | } | 853 | } |
@@ -899,7 +899,7 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | |||
899 | } | 899 | } |
900 | } | 900 | } |
901 | if (snod->sqnum > cs_sqnum) { | 901 | if (snod->sqnum > cs_sqnum) { |
902 | ubifs_err("unrecoverable log corruption in LEB %d", | 902 | ubifs_err(c, "unrecoverable log corruption in LEB %d", |
903 | lnum); | 903 | lnum); |
904 | ubifs_scan_destroy(sleb); | 904 | ubifs_scan_destroy(sleb); |
905 | return ERR_PTR(-EUCLEAN); | 905 | return ERR_PTR(-EUCLEAN); |
@@ -1037,7 +1037,7 @@ static int clean_an_unclean_leb(struct ubifs_info *c, | |||
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | if (ret == SCANNED_EMPTY_SPACE) { | 1039 | if (ret == SCANNED_EMPTY_SPACE) { |
1040 | ubifs_err("unexpected empty space at %d:%d", | 1040 | ubifs_err(c, "unexpected empty space at %d:%d", |
1041 | lnum, offs); | 1041 | lnum, offs); |
1042 | return -EUCLEAN; | 1042 | return -EUCLEAN; |
1043 | } | 1043 | } |
@@ -1131,7 +1131,7 @@ static int grab_empty_leb(struct ubifs_info *c) | |||
1131 | */ | 1131 | */ |
1132 | lnum = ubifs_find_free_leb_for_idx(c); | 1132 | lnum = ubifs_find_free_leb_for_idx(c); |
1133 | if (lnum < 0) { | 1133 | if (lnum < 0) { |
1134 | ubifs_err("could not find an empty LEB"); | 1134 | ubifs_err(c, "could not find an empty LEB"); |
1135 | ubifs_dump_lprops(c); | 1135 | ubifs_dump_lprops(c); |
1136 | ubifs_dump_budg(c, &c->bi); | 1136 | ubifs_dump_budg(c, &c->bi); |
1137 | return lnum; | 1137 | return lnum; |
@@ -1211,7 +1211,7 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c) | |||
1211 | } | 1211 | } |
1212 | mutex_unlock(&wbuf->io_mutex); | 1212 | mutex_unlock(&wbuf->io_mutex); |
1213 | if (err < 0) { | 1213 | if (err < 0) { |
1214 | ubifs_err("GC failed, error %d", err); | 1214 | ubifs_err(c, "GC failed, error %d", err); |
1215 | if (err == -EAGAIN) | 1215 | if (err == -EAGAIN) |
1216 | err = -EINVAL; | 1216 | err = -EINVAL; |
1217 | return err; | 1217 | return err; |
@@ -1458,7 +1458,7 @@ static int fix_size_in_place(struct ubifs_info *c, struct size_entry *e) | |||
1458 | return 0; | 1458 | return 0; |
1459 | 1459 | ||
1460 | out: | 1460 | out: |
1461 | ubifs_warn("inode %lu failed to fix size %lld -> %lld error %d", | 1461 | ubifs_warn(c, "inode %lu failed to fix size %lld -> %lld error %d", |
1462 | (unsigned long)e->inum, e->i_size, e->d_size, err); | 1462 | (unsigned long)e->inum, e->i_size, e->d_size, err); |
1463 | return err; | 1463 | return err; |
1464 | } | 1464 | } |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 9b40a1c5e160..3ca4540130b5 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -458,13 +458,13 @@ int ubifs_validate_entry(struct ubifs_info *c, | |||
458 | nlen > UBIFS_MAX_NLEN || dent->name[nlen] != 0 || | 458 | nlen > UBIFS_MAX_NLEN || dent->name[nlen] != 0 || |
459 | strnlen(dent->name, nlen) != nlen || | 459 | strnlen(dent->name, nlen) != nlen || |
460 | le64_to_cpu(dent->inum) > MAX_INUM) { | 460 | le64_to_cpu(dent->inum) > MAX_INUM) { |
461 | ubifs_err("bad %s node", key_type == UBIFS_DENT_KEY ? | 461 | ubifs_err(c, "bad %s node", key_type == UBIFS_DENT_KEY ? |
462 | "directory entry" : "extended attribute entry"); | 462 | "directory entry" : "extended attribute entry"); |
463 | return -EINVAL; | 463 | return -EINVAL; |
464 | } | 464 | } |
465 | 465 | ||
466 | if (key_type != UBIFS_DENT_KEY && key_type != UBIFS_XENT_KEY) { | 466 | if (key_type != UBIFS_DENT_KEY && key_type != UBIFS_XENT_KEY) { |
467 | ubifs_err("bad key type %d", key_type); | 467 | ubifs_err(c, "bad key type %d", key_type); |
468 | return -EINVAL; | 468 | return -EINVAL; |
469 | } | 469 | } |
470 | 470 | ||
@@ -589,7 +589,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
589 | cond_resched(); | 589 | cond_resched(); |
590 | 590 | ||
591 | if (snod->sqnum >= SQNUM_WATERMARK) { | 591 | if (snod->sqnum >= SQNUM_WATERMARK) { |
592 | ubifs_err("file system's life ended"); | 592 | ubifs_err(c, "file system's life ended"); |
593 | goto out_dump; | 593 | goto out_dump; |
594 | } | 594 | } |
595 | 595 | ||
@@ -647,7 +647,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
647 | if (old_size < 0 || old_size > c->max_inode_sz || | 647 | if (old_size < 0 || old_size > c->max_inode_sz || |
648 | new_size < 0 || new_size > c->max_inode_sz || | 648 | new_size < 0 || new_size > c->max_inode_sz || |
649 | old_size <= new_size) { | 649 | old_size <= new_size) { |
650 | ubifs_err("bad truncation node"); | 650 | ubifs_err(c, "bad truncation node"); |
651 | goto out_dump; | 651 | goto out_dump; |
652 | } | 652 | } |
653 | 653 | ||
@@ -662,7 +662,7 @@ static int replay_bud(struct ubifs_info *c, struct bud_entry *b) | |||
662 | break; | 662 | break; |
663 | } | 663 | } |
664 | default: | 664 | default: |
665 | ubifs_err("unexpected node type %d in bud LEB %d:%d", | 665 | ubifs_err(c, "unexpected node type %d in bud LEB %d:%d", |
666 | snod->type, lnum, snod->offs); | 666 | snod->type, lnum, snod->offs); |
667 | err = -EINVAL; | 667 | err = -EINVAL; |
668 | goto out_dump; | 668 | goto out_dump; |
@@ -685,7 +685,7 @@ out: | |||
685 | return err; | 685 | return err; |
686 | 686 | ||
687 | out_dump: | 687 | out_dump: |
688 | ubifs_err("bad node is at LEB %d:%d", lnum, snod->offs); | 688 | ubifs_err(c, "bad node is at LEB %d:%d", lnum, snod->offs); |
689 | ubifs_dump_node(c, snod->node); | 689 | ubifs_dump_node(c, snod->node); |
690 | ubifs_scan_destroy(sleb); | 690 | ubifs_scan_destroy(sleb); |
691 | return -EINVAL; | 691 | return -EINVAL; |
@@ -805,7 +805,7 @@ static int validate_ref(struct ubifs_info *c, const struct ubifs_ref_node *ref) | |||
805 | if (bud) { | 805 | if (bud) { |
806 | if (bud->jhead == jhead && bud->start <= offs) | 806 | if (bud->jhead == jhead && bud->start <= offs) |
807 | return 1; | 807 | return 1; |
808 | ubifs_err("bud at LEB %d:%d was already referred", lnum, offs); | 808 | ubifs_err(c, "bud at LEB %d:%d was already referred", lnum, offs); |
809 | return -EINVAL; | 809 | return -EINVAL; |
810 | } | 810 | } |
811 | 811 | ||
@@ -861,12 +861,12 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
861 | * numbers. | 861 | * numbers. |
862 | */ | 862 | */ |
863 | if (snod->type != UBIFS_CS_NODE) { | 863 | if (snod->type != UBIFS_CS_NODE) { |
864 | ubifs_err("first log node at LEB %d:%d is not CS node", | 864 | ubifs_err(c, "first log node at LEB %d:%d is not CS node", |
865 | lnum, offs); | 865 | lnum, offs); |
866 | goto out_dump; | 866 | goto out_dump; |
867 | } | 867 | } |
868 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { | 868 | if (le64_to_cpu(node->cmt_no) != c->cmt_no) { |
869 | ubifs_err("first CS node at LEB %d:%d has wrong commit number %llu expected %llu", | 869 | ubifs_err(c, "first CS node at LEB %d:%d has wrong commit number %llu expected %llu", |
870 | lnum, offs, | 870 | lnum, offs, |
871 | (unsigned long long)le64_to_cpu(node->cmt_no), | 871 | (unsigned long long)le64_to_cpu(node->cmt_no), |
872 | c->cmt_no); | 872 | c->cmt_no); |
@@ -891,7 +891,7 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
891 | 891 | ||
892 | /* 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 */ |
893 | if (snod->offs != 0) { | 893 | if (snod->offs != 0) { |
894 | ubifs_err("first node is not at zero offset"); | 894 | ubifs_err(c, "first node is not at zero offset"); |
895 | goto out_dump; | 895 | goto out_dump; |
896 | } | 896 | } |
897 | 897 | ||
@@ -899,12 +899,12 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
899 | cond_resched(); | 899 | cond_resched(); |
900 | 900 | ||
901 | if (snod->sqnum >= SQNUM_WATERMARK) { | 901 | if (snod->sqnum >= SQNUM_WATERMARK) { |
902 | ubifs_err("file system's life ended"); | 902 | ubifs_err(c, "file system's life ended"); |
903 | goto out_dump; | 903 | goto out_dump; |
904 | } | 904 | } |
905 | 905 | ||
906 | if (snod->sqnum < c->cs_sqnum) { | 906 | if (snod->sqnum < c->cs_sqnum) { |
907 | ubifs_err("bad sqnum %llu, commit sqnum %llu", | 907 | ubifs_err(c, "bad sqnum %llu, commit sqnum %llu", |
908 | snod->sqnum, c->cs_sqnum); | 908 | snod->sqnum, c->cs_sqnum); |
909 | goto out_dump; | 909 | goto out_dump; |
910 | } | 910 | } |
@@ -934,12 +934,12 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
934 | case UBIFS_CS_NODE: | 934 | case UBIFS_CS_NODE: |
935 | /* Make sure it sits at the beginning of LEB */ | 935 | /* Make sure it sits at the beginning of LEB */ |
936 | if (snod->offs != 0) { | 936 | if (snod->offs != 0) { |
937 | ubifs_err("unexpected node in log"); | 937 | ubifs_err(c, "unexpected node in log"); |
938 | goto out_dump; | 938 | goto out_dump; |
939 | } | 939 | } |
940 | break; | 940 | break; |
941 | default: | 941 | default: |
942 | ubifs_err("unexpected node in log"); | 942 | ubifs_err(c, "unexpected node in log"); |
943 | goto out_dump; | 943 | goto out_dump; |
944 | } | 944 | } |
945 | } | 945 | } |
@@ -955,7 +955,7 @@ out: | |||
955 | return err; | 955 | return err; |
956 | 956 | ||
957 | out_dump: | 957 | out_dump: |
958 | ubifs_err("log error detected while replaying the log at LEB %d:%d", | 958 | ubifs_err(c, "log error detected while replaying the log at LEB %d:%d", |
959 | lnum, offs + snod->offs); | 959 | lnum, offs + snod->offs); |
960 | ubifs_dump_node(c, snod->node); | 960 | ubifs_dump_node(c, snod->node); |
961 | ubifs_scan_destroy(sleb); | 961 | ubifs_scan_destroy(sleb); |
@@ -1017,7 +1017,7 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
1017 | return free; /* Error code */ | 1017 | return free; /* Error code */ |
1018 | 1018 | ||
1019 | if (c->ihead_offs != c->leb_size - free) { | 1019 | if (c->ihead_offs != c->leb_size - free) { |
1020 | ubifs_err("bad index head LEB %d:%d", c->ihead_lnum, | 1020 | ubifs_err(c, "bad index head LEB %d:%d", c->ihead_lnum, |
1021 | c->ihead_offs); | 1021 | c->ihead_offs); |
1022 | return -EINVAL; | 1022 | return -EINVAL; |
1023 | } | 1023 | } |
@@ -1040,7 +1040,7 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
1040 | * someting went wrong and we cannot proceed mounting | 1040 | * someting went wrong and we cannot proceed mounting |
1041 | * the file-system. | 1041 | * the file-system. |
1042 | */ | 1042 | */ |
1043 | ubifs_err("no UBIFS nodes found at the log head LEB %d:%d, possibly corrupted", | 1043 | ubifs_err(c, "no UBIFS nodes found at the log head LEB %d:%d, possibly corrupted", |
1044 | lnum, 0); | 1044 | lnum, 0); |
1045 | err = -EINVAL; | 1045 | err = -EINVAL; |
1046 | } | 1046 | } |
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 79c6dbbc0e04..f4fbc7b6b794 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c | |||
@@ -335,7 +335,7 @@ static int create_default_filesystem(struct ubifs_info *c) | |||
335 | if (err) | 335 | if (err) |
336 | return err; | 336 | return err; |
337 | 337 | ||
338 | ubifs_msg("default file-system created"); | 338 | ubifs_msg(c, "default file-system created"); |
339 | return 0; | 339 | return 0; |
340 | } | 340 | } |
341 | 341 | ||
@@ -365,13 +365,13 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
365 | } | 365 | } |
366 | 366 | ||
367 | if (le32_to_cpu(sup->min_io_size) != c->min_io_size) { | 367 | if (le32_to_cpu(sup->min_io_size) != c->min_io_size) { |
368 | ubifs_err("min. I/O unit mismatch: %d in superblock, %d real", | 368 | ubifs_err(c, "min. I/O unit mismatch: %d in superblock, %d real", |
369 | le32_to_cpu(sup->min_io_size), c->min_io_size); | 369 | le32_to_cpu(sup->min_io_size), c->min_io_size); |
370 | goto failed; | 370 | goto failed; |
371 | } | 371 | } |
372 | 372 | ||
373 | if (le32_to_cpu(sup->leb_size) != c->leb_size) { | 373 | if (le32_to_cpu(sup->leb_size) != c->leb_size) { |
374 | ubifs_err("LEB size mismatch: %d in superblock, %d real", | 374 | ubifs_err(c, "LEB size mismatch: %d in superblock, %d real", |
375 | le32_to_cpu(sup->leb_size), c->leb_size); | 375 | le32_to_cpu(sup->leb_size), c->leb_size); |
376 | goto failed; | 376 | goto failed; |
377 | } | 377 | } |
@@ -393,33 +393,33 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
393 | min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; | 393 | min_leb_cnt += c->lpt_lebs + c->orph_lebs + c->jhead_cnt + 6; |
394 | 394 | ||
395 | if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { | 395 | if (c->leb_cnt < min_leb_cnt || c->leb_cnt > c->vi.size) { |
396 | ubifs_err("bad LEB count: %d in superblock, %d on UBI volume, %d minimum required", | 396 | ubifs_err(c, "bad LEB count: %d in superblock, %d on UBI volume, %d minimum required", |
397 | c->leb_cnt, c->vi.size, min_leb_cnt); | 397 | c->leb_cnt, c->vi.size, min_leb_cnt); |
398 | goto failed; | 398 | goto failed; |
399 | } | 399 | } |
400 | 400 | ||
401 | if (c->max_leb_cnt < c->leb_cnt) { | 401 | if (c->max_leb_cnt < c->leb_cnt) { |
402 | ubifs_err("max. LEB count %d less than LEB count %d", | 402 | ubifs_err(c, "max. LEB count %d less than LEB count %d", |
403 | c->max_leb_cnt, c->leb_cnt); | 403 | c->max_leb_cnt, c->leb_cnt); |
404 | goto failed; | 404 | goto failed; |
405 | } | 405 | } |
406 | 406 | ||
407 | if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) { | 407 | if (c->main_lebs < UBIFS_MIN_MAIN_LEBS) { |
408 | ubifs_err("too few main LEBs count %d, must be at least %d", | 408 | ubifs_err(c, "too few main LEBs count %d, must be at least %d", |
409 | c->main_lebs, UBIFS_MIN_MAIN_LEBS); | 409 | c->main_lebs, UBIFS_MIN_MAIN_LEBS); |
410 | goto failed; | 410 | goto failed; |
411 | } | 411 | } |
412 | 412 | ||
413 | max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; | 413 | max_bytes = (long long)c->leb_size * UBIFS_MIN_BUD_LEBS; |
414 | if (c->max_bud_bytes < max_bytes) { | 414 | if (c->max_bud_bytes < max_bytes) { |
415 | ubifs_err("too small journal (%lld bytes), must be at least %lld bytes", | 415 | ubifs_err(c, "too small journal (%lld bytes), must be at least %lld bytes", |
416 | c->max_bud_bytes, max_bytes); | 416 | c->max_bud_bytes, max_bytes); |
417 | goto failed; | 417 | goto failed; |
418 | } | 418 | } |
419 | 419 | ||
420 | max_bytes = (long long)c->leb_size * c->main_lebs; | 420 | max_bytes = (long long)c->leb_size * c->main_lebs; |
421 | if (c->max_bud_bytes > max_bytes) { | 421 | if (c->max_bud_bytes > max_bytes) { |
422 | ubifs_err("too large journal size (%lld bytes), only %lld bytes available in the main area", | 422 | ubifs_err(c, "too large journal size (%lld bytes), only %lld bytes available in the main area", |
423 | c->max_bud_bytes, max_bytes); | 423 | c->max_bud_bytes, max_bytes); |
424 | goto failed; | 424 | goto failed; |
425 | } | 425 | } |
@@ -468,7 +468,7 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup) | |||
468 | return 0; | 468 | return 0; |
469 | 469 | ||
470 | failed: | 470 | failed: |
471 | ubifs_err("bad superblock, error %d", err); | 471 | ubifs_err(c, "bad superblock, error %d", err); |
472 | ubifs_dump_node(c, sup); | 472 | ubifs_dump_node(c, sup); |
473 | return -EINVAL; | 473 | return -EINVAL; |
474 | } | 474 | } |
@@ -549,12 +549,12 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
549 | ubifs_assert(!c->ro_media || c->ro_mount); | 549 | ubifs_assert(!c->ro_media || c->ro_mount); |
550 | if (!c->ro_mount || | 550 | if (!c->ro_mount || |
551 | c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { | 551 | c->ro_compat_version > UBIFS_RO_COMPAT_VERSION) { |
552 | ubifs_err("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", | 552 | ubifs_err(c, "on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", |
553 | c->fmt_version, c->ro_compat_version, | 553 | c->fmt_version, c->ro_compat_version, |
554 | UBIFS_FORMAT_VERSION, | 554 | UBIFS_FORMAT_VERSION, |
555 | UBIFS_RO_COMPAT_VERSION); | 555 | UBIFS_RO_COMPAT_VERSION); |
556 | if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { | 556 | if (c->ro_compat_version <= UBIFS_RO_COMPAT_VERSION) { |
557 | ubifs_msg("only R/O mounting is possible"); | 557 | ubifs_msg(c, "only R/O mounting is possible"); |
558 | err = -EROFS; | 558 | err = -EROFS; |
559 | } else | 559 | } else |
560 | err = -EINVAL; | 560 | err = -EINVAL; |
@@ -570,7 +570,7 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
570 | } | 570 | } |
571 | 571 | ||
572 | if (c->fmt_version < 3) { | 572 | if (c->fmt_version < 3) { |
573 | ubifs_err("on-flash format version %d is not supported", | 573 | ubifs_err(c, "on-flash format version %d is not supported", |
574 | c->fmt_version); | 574 | c->fmt_version); |
575 | err = -EINVAL; | 575 | err = -EINVAL; |
576 | goto out; | 576 | goto out; |
@@ -595,7 +595,7 @@ int ubifs_read_superblock(struct ubifs_info *c) | |||
595 | c->key_len = UBIFS_SK_LEN; | 595 | c->key_len = UBIFS_SK_LEN; |
596 | break; | 596 | break; |
597 | default: | 597 | default: |
598 | ubifs_err("unsupported key format"); | 598 | ubifs_err(c, "unsupported key format"); |
599 | err = -EINVAL; | 599 | err = -EINVAL; |
600 | goto out; | 600 | goto out; |
601 | } | 601 | } |
@@ -785,7 +785,7 @@ int ubifs_fixup_free_space(struct ubifs_info *c) | |||
785 | ubifs_assert(c->space_fixup); | 785 | ubifs_assert(c->space_fixup); |
786 | ubifs_assert(!c->ro_mount); | 786 | ubifs_assert(!c->ro_mount); |
787 | 787 | ||
788 | ubifs_msg("start fixing up free space"); | 788 | ubifs_msg(c, "start fixing up free space"); |
789 | 789 | ||
790 | err = fixup_free_space(c); | 790 | err = fixup_free_space(c); |
791 | if (err) | 791 | if (err) |
@@ -804,6 +804,6 @@ int ubifs_fixup_free_space(struct ubifs_info *c) | |||
804 | if (err) | 804 | if (err) |
805 | return err; | 805 | return err; |
806 | 806 | ||
807 | ubifs_msg("free space fixup complete"); | 807 | ubifs_msg(c, "free space fixup complete"); |
808 | return err; | 808 | return err; |
809 | } | 809 | } |
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 89adbc4d08ac..aab87340d3de 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c | |||
@@ -100,7 +100,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
100 | if (pad_len < 0 || | 100 | if (pad_len < 0 || |
101 | offs + node_len + pad_len > c->leb_size) { | 101 | offs + node_len + pad_len > c->leb_size) { |
102 | if (!quiet) { | 102 | if (!quiet) { |
103 | ubifs_err("bad pad node at LEB %d:%d", | 103 | ubifs_err(c, "bad pad node at LEB %d:%d", |
104 | lnum, offs); | 104 | lnum, offs); |
105 | ubifs_dump_node(c, pad); | 105 | ubifs_dump_node(c, pad); |
106 | } | 106 | } |
@@ -110,7 +110,7 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void *buf, int len, int lnum, | |||
110 | /* Make the node pads to 8-byte boundary */ | 110 | /* Make the node pads to 8-byte boundary */ |
111 | if ((node_len + pad_len) & 7) { | 111 | if ((node_len + pad_len) & 7) { |
112 | if (!quiet) | 112 | if (!quiet) |
113 | ubifs_err("bad padding length %d - %d", | 113 | ubifs_err(c, "bad padding length %d - %d", |
114 | offs, offs + node_len + pad_len); | 114 | offs, offs + node_len + pad_len); |
115 | return SCANNED_A_BAD_PAD_NODE; | 115 | return SCANNED_A_BAD_PAD_NODE; |
116 | } | 116 | } |
@@ -152,7 +152,7 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum, | |||
152 | 152 | ||
153 | err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); | 153 | err = ubifs_leb_read(c, lnum, sbuf + offs, offs, c->leb_size - offs, 0); |
154 | if (err && err != -EBADMSG) { | 154 | if (err && err != -EBADMSG) { |
155 | ubifs_err("cannot read %d bytes from LEB %d:%d, error %d", | 155 | ubifs_err(c, "cannot read %d bytes from LEB %d:%d, error %d", |
156 | c->leb_size - offs, lnum, offs, err); | 156 | c->leb_size - offs, lnum, offs, err); |
157 | kfree(sleb); | 157 | kfree(sleb); |
158 | return ERR_PTR(err); | 158 | return ERR_PTR(err); |
@@ -240,11 +240,11 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
240 | { | 240 | { |
241 | int len; | 241 | int len; |
242 | 242 | ||
243 | ubifs_err("corruption at LEB %d:%d", lnum, offs); | 243 | ubifs_err(c, "corruption at LEB %d:%d", lnum, offs); |
244 | len = c->leb_size - offs; | 244 | len = c->leb_size - offs; |
245 | if (len > 8192) | 245 | if (len > 8192) |
246 | len = 8192; | 246 | len = 8192; |
247 | ubifs_err("first %d bytes from LEB %d:%d", len, lnum, offs); | 247 | ubifs_err(c, "first %d bytes from LEB %d:%d", len, lnum, offs); |
248 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); | 248 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); |
249 | } | 249 | } |
250 | 250 | ||
@@ -299,16 +299,16 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
299 | 299 | ||
300 | switch (ret) { | 300 | switch (ret) { |
301 | case SCANNED_GARBAGE: | 301 | case SCANNED_GARBAGE: |
302 | ubifs_err("garbage"); | 302 | ubifs_err(c, "garbage"); |
303 | goto corrupted; | 303 | goto corrupted; |
304 | case SCANNED_A_NODE: | 304 | case SCANNED_A_NODE: |
305 | break; | 305 | break; |
306 | case SCANNED_A_CORRUPT_NODE: | 306 | case SCANNED_A_CORRUPT_NODE: |
307 | case SCANNED_A_BAD_PAD_NODE: | 307 | case SCANNED_A_BAD_PAD_NODE: |
308 | ubifs_err("bad node"); | 308 | ubifs_err(c, "bad node"); |
309 | goto corrupted; | 309 | goto corrupted; |
310 | default: | 310 | default: |
311 | ubifs_err("unknown"); | 311 | ubifs_err(c, "unknown"); |
312 | err = -EINVAL; | 312 | err = -EINVAL; |
313 | goto error; | 313 | goto error; |
314 | } | 314 | } |
@@ -325,7 +325,7 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
325 | 325 | ||
326 | if (offs % c->min_io_size) { | 326 | if (offs % c->min_io_size) { |
327 | if (!quiet) | 327 | if (!quiet) |
328 | ubifs_err("empty space starts at non-aligned offset %d", | 328 | ubifs_err(c, "empty space starts at non-aligned offset %d", |
329 | offs); | 329 | offs); |
330 | goto corrupted; | 330 | goto corrupted; |
331 | } | 331 | } |
@@ -338,7 +338,7 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
338 | for (; len; offs++, buf++, len--) | 338 | for (; len; offs++, buf++, len--) |
339 | if (*(uint8_t *)buf != 0xff) { | 339 | if (*(uint8_t *)buf != 0xff) { |
340 | if (!quiet) | 340 | if (!quiet) |
341 | ubifs_err("corrupt empty space at LEB %d:%d", | 341 | ubifs_err(c, "corrupt empty space at LEB %d:%d", |
342 | lnum, offs); | 342 | lnum, offs); |
343 | goto corrupted; | 343 | goto corrupted; |
344 | } | 344 | } |
@@ -348,14 +348,14 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
348 | corrupted: | 348 | corrupted: |
349 | if (!quiet) { | 349 | if (!quiet) { |
350 | ubifs_scanned_corruption(c, lnum, offs, buf); | 350 | ubifs_scanned_corruption(c, lnum, offs, buf); |
351 | ubifs_err("LEB %d scanning failed", lnum); | 351 | ubifs_err(c, "LEB %d scanning failed", lnum); |
352 | } | 352 | } |
353 | err = -EUCLEAN; | 353 | err = -EUCLEAN; |
354 | ubifs_scan_destroy(sleb); | 354 | ubifs_scan_destroy(sleb); |
355 | return ERR_PTR(err); | 355 | return ERR_PTR(err); |
356 | 356 | ||
357 | error: | 357 | error: |
358 | ubifs_err("LEB %d scanning failed, error %d", lnum, err); | 358 | ubifs_err(c, "LEB %d scanning failed, error %d", lnum, err); |
359 | ubifs_scan_destroy(sleb); | 359 | ubifs_scan_destroy(sleb); |
360 | return ERR_PTR(err); | 360 | return ERR_PTR(err); |
361 | } | 361 | } |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 0b7378a7ee04..75e6f04bb795 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -70,13 +70,13 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode) | |||
70 | const struct ubifs_inode *ui = ubifs_inode(inode); | 70 | const struct ubifs_inode *ui = ubifs_inode(inode); |
71 | 71 | ||
72 | if (inode->i_size > c->max_inode_sz) { | 72 | if (inode->i_size > c->max_inode_sz) { |
73 | ubifs_err("inode is too large (%lld)", | 73 | ubifs_err(c, "inode is too large (%lld)", |
74 | (long long)inode->i_size); | 74 | (long long)inode->i_size); |
75 | return 1; | 75 | return 1; |
76 | } | 76 | } |
77 | 77 | ||
78 | if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) { | 78 | if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) { |
79 | ubifs_err("unknown compression type %d", ui->compr_type); | 79 | ubifs_err(c, "unknown compression type %d", ui->compr_type); |
80 | return 2; | 80 | return 2; |
81 | } | 81 | } |
82 | 82 | ||
@@ -90,7 +90,7 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode) | |||
90 | return 5; | 90 | return 5; |
91 | 91 | ||
92 | if (!ubifs_compr_present(ui->compr_type)) { | 92 | if (!ubifs_compr_present(ui->compr_type)) { |
93 | ubifs_warn("inode %lu uses '%s' compression, but it was not compiled in", | 93 | ubifs_warn(c, "inode %lu uses '%s' compression, but it was not compiled in", |
94 | inode->i_ino, ubifs_compr_name(ui->compr_type)); | 94 | inode->i_ino, ubifs_compr_name(ui->compr_type)); |
95 | } | 95 | } |
96 | 96 | ||
@@ -242,14 +242,14 @@ struct inode *ubifs_iget(struct super_block *sb, unsigned long inum) | |||
242 | return inode; | 242 | return inode; |
243 | 243 | ||
244 | out_invalid: | 244 | out_invalid: |
245 | ubifs_err("inode %lu validation failed, error %d", inode->i_ino, err); | 245 | ubifs_err(c, "inode %lu validation failed, error %d", inode->i_ino, err); |
246 | ubifs_dump_node(c, ino); | 246 | ubifs_dump_node(c, ino); |
247 | ubifs_dump_inode(c, inode); | 247 | ubifs_dump_inode(c, inode); |
248 | err = -EINVAL; | 248 | err = -EINVAL; |
249 | out_ino: | 249 | out_ino: |
250 | kfree(ino); | 250 | kfree(ino); |
251 | out: | 251 | out: |
252 | ubifs_err("failed to read inode %lu, error %d", inode->i_ino, err); | 252 | ubifs_err(c, "failed to read inode %lu, error %d", inode->i_ino, err); |
253 | iget_failed(inode); | 253 | iget_failed(inode); |
254 | return ERR_PTR(err); | 254 | return ERR_PTR(err); |
255 | } | 255 | } |
@@ -319,7 +319,7 @@ static int ubifs_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
319 | if (inode->i_nlink) { | 319 | if (inode->i_nlink) { |
320 | err = ubifs_jnl_write_inode(c, inode); | 320 | err = ubifs_jnl_write_inode(c, inode); |
321 | if (err) | 321 | if (err) |
322 | ubifs_err("can't write inode %lu, error %d", | 322 | ubifs_err(c, "can't write inode %lu, error %d", |
323 | inode->i_ino, err); | 323 | inode->i_ino, err); |
324 | else | 324 | else |
325 | err = dbg_check_inode_size(c, inode, ui->ui_size); | 325 | err = dbg_check_inode_size(c, inode, ui->ui_size); |
@@ -363,7 +363,7 @@ static void ubifs_evict_inode(struct inode *inode) | |||
363 | * Worst case we have a lost orphan inode wasting space, so a | 363 | * Worst case we have a lost orphan inode wasting space, so a |
364 | * simple error message is OK here. | 364 | * simple error message is OK here. |
365 | */ | 365 | */ |
366 | ubifs_err("can't delete inode %lu, error %d", | 366 | ubifs_err(c, "can't delete inode %lu, error %d", |
367 | inode->i_ino, err); | 367 | inode->i_ino, err); |
368 | 368 | ||
369 | out: | 369 | out: |
@@ -492,17 +492,17 @@ static int ubifs_sync_fs(struct super_block *sb, int wait) | |||
492 | static int init_constants_early(struct ubifs_info *c) | 492 | static int init_constants_early(struct ubifs_info *c) |
493 | { | 493 | { |
494 | if (c->vi.corrupted) { | 494 | if (c->vi.corrupted) { |
495 | ubifs_warn("UBI volume is corrupted - read-only mode"); | 495 | ubifs_warn(c, "UBI volume is corrupted - read-only mode"); |
496 | c->ro_media = 1; | 496 | c->ro_media = 1; |
497 | } | 497 | } |
498 | 498 | ||
499 | if (c->di.ro_mode) { | 499 | if (c->di.ro_mode) { |
500 | ubifs_msg("read-only UBI device"); | 500 | ubifs_msg(c, "read-only UBI device"); |
501 | c->ro_media = 1; | 501 | c->ro_media = 1; |
502 | } | 502 | } |
503 | 503 | ||
504 | if (c->vi.vol_type == UBI_STATIC_VOLUME) { | 504 | if (c->vi.vol_type == UBI_STATIC_VOLUME) { |
505 | ubifs_msg("static UBI volume - read-only mode"); | 505 | ubifs_msg(c, "static UBI volume - read-only mode"); |
506 | c->ro_media = 1; | 506 | c->ro_media = 1; |
507 | } | 507 | } |
508 | 508 | ||
@@ -516,19 +516,19 @@ static int init_constants_early(struct ubifs_info *c) | |||
516 | c->max_write_shift = fls(c->max_write_size) - 1; | 516 | c->max_write_shift = fls(c->max_write_size) - 1; |
517 | 517 | ||
518 | if (c->leb_size < UBIFS_MIN_LEB_SZ) { | 518 | if (c->leb_size < UBIFS_MIN_LEB_SZ) { |
519 | ubifs_err("too small LEBs (%d bytes), min. is %d bytes", | 519 | ubifs_err(c, "too small LEBs (%d bytes), min. is %d bytes", |
520 | c->leb_size, UBIFS_MIN_LEB_SZ); | 520 | c->leb_size, UBIFS_MIN_LEB_SZ); |
521 | return -EINVAL; | 521 | return -EINVAL; |
522 | } | 522 | } |
523 | 523 | ||
524 | if (c->leb_cnt < UBIFS_MIN_LEB_CNT) { | 524 | if (c->leb_cnt < UBIFS_MIN_LEB_CNT) { |
525 | ubifs_err("too few LEBs (%d), min. is %d", | 525 | ubifs_err(c, "too few LEBs (%d), min. is %d", |
526 | c->leb_cnt, UBIFS_MIN_LEB_CNT); | 526 | c->leb_cnt, UBIFS_MIN_LEB_CNT); |
527 | return -EINVAL; | 527 | return -EINVAL; |
528 | } | 528 | } |
529 | 529 | ||
530 | if (!is_power_of_2(c->min_io_size)) { | 530 | if (!is_power_of_2(c->min_io_size)) { |
531 | ubifs_err("bad min. I/O size %d", c->min_io_size); | 531 | ubifs_err(c, "bad min. I/O size %d", c->min_io_size); |
532 | return -EINVAL; | 532 | return -EINVAL; |
533 | } | 533 | } |
534 | 534 | ||
@@ -539,7 +539,7 @@ static int init_constants_early(struct ubifs_info *c) | |||
539 | if (c->max_write_size < c->min_io_size || | 539 | if (c->max_write_size < c->min_io_size || |
540 | c->max_write_size % c->min_io_size || | 540 | c->max_write_size % c->min_io_size || |
541 | !is_power_of_2(c->max_write_size)) { | 541 | !is_power_of_2(c->max_write_size)) { |
542 | ubifs_err("bad write buffer size %d for %d min. I/O unit", | 542 | ubifs_err(c, "bad write buffer size %d for %d min. I/O unit", |
543 | c->max_write_size, c->min_io_size); | 543 | c->max_write_size, c->min_io_size); |
544 | return -EINVAL; | 544 | return -EINVAL; |
545 | } | 545 | } |
@@ -665,7 +665,7 @@ static int init_constants_sb(struct ubifs_info *c) | |||
665 | tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; | 665 | tmp = UBIFS_CS_NODE_SZ + UBIFS_REF_NODE_SZ * c->jhead_cnt; |
666 | tmp = ALIGN(tmp, c->min_io_size); | 666 | tmp = ALIGN(tmp, c->min_io_size); |
667 | if (tmp > c->leb_size) { | 667 | if (tmp > c->leb_size) { |
668 | ubifs_err("too small LEB size %d, at least %d needed", | 668 | ubifs_err(c, "too small LEB size %d, at least %d needed", |
669 | c->leb_size, tmp); | 669 | c->leb_size, tmp); |
670 | return -EINVAL; | 670 | return -EINVAL; |
671 | } | 671 | } |
@@ -680,7 +680,7 @@ static int init_constants_sb(struct ubifs_info *c) | |||
680 | tmp /= c->leb_size; | 680 | tmp /= c->leb_size; |
681 | tmp += 1; | 681 | tmp += 1; |
682 | if (c->log_lebs < tmp) { | 682 | if (c->log_lebs < tmp) { |
683 | ubifs_err("too small log %d LEBs, required min. %d LEBs", | 683 | ubifs_err(c, "too small log %d LEBs, required min. %d LEBs", |
684 | c->log_lebs, tmp); | 684 | c->log_lebs, tmp); |
685 | return -EINVAL; | 685 | return -EINVAL; |
686 | } | 686 | } |
@@ -772,7 +772,7 @@ static int take_gc_lnum(struct ubifs_info *c) | |||
772 | int err; | 772 | int err; |
773 | 773 | ||
774 | if (c->gc_lnum == -1) { | 774 | if (c->gc_lnum == -1) { |
775 | ubifs_err("no LEB for GC"); | 775 | ubifs_err(c, "no LEB for GC"); |
776 | return -EINVAL; | 776 | return -EINVAL; |
777 | } | 777 | } |
778 | 778 | ||
@@ -857,7 +857,7 @@ static void free_orphans(struct ubifs_info *c) | |||
857 | orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); | 857 | orph = list_entry(c->orph_list.next, struct ubifs_orphan, list); |
858 | list_del(&orph->list); | 858 | list_del(&orph->list); |
859 | kfree(orph); | 859 | kfree(orph); |
860 | ubifs_err("orphan list not empty at unmount"); | 860 | ubifs_err(c, "orphan list not empty at unmount"); |
861 | } | 861 | } |
862 | 862 | ||
863 | vfree(c->orph_buf); | 863 | vfree(c->orph_buf); |
@@ -954,7 +954,8 @@ static const match_table_t tokens = { | |||
954 | */ | 954 | */ |
955 | static int parse_standard_option(const char *option) | 955 | static int parse_standard_option(const char *option) |
956 | { | 956 | { |
957 | ubifs_msg("parse %s", option); | 957 | |
958 | pr_notice("UBIFS: parse %s\n", option); | ||
958 | if (!strcmp(option, "sync")) | 959 | if (!strcmp(option, "sync")) |
959 | return MS_SYNCHRONOUS; | 960 | return MS_SYNCHRONOUS; |
960 | return 0; | 961 | return 0; |
@@ -1026,7 +1027,7 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
1026 | else if (!strcmp(name, "zlib")) | 1027 | else if (!strcmp(name, "zlib")) |
1027 | c->mount_opts.compr_type = UBIFS_COMPR_ZLIB; | 1028 | c->mount_opts.compr_type = UBIFS_COMPR_ZLIB; |
1028 | else { | 1029 | else { |
1029 | ubifs_err("unknown compressor \"%s\"", name); | 1030 | ubifs_err(c, "unknown compressor \"%s\"", name); //FIXME: is c ready? |
1030 | kfree(name); | 1031 | kfree(name); |
1031 | return -EINVAL; | 1032 | return -EINVAL; |
1032 | } | 1033 | } |
@@ -1042,7 +1043,7 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
1042 | 1043 | ||
1043 | flag = parse_standard_option(p); | 1044 | flag = parse_standard_option(p); |
1044 | if (!flag) { | 1045 | if (!flag) { |
1045 | ubifs_err("unrecognized mount option \"%s\" or missing value", | 1046 | ubifs_err(c, "unrecognized mount option \"%s\" or missing value", |
1046 | p); | 1047 | p); |
1047 | return -EINVAL; | 1048 | return -EINVAL; |
1048 | } | 1049 | } |
@@ -1105,7 +1106,7 @@ again: | |||
1105 | } | 1106 | } |
1106 | 1107 | ||
1107 | /* Just disable bulk-read */ | 1108 | /* Just disable bulk-read */ |
1108 | ubifs_warn("cannot allocate %d bytes of memory for bulk-read, disabling it", | 1109 | ubifs_warn(c, "cannot allocate %d bytes of memory for bulk-read, disabling it", |
1109 | c->max_bu_buf_len); | 1110 | c->max_bu_buf_len); |
1110 | c->mount_opts.bulk_read = 1; | 1111 | c->mount_opts.bulk_read = 1; |
1111 | c->bulk_read = 0; | 1112 | c->bulk_read = 0; |
@@ -1124,7 +1125,7 @@ static int check_free_space(struct ubifs_info *c) | |||
1124 | { | 1125 | { |
1125 | ubifs_assert(c->dark_wm > 0); | 1126 | ubifs_assert(c->dark_wm > 0); |
1126 | if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) { | 1127 | if (c->lst.total_free + c->lst.total_dirty < c->dark_wm) { |
1127 | ubifs_err("insufficient free space to mount in R/W mode"); | 1128 | ubifs_err(c, "insufficient free space to mount in R/W mode"); |
1128 | ubifs_dump_budg(c, &c->bi); | 1129 | ubifs_dump_budg(c, &c->bi); |
1129 | ubifs_dump_lprops(c); | 1130 | ubifs_dump_lprops(c); |
1130 | return -ENOSPC; | 1131 | return -ENOSPC; |
@@ -1166,14 +1167,14 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1166 | * This UBI volume is empty, and read-only, or the file system | 1167 | * This UBI volume is empty, and read-only, or the file system |
1167 | * is mounted read-only - we cannot format it. | 1168 | * is mounted read-only - we cannot format it. |
1168 | */ | 1169 | */ |
1169 | ubifs_err("can't format empty UBI volume: read-only %s", | 1170 | ubifs_err(c, "can't format empty UBI volume: read-only %s", |
1170 | c->ro_media ? "UBI volume" : "mount"); | 1171 | c->ro_media ? "UBI volume" : "mount"); |
1171 | err = -EROFS; | 1172 | err = -EROFS; |
1172 | goto out_free; | 1173 | goto out_free; |
1173 | } | 1174 | } |
1174 | 1175 | ||
1175 | if (c->ro_media && !c->ro_mount) { | 1176 | if (c->ro_media && !c->ro_mount) { |
1176 | ubifs_err("cannot mount read-write - read-only media"); | 1177 | ubifs_err(c, "cannot mount read-write - read-only media"); |
1177 | err = -EROFS; | 1178 | err = -EROFS; |
1178 | goto out_free; | 1179 | goto out_free; |
1179 | } | 1180 | } |
@@ -1221,7 +1222,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1221 | * or overridden by mount options is actually compiled in. | 1222 | * or overridden by mount options is actually compiled in. |
1222 | */ | 1223 | */ |
1223 | if (!ubifs_compr_present(c->default_compr)) { | 1224 | if (!ubifs_compr_present(c->default_compr)) { |
1224 | ubifs_err("'compressor \"%s\" is not compiled in", | 1225 | ubifs_err(c, "'compressor \"%s\" is not compiled in", |
1225 | ubifs_compr_name(c->default_compr)); | 1226 | ubifs_compr_name(c->default_compr)); |
1226 | err = -ENOTSUPP; | 1227 | err = -ENOTSUPP; |
1227 | goto out_free; | 1228 | goto out_free; |
@@ -1250,7 +1251,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1250 | if (IS_ERR(c->bgt)) { | 1251 | if (IS_ERR(c->bgt)) { |
1251 | err = PTR_ERR(c->bgt); | 1252 | err = PTR_ERR(c->bgt); |
1252 | c->bgt = NULL; | 1253 | c->bgt = NULL; |
1253 | ubifs_err("cannot spawn \"%s\", error %d", | 1254 | ubifs_err(c, "cannot spawn \"%s\", error %d", |
1254 | c->bgt_name, err); | 1255 | c->bgt_name, err); |
1255 | goto out_wbufs; | 1256 | goto out_wbufs; |
1256 | } | 1257 | } |
@@ -1264,7 +1265,7 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1264 | init_constants_master(c); | 1265 | init_constants_master(c); |
1265 | 1266 | ||
1266 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { | 1267 | if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) { |
1267 | ubifs_msg("recovery needed"); | 1268 | ubifs_msg(c, "recovery needed"); |
1268 | c->need_recovery = 1; | 1269 | c->need_recovery = 1; |
1269 | } | 1270 | } |
1270 | 1271 | ||
@@ -1373,10 +1374,10 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1373 | 1374 | ||
1374 | if (c->need_recovery) { | 1375 | if (c->need_recovery) { |
1375 | if (c->ro_mount) | 1376 | if (c->ro_mount) |
1376 | ubifs_msg("recovery deferred"); | 1377 | ubifs_msg(c, "recovery deferred"); |
1377 | else { | 1378 | else { |
1378 | c->need_recovery = 0; | 1379 | c->need_recovery = 0; |
1379 | ubifs_msg("recovery completed"); | 1380 | ubifs_msg(c, "recovery completed"); |
1380 | /* | 1381 | /* |
1381 | * GC LEB has to be empty and taken at this point. But | 1382 | * GC LEB has to be empty and taken at this point. But |
1382 | * the journal head LEBs may also be accounted as | 1383 | * the journal head LEBs may also be accounted as |
@@ -1397,20 +1398,20 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1397 | 1398 | ||
1398 | c->mounting = 0; | 1399 | c->mounting = 0; |
1399 | 1400 | ||
1400 | ubifs_msg("mounted UBI device %d, volume %d, name \"%s\"%s", | 1401 | ubifs_msg(c, "UBIFS: mounted UBI device %d, volume %d, name \"%s\"%s", |
1401 | c->vi.ubi_num, c->vi.vol_id, c->vi.name, | 1402 | c->vi.ubi_num, c->vi.vol_id, c->vi.name, |
1402 | c->ro_mount ? ", R/O mode" : ""); | 1403 | c->ro_mount ? ", R/O mode" : ""); |
1403 | x = (long long)c->main_lebs * c->leb_size; | 1404 | x = (long long)c->main_lebs * c->leb_size; |
1404 | y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; | 1405 | y = (long long)c->log_lebs * c->leb_size + c->max_bud_bytes; |
1405 | ubifs_msg("LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes", | 1406 | ubifs_msg(c, "LEB size: %d bytes (%d KiB), min./max. I/O unit sizes: %d bytes/%d bytes", |
1406 | c->leb_size, c->leb_size >> 10, c->min_io_size, | 1407 | c->leb_size, c->leb_size >> 10, c->min_io_size, |
1407 | c->max_write_size); | 1408 | c->max_write_size); |
1408 | ubifs_msg("FS size: %lld bytes (%lld MiB, %d LEBs), journal size %lld bytes (%lld MiB, %d LEBs)", | 1409 | ubifs_msg(c, "FS size: %lld bytes (%lld MiB, %d LEBs), journal size %lld bytes (%lld MiB, %d LEBs)", |
1409 | x, x >> 20, c->main_lebs, | 1410 | x, x >> 20, c->main_lebs, |
1410 | y, y >> 20, c->log_lebs + c->max_bud_cnt); | 1411 | y, y >> 20, c->log_lebs + c->max_bud_cnt); |
1411 | ubifs_msg("reserved for root: %llu bytes (%llu KiB)", | 1412 | ubifs_msg(c, "reserved for root: %llu bytes (%llu KiB)", |
1412 | c->report_rp_size, c->report_rp_size >> 10); | 1413 | c->report_rp_size, c->report_rp_size >> 10); |
1413 | ubifs_msg("media format: w%d/r%d (latest is w%d/r%d), UUID %pUB%s", | 1414 | ubifs_msg(c, "media format: w%d/r%d (latest is w%d/r%d), UUID %pUB%s", |
1414 | c->fmt_version, c->ro_compat_version, | 1415 | c->fmt_version, c->ro_compat_version, |
1415 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION, c->uuid, | 1416 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION, c->uuid, |
1416 | c->big_lpt ? ", big LPT model" : ", small LPT model"); | 1417 | c->big_lpt ? ", big LPT model" : ", small LPT model"); |
@@ -1543,8 +1544,8 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1543 | int err, lnum; | 1544 | int err, lnum; |
1544 | 1545 | ||
1545 | if (c->rw_incompat) { | 1546 | if (c->rw_incompat) { |
1546 | ubifs_err("the file-system is not R/W-compatible"); | 1547 | ubifs_err(c, "the file-system is not R/W-compatible"); |
1547 | ubifs_msg("on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", | 1548 | ubifs_msg(c, "on-flash format version is w%d/r%d, but software only supports up to version w%d/r%d", |
1548 | c->fmt_version, c->ro_compat_version, | 1549 | c->fmt_version, c->ro_compat_version, |
1549 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); | 1550 | UBIFS_FORMAT_VERSION, UBIFS_RO_COMPAT_VERSION); |
1550 | return -EROFS; | 1551 | return -EROFS; |
@@ -1581,7 +1582,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1581 | } | 1582 | } |
1582 | 1583 | ||
1583 | if (c->need_recovery) { | 1584 | if (c->need_recovery) { |
1584 | ubifs_msg("completing deferred recovery"); | 1585 | ubifs_msg(c, "completing deferred recovery"); |
1585 | err = ubifs_write_rcvrd_mst_node(c); | 1586 | err = ubifs_write_rcvrd_mst_node(c); |
1586 | if (err) | 1587 | if (err) |
1587 | goto out; | 1588 | goto out; |
@@ -1630,7 +1631,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1630 | if (IS_ERR(c->bgt)) { | 1631 | if (IS_ERR(c->bgt)) { |
1631 | err = PTR_ERR(c->bgt); | 1632 | err = PTR_ERR(c->bgt); |
1632 | c->bgt = NULL; | 1633 | c->bgt = NULL; |
1633 | ubifs_err("cannot spawn \"%s\", error %d", | 1634 | ubifs_err(c, "cannot spawn \"%s\", error %d", |
1634 | c->bgt_name, err); | 1635 | c->bgt_name, err); |
1635 | goto out; | 1636 | goto out; |
1636 | } | 1637 | } |
@@ -1664,7 +1665,7 @@ static int ubifs_remount_rw(struct ubifs_info *c) | |||
1664 | 1665 | ||
1665 | if (c->need_recovery) { | 1666 | if (c->need_recovery) { |
1666 | c->need_recovery = 0; | 1667 | c->need_recovery = 0; |
1667 | ubifs_msg("deferred recovery completed"); | 1668 | ubifs_msg(c, "deferred recovery completed"); |
1668 | } else { | 1669 | } else { |
1669 | /* | 1670 | /* |
1670 | * Do not run the debugging space check if the were doing | 1671 | * Do not run the debugging space check if the were doing |
@@ -1752,8 +1753,7 @@ static void ubifs_put_super(struct super_block *sb) | |||
1752 | int i; | 1753 | int i; |
1753 | struct ubifs_info *c = sb->s_fs_info; | 1754 | struct ubifs_info *c = sb->s_fs_info; |
1754 | 1755 | ||
1755 | ubifs_msg("un-mount UBI device %d, volume %d", c->vi.ubi_num, | 1756 | ubifs_msg(c, "un-mount UBI device %d", c->vi.ubi_num); |
1756 | c->vi.vol_id); | ||
1757 | 1757 | ||
1758 | /* | 1758 | /* |
1759 | * The following asserts are only valid if there has not been a failure | 1759 | * The following asserts are only valid if there has not been a failure |
@@ -1809,7 +1809,7 @@ static void ubifs_put_super(struct super_block *sb) | |||
1809 | * next mount, so we just print a message and | 1809 | * next mount, so we just print a message and |
1810 | * continue to unmount normally. | 1810 | * continue to unmount normally. |
1811 | */ | 1811 | */ |
1812 | ubifs_err("failed to write master node, error %d", | 1812 | ubifs_err(c, "failed to write master node, error %d", |
1813 | err); | 1813 | err); |
1814 | } else { | 1814 | } else { |
1815 | for (i = 0; i < c->jhead_cnt; i++) | 1815 | for (i = 0; i < c->jhead_cnt; i++) |
@@ -1834,17 +1834,17 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1834 | 1834 | ||
1835 | err = ubifs_parse_options(c, data, 1); | 1835 | err = ubifs_parse_options(c, data, 1); |
1836 | if (err) { | 1836 | if (err) { |
1837 | ubifs_err("invalid or unknown remount parameter"); | 1837 | ubifs_err(c, "invalid or unknown remount parameter"); |
1838 | return err; | 1838 | return err; |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | if (c->ro_mount && !(*flags & MS_RDONLY)) { | 1841 | if (c->ro_mount && !(*flags & MS_RDONLY)) { |
1842 | if (c->ro_error) { | 1842 | if (c->ro_error) { |
1843 | ubifs_msg("cannot re-mount R/W due to prior errors"); | 1843 | ubifs_msg(c, "cannot re-mount R/W due to prior errors"); |
1844 | return -EROFS; | 1844 | return -EROFS; |
1845 | } | 1845 | } |
1846 | if (c->ro_media) { | 1846 | if (c->ro_media) { |
1847 | ubifs_msg("cannot re-mount R/W - UBI volume is R/O"); | 1847 | ubifs_msg(c, "cannot re-mount R/W - UBI volume is R/O"); |
1848 | return -EROFS; | 1848 | return -EROFS; |
1849 | } | 1849 | } |
1850 | err = ubifs_remount_rw(c); | 1850 | err = ubifs_remount_rw(c); |
@@ -1852,7 +1852,7 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data) | |||
1852 | return err; | 1852 | return err; |
1853 | } else if (!c->ro_mount && (*flags & MS_RDONLY)) { | 1853 | } else if (!c->ro_mount && (*flags & MS_RDONLY)) { |
1854 | if (c->ro_error) { | 1854 | if (c->ro_error) { |
1855 | ubifs_msg("cannot re-mount R/O due to prior errors"); | 1855 | ubifs_msg(c, "cannot re-mount R/O due to prior errors"); |
1856 | return -EROFS; | 1856 | return -EROFS; |
1857 | } | 1857 | } |
1858 | ubifs_remount_ro(c); | 1858 | ubifs_remount_ro(c); |
@@ -2104,8 +2104,8 @@ static struct dentry *ubifs_mount(struct file_system_type *fs_type, int flags, | |||
2104 | */ | 2104 | */ |
2105 | ubi = open_ubi(name, UBI_READONLY); | 2105 | ubi = open_ubi(name, UBI_READONLY); |
2106 | if (IS_ERR(ubi)) { | 2106 | if (IS_ERR(ubi)) { |
2107 | ubifs_err("cannot open \"%s\", error %d", | 2107 | pr_err("UBIFS error (pid: %d): cannot open \"%s\", error %d", |
2108 | name, (int)PTR_ERR(ubi)); | 2108 | current->pid, name, (int)PTR_ERR(ubi)); |
2109 | return ERR_CAST(ubi); | 2109 | return ERR_CAST(ubi); |
2110 | } | 2110 | } |
2111 | 2111 | ||
@@ -2233,8 +2233,8 @@ static int __init ubifs_init(void) | |||
2233 | * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. | 2233 | * UBIFS_BLOCK_SIZE. It is assumed that both are powers of 2. |
2234 | */ | 2234 | */ |
2235 | if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) { | 2235 | if (PAGE_CACHE_SIZE < UBIFS_BLOCK_SIZE) { |
2236 | ubifs_err("VFS page cache size is %u bytes, but UBIFS requires at least 4096 bytes", | 2236 | pr_err("UBIFS error (pid %d): VFS page cache size is %u bytes, but UBIFS requires at least 4096 bytes", |
2237 | (unsigned int)PAGE_CACHE_SIZE); | 2237 | current->pid, (unsigned int)PAGE_CACHE_SIZE); |
2238 | return -EINVAL; | 2238 | return -EINVAL; |
2239 | } | 2239 | } |
2240 | 2240 | ||
@@ -2257,7 +2257,8 @@ static int __init ubifs_init(void) | |||
2257 | 2257 | ||
2258 | err = register_filesystem(&ubifs_fs_type); | 2258 | err = register_filesystem(&ubifs_fs_type); |
2259 | if (err) { | 2259 | if (err) { |
2260 | ubifs_err("cannot register file system, error %d", err); | 2260 | pr_err("UBIFS error (pid %d): cannot register file system, error %d", |
2261 | current->pid, err); | ||
2261 | goto out_dbg; | 2262 | goto out_dbg; |
2262 | } | 2263 | } |
2263 | return 0; | 2264 | return 0; |
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 6793db0754f6..957f5757f374 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c | |||
@@ -98,7 +98,7 @@ static int insert_old_idx(struct ubifs_info *c, int lnum, int offs) | |||
98 | else if (offs > o->offs) | 98 | else if (offs > o->offs) |
99 | p = &(*p)->rb_right; | 99 | p = &(*p)->rb_right; |
100 | else { | 100 | else { |
101 | ubifs_err("old idx added twice!"); | 101 | ubifs_err(c, "old idx added twice!"); |
102 | kfree(old_idx); | 102 | kfree(old_idx); |
103 | return 0; | 103 | return 0; |
104 | } | 104 | } |
@@ -447,7 +447,7 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type, | |||
447 | 447 | ||
448 | err = ubifs_leb_read(c, lnum, buf, offs, len, 1); | 448 | err = ubifs_leb_read(c, lnum, buf, offs, len, 1); |
449 | if (err) { | 449 | if (err) { |
450 | ubifs_err("cannot read node type %d from LEB %d:%d, error %d", | 450 | ubifs_err(c, "cannot read node type %d from LEB %d:%d, error %d", |
451 | type, lnum, offs, err); | 451 | type, lnum, offs, err); |
452 | return err; | 452 | return err; |
453 | } | 453 | } |
@@ -1684,27 +1684,27 @@ static int validate_data_node(struct ubifs_info *c, void *buf, | |||
1684 | int err, len; | 1684 | int err, len; |
1685 | 1685 | ||
1686 | if (ch->node_type != UBIFS_DATA_NODE) { | 1686 | if (ch->node_type != UBIFS_DATA_NODE) { |
1687 | ubifs_err("bad node type (%d but expected %d)", | 1687 | ubifs_err(c, "bad node type (%d but expected %d)", |
1688 | ch->node_type, UBIFS_DATA_NODE); | 1688 | ch->node_type, UBIFS_DATA_NODE); |
1689 | goto out_err; | 1689 | goto out_err; |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); | 1692 | err = ubifs_check_node(c, buf, zbr->lnum, zbr->offs, 0, 0); |
1693 | if (err) { | 1693 | if (err) { |
1694 | ubifs_err("expected node type %d", UBIFS_DATA_NODE); | 1694 | ubifs_err(c, "expected node type %d", UBIFS_DATA_NODE); |
1695 | goto out; | 1695 | goto out; |
1696 | } | 1696 | } |
1697 | 1697 | ||
1698 | len = le32_to_cpu(ch->len); | 1698 | len = le32_to_cpu(ch->len); |
1699 | if (len != zbr->len) { | 1699 | if (len != zbr->len) { |
1700 | ubifs_err("bad node length %d, expected %d", len, zbr->len); | 1700 | ubifs_err(c, "bad node length %d, expected %d", len, zbr->len); |
1701 | goto out_err; | 1701 | goto out_err; |
1702 | } | 1702 | } |
1703 | 1703 | ||
1704 | /* Make sure the key of the read node is correct */ | 1704 | /* Make sure the key of the read node is correct */ |
1705 | key_read(c, buf + UBIFS_KEY_OFFSET, &key1); | 1705 | key_read(c, buf + UBIFS_KEY_OFFSET, &key1); |
1706 | if (!keys_eq(c, &zbr->key, &key1)) { | 1706 | if (!keys_eq(c, &zbr->key, &key1)) { |
1707 | ubifs_err("bad key in node at LEB %d:%d", | 1707 | ubifs_err(c, "bad key in node at LEB %d:%d", |
1708 | zbr->lnum, zbr->offs); | 1708 | zbr->lnum, zbr->offs); |
1709 | dbg_tnck(&zbr->key, "looked for key "); | 1709 | dbg_tnck(&zbr->key, "looked for key "); |
1710 | dbg_tnck(&key1, "found node's key "); | 1710 | dbg_tnck(&key1, "found node's key "); |
@@ -1716,7 +1716,7 @@ static int validate_data_node(struct ubifs_info *c, void *buf, | |||
1716 | out_err: | 1716 | out_err: |
1717 | err = -EINVAL; | 1717 | err = -EINVAL; |
1718 | out: | 1718 | out: |
1719 | ubifs_err("bad node at LEB %d:%d", zbr->lnum, zbr->offs); | 1719 | ubifs_err(c, "bad node at LEB %d:%d", zbr->lnum, zbr->offs); |
1720 | ubifs_dump_node(c, buf); | 1720 | ubifs_dump_node(c, buf); |
1721 | dump_stack(); | 1721 | dump_stack(); |
1722 | return err; | 1722 | return err; |
@@ -1741,7 +1741,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu) | |||
1741 | len = bu->zbranch[bu->cnt - 1].offs; | 1741 | len = bu->zbranch[bu->cnt - 1].offs; |
1742 | len += bu->zbranch[bu->cnt - 1].len - offs; | 1742 | len += bu->zbranch[bu->cnt - 1].len - offs; |
1743 | if (len > bu->buf_len) { | 1743 | if (len > bu->buf_len) { |
1744 | ubifs_err("buffer too small %d vs %d", bu->buf_len, len); | 1744 | ubifs_err(c, "buffer too small %d vs %d", bu->buf_len, len); |
1745 | return -EINVAL; | 1745 | return -EINVAL; |
1746 | } | 1746 | } |
1747 | 1747 | ||
@@ -1757,7 +1757,7 @@ int ubifs_tnc_bulk_read(struct ubifs_info *c, struct bu_info *bu) | |||
1757 | return -EAGAIN; | 1757 | return -EAGAIN; |
1758 | 1758 | ||
1759 | if (err && err != -EBADMSG) { | 1759 | if (err && err != -EBADMSG) { |
1760 | ubifs_err("failed to read from LEB %d:%d, error %d", | 1760 | ubifs_err(c, "failed to read from LEB %d:%d, error %d", |
1761 | lnum, offs, err); | 1761 | lnum, offs, err); |
1762 | dump_stack(); | 1762 | dump_stack(); |
1763 | dbg_tnck(&bu->key, "key "); | 1763 | dbg_tnck(&bu->key, "key "); |
@@ -3313,7 +3313,7 @@ int dbg_check_inode_size(struct ubifs_info *c, const struct inode *inode, | |||
3313 | 3313 | ||
3314 | out_dump: | 3314 | out_dump: |
3315 | block = key_block(c, key); | 3315 | block = key_block(c, key); |
3316 | ubifs_err("inode %lu has size %lld, but there are data at offset %lld", | 3316 | ubifs_err(c, "inode %lu has size %lld, but there are data at offset %lld", |
3317 | (unsigned long)inode->i_ino, size, | 3317 | (unsigned long)inode->i_ino, size, |
3318 | ((loff_t)block) << UBIFS_BLOCK_SHIFT); | 3318 | ((loff_t)block) << UBIFS_BLOCK_SHIFT); |
3319 | mutex_unlock(&c->tnc_mutex); | 3319 | mutex_unlock(&c->tnc_mutex); |
diff --git a/fs/ubifs/tnc_commit.c b/fs/ubifs/tnc_commit.c index 7a205e046776..b45345d701e7 100644 --- a/fs/ubifs/tnc_commit.c +++ b/fs/ubifs/tnc_commit.c | |||
@@ -53,7 +53,7 @@ static int make_idx_node(struct ubifs_info *c, struct ubifs_idx_node *idx, | |||
53 | br->offs = cpu_to_le32(zbr->offs); | 53 | br->offs = cpu_to_le32(zbr->offs); |
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(c, "bad ref in znode"); |
57 | ubifs_dump_znode(c, znode); | 57 | ubifs_dump_znode(c, znode); |
58 | if (zbr->znode) | 58 | if (zbr->znode) |
59 | ubifs_dump_znode(c, zbr->znode); | 59 | ubifs_dump_znode(c, zbr->znode); |
@@ -384,7 +384,7 @@ static int layout_in_gaps(struct ubifs_info *c, int cnt) | |||
384 | * Do not print scary warnings if the debugging | 384 | * Do not print scary warnings if the debugging |
385 | * option which forces in-the-gaps is enabled. | 385 | * option which forces in-the-gaps is enabled. |
386 | */ | 386 | */ |
387 | ubifs_warn("out of space"); | 387 | ubifs_warn(c, "out of space"); |
388 | ubifs_dump_budg(c, &c->bi); | 388 | ubifs_dump_budg(c, &c->bi); |
389 | ubifs_dump_lprops(c); | 389 | ubifs_dump_lprops(c); |
390 | } | 390 | } |
@@ -441,7 +441,7 @@ static int layout_in_empty_space(struct ubifs_info *c) | |||
441 | /* Determine the index node position */ | 441 | /* Determine the index node position */ |
442 | if (lnum == -1) { | 442 | if (lnum == -1) { |
443 | if (c->ileb_nxt >= c->ileb_cnt) { | 443 | if (c->ileb_nxt >= c->ileb_cnt) { |
444 | ubifs_err("out of space"); | 444 | ubifs_err(c, "out of space"); |
445 | return -ENOSPC; | 445 | return -ENOSPC; |
446 | } | 446 | } |
447 | lnum = c->ilebs[c->ileb_nxt++]; | 447 | lnum = c->ilebs[c->ileb_nxt++]; |
@@ -855,7 +855,7 @@ static int write_index(struct ubifs_info *c) | |||
855 | br->offs = cpu_to_le32(zbr->offs); | 855 | br->offs = cpu_to_le32(zbr->offs); |
856 | br->len = cpu_to_le32(zbr->len); | 856 | br->len = cpu_to_le32(zbr->len); |
857 | if (!zbr->lnum || !zbr->len) { | 857 | if (!zbr->lnum || !zbr->len) { |
858 | ubifs_err("bad ref in znode"); | 858 | ubifs_err(c, "bad ref in znode"); |
859 | ubifs_dump_znode(c, znode); | 859 | ubifs_dump_znode(c, znode); |
860 | if (zbr->znode) | 860 | if (zbr->znode) |
861 | ubifs_dump_znode(c, zbr->znode); | 861 | ubifs_dump_znode(c, zbr->znode); |
@@ -875,7 +875,7 @@ static int write_index(struct ubifs_info *c) | |||
875 | 875 | ||
876 | if (lnum != znode->lnum || offs != znode->offs || | 876 | if (lnum != znode->lnum || offs != znode->offs || |
877 | len != znode->len) { | 877 | len != znode->len) { |
878 | ubifs_err("inconsistent znode posn"); | 878 | ubifs_err(c, "inconsistent znode posn"); |
879 | return -EINVAL; | 879 | return -EINVAL; |
880 | } | 880 | } |
881 | 881 | ||
@@ -973,7 +973,7 @@ static int write_index(struct ubifs_info *c) | |||
973 | 973 | ||
974 | if (lnum != c->dbg->new_ihead_lnum || | 974 | if (lnum != c->dbg->new_ihead_lnum || |
975 | buf_offs != c->dbg->new_ihead_offs) { | 975 | buf_offs != c->dbg->new_ihead_offs) { |
976 | ubifs_err("inconsistent ihead"); | 976 | ubifs_err(c, "inconsistent ihead"); |
977 | return -EINVAL; | 977 | return -EINVAL; |
978 | } | 978 | } |
979 | 979 | ||
diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c index f6bf8995c7b1..93f5b7859e6f 100644 --- a/fs/ubifs/tnc_misc.c +++ b/fs/ubifs/tnc_misc.c | |||
@@ -293,9 +293,9 @@ 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 | ubifs_err("current fanout %d, branch count %d", | 296 | ubifs_err(c, "current fanout %d, branch count %d", |
297 | c->fanout, znode->child_cnt); | 297 | c->fanout, znode->child_cnt); |
298 | ubifs_err("max levels %d, znode level %d", | 298 | ubifs_err(c, "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; |
@@ -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 | ubifs_err("bad branch %d", i); | 319 | ubifs_err(c, "bad branch %d", i); |
320 | err = 2; | 320 | err = 2; |
321 | goto out_dump; | 321 | goto out_dump; |
322 | } | 322 | } |
@@ -328,7 +328,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
328 | case UBIFS_XENT_KEY: | 328 | case UBIFS_XENT_KEY: |
329 | break; | 329 | break; |
330 | default: | 330 | default: |
331 | ubifs_err("bad key type at slot %d: %d", | 331 | ubifs_err(c, "bad key type at slot %d: %d", |
332 | i, key_type(c, &zbr->key)); | 332 | i, key_type(c, &zbr->key)); |
333 | err = 3; | 333 | err = 3; |
334 | goto out_dump; | 334 | goto out_dump; |
@@ -340,17 +340,17 @@ 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 | ubifs_err("bad target node (type %d) length (%d)", | 343 | ubifs_err(c, "bad target node (type %d) length (%d)", |
344 | type, zbr->len); | 344 | type, zbr->len); |
345 | ubifs_err("have to be %d", c->ranges[type].len); | 345 | ubifs_err(c, "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 | ubifs_err("bad target node (type %d) length (%d)", | 351 | ubifs_err(c, "bad target node (type %d) length (%d)", |
352 | type, zbr->len); | 352 | type, zbr->len); |
353 | ubifs_err("have to be in range of %d-%d", | 353 | ubifs_err(c, "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; |
@@ -370,12 +370,12 @@ 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 | ubifs_err("bad key order (keys %d and %d)", i, i + 1); | 373 | ubifs_err(c, "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 | ubifs_err("keys %d and %d are not hashed but equivalent", | 378 | ubifs_err(c, "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; |
@@ -386,7 +386,7 @@ static int read_znode(struct ubifs_info *c, int lnum, int offs, int len, | |||
386 | return 0; | 386 | return 0; |
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(c, "bad indexing node at LEB %d:%d, error %d", lnum, offs, err); |
390 | ubifs_dump_node(c, idx); | 390 | ubifs_dump_node(c, idx); |
391 | kfree(idx); | 391 | kfree(idx); |
392 | return -EINVAL; | 392 | return -EINVAL; |
@@ -482,7 +482,7 @@ int ubifs_tnc_read_node(struct ubifs_info *c, struct ubifs_zbranch *zbr, | |||
482 | /* Make sure the key of the read node is correct */ | 482 | /* Make sure the key of the read node is correct */ |
483 | key_read(c, node + UBIFS_KEY_OFFSET, &key1); | 483 | key_read(c, node + UBIFS_KEY_OFFSET, &key1); |
484 | if (!keys_eq(c, key, &key1)) { | 484 | if (!keys_eq(c, key, &key1)) { |
485 | ubifs_err("bad key in node at LEB %d:%d", | 485 | ubifs_err(c, "bad key in node at LEB %d:%d", |
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 "); |
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 2911d2d23456..de759022f3d6 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -43,15 +43,19 @@ | |||
43 | #define UBIFS_VERSION 1 | 43 | #define UBIFS_VERSION 1 |
44 | 44 | ||
45 | /* Normal UBIFS messages */ | 45 | /* Normal UBIFS messages */ |
46 | #define ubifs_msg(fmt, ...) pr_notice("UBIFS: " fmt "\n", ##__VA_ARGS__) | 46 | #define ubifs_msg(c, fmt, ...) \ |
47 | pr_notice("UBIFS (ubi%d:%d): " fmt "\n", \ | ||
48 | (c)->vi.ubi_num, (c)->vi.vol_id, ##__VA_ARGS__) | ||
47 | /* UBIFS error messages */ | 49 | /* UBIFS error messages */ |
48 | #define ubifs_err(fmt, ...) \ | 50 | #define ubifs_err(c, fmt, ...) \ |
49 | pr_err("UBIFS error (pid %d): %s: " fmt "\n", current->pid, \ | 51 | pr_err("UBIFS error (ubi%d:%d pid %d): %s: " fmt "\n", \ |
52 | (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \ | ||
50 | __func__, ##__VA_ARGS__) | 53 | __func__, ##__VA_ARGS__) |
51 | /* UBIFS warning messages */ | 54 | /* UBIFS warning messages */ |
52 | #define ubifs_warn(fmt, ...) \ | 55 | #define ubifs_warn(c, fmt, ...) \ |
53 | pr_warn("UBIFS warning (pid %d): %s: " fmt "\n", \ | 56 | pr_warn("UBIFS warning (ubi%d:%d pid %d): %s: " fmt "\n", \ |
54 | current->pid, __func__, ##__VA_ARGS__) | 57 | (c)->vi.ubi_num, (c)->vi.vol_id, current->pid, \ |
58 | __func__, ##__VA_ARGS__) | ||
55 | /* | 59 | /* |
56 | * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description | 60 | * A variant of 'ubifs_err()' which takes the UBIFS file-sytem description |
57 | * object as an argument. | 61 | * object as an argument. |
@@ -59,7 +63,7 @@ | |||
59 | #define ubifs_errc(c, fmt, ...) \ | 63 | #define ubifs_errc(c, fmt, ...) \ |
60 | do { \ | 64 | do { \ |
61 | if (!(c)->probing) \ | 65 | if (!(c)->probing) \ |
62 | ubifs_err(fmt, ##__VA_ARGS__); \ | 66 | ubifs_err(c, fmt, ##__VA_ARGS__); \ |
63 | } while (0) | 67 | } while (0) |
64 | 68 | ||
65 | /* UBIFS file system VFS magic number */ | 69 | /* UBIFS file system VFS magic number */ |
@@ -1787,10 +1791,10 @@ long ubifs_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg); | |||
1787 | /* compressor.c */ | 1791 | /* compressor.c */ |
1788 | int __init ubifs_compressors_init(void); | 1792 | int __init ubifs_compressors_init(void); |
1789 | void ubifs_compressors_exit(void); | 1793 | void ubifs_compressors_exit(void); |
1790 | void ubifs_compress(const void *in_buf, int in_len, void *out_buf, int *out_len, | 1794 | void ubifs_compress(const struct ubifs_info *c, const void *in_buf, int in_len, |
1791 | int *compr_type); | 1795 | void *out_buf, int *out_len, int *compr_type); |
1792 | int ubifs_decompress(const void *buf, int len, void *out, int *out_len, | 1796 | int ubifs_decompress(const struct ubifs_info *c, const void *buf, int len, |
1793 | int compr_type); | 1797 | void *out, int *out_len, int compr_type); |
1794 | 1798 | ||
1795 | #include "debug.h" | 1799 | #include "debug.h" |
1796 | #include "misc.h" | 1800 | #include "misc.h" |
diff --git a/fs/ubifs/xattr.c b/fs/ubifs/xattr.c index a92be244a6fb..3659b1934500 100644 --- a/fs/ubifs/xattr.c +++ b/fs/ubifs/xattr.c | |||
@@ -108,7 +108,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, | |||
108 | .dirtied_ino_d = ALIGN(host_ui->data_len, 8) }; | 108 | .dirtied_ino_d = ALIGN(host_ui->data_len, 8) }; |
109 | 109 | ||
110 | if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) { | 110 | if (host_ui->xattr_cnt >= MAX_XATTRS_PER_INODE) { |
111 | ubifs_err("inode %lu already has too many xattrs (%d), cannot create more", | 111 | ubifs_err(c, "inode %lu already has too many xattrs (%d), cannot create more", |
112 | host->i_ino, host_ui->xattr_cnt); | 112 | host->i_ino, host_ui->xattr_cnt); |
113 | return -ENOSPC; | 113 | return -ENOSPC; |
114 | } | 114 | } |
@@ -120,7 +120,7 @@ static int create_xattr(struct ubifs_info *c, struct inode *host, | |||
120 | */ | 120 | */ |
121 | names_len = host_ui->xattr_names + host_ui->xattr_cnt + nm->len + 1; | 121 | names_len = host_ui->xattr_names + host_ui->xattr_cnt + nm->len + 1; |
122 | if (names_len > XATTR_LIST_MAX) { | 122 | if (names_len > XATTR_LIST_MAX) { |
123 | ubifs_err("cannot add one more xattr name to inode %lu, total names length would become %d, max. is %d", | 123 | ubifs_err(c, "cannot add one more xattr name to inode %lu, total names length would become %d, max. is %d", |
124 | host->i_ino, names_len, XATTR_LIST_MAX); | 124 | host->i_ino, names_len, XATTR_LIST_MAX); |
125 | return -ENOSPC; | 125 | return -ENOSPC; |
126 | } | 126 | } |
@@ -288,13 +288,13 @@ static struct inode *iget_xattr(struct ubifs_info *c, ino_t inum) | |||
288 | 288 | ||
289 | inode = ubifs_iget(c->vfs_sb, inum); | 289 | inode = ubifs_iget(c->vfs_sb, inum); |
290 | if (IS_ERR(inode)) { | 290 | if (IS_ERR(inode)) { |
291 | ubifs_err("dead extended attribute entry, error %d", | 291 | ubifs_err(c, "dead extended attribute entry, error %d", |
292 | (int)PTR_ERR(inode)); | 292 | (int)PTR_ERR(inode)); |
293 | return inode; | 293 | return inode; |
294 | } | 294 | } |
295 | if (ubifs_inode(inode)->xattr) | 295 | if (ubifs_inode(inode)->xattr) |
296 | return inode; | 296 | return inode; |
297 | ubifs_err("corrupt extended attribute entry"); | 297 | ubifs_err(c, "corrupt extended attribute entry"); |
298 | iput(inode); | 298 | iput(inode); |
299 | return ERR_PTR(-EINVAL); | 299 | return ERR_PTR(-EINVAL); |
300 | } | 300 | } |
@@ -412,7 +412,7 @@ ssize_t ubifs_getxattr(struct dentry *dentry, const char *name, void *buf, | |||
412 | if (buf) { | 412 | if (buf) { |
413 | /* If @buf is %NULL we are supposed to return the length */ | 413 | /* If @buf is %NULL we are supposed to return the length */ |
414 | if (ui->data_len > size) { | 414 | if (ui->data_len > size) { |
415 | ubifs_err("buffer size %zd, xattr len %d", | 415 | ubifs_err(c, "buffer size %zd, xattr len %d", |
416 | size, ui->data_len); | 416 | size, ui->data_len); |
417 | err = -ERANGE; | 417 | err = -ERANGE; |
418 | goto out_iput; | 418 | goto out_iput; |
@@ -485,7 +485,7 @@ ssize_t ubifs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
485 | 485 | ||
486 | kfree(pxent); | 486 | kfree(pxent); |
487 | if (err != -ENOENT) { | 487 | if (err != -ENOENT) { |
488 | ubifs_err("cannot find next direntry, error %d", err); | 488 | ubifs_err(c, "cannot find next direntry, error %d", err); |
489 | return err; | 489 | return err; |
490 | } | 490 | } |
491 | 491 | ||
@@ -657,8 +657,10 @@ int ubifs_init_security(struct inode *dentry, struct inode *inode, | |||
657 | &init_xattrs, 0); | 657 | &init_xattrs, 0); |
658 | mutex_unlock(&inode->i_mutex); | 658 | mutex_unlock(&inode->i_mutex); |
659 | 659 | ||
660 | if (err) | 660 | if (err) { |
661 | ubifs_err("cannot initialize security for inode %lu, error %d", | 661 | struct ubifs_info *c = dentry->i_sb->s_fs_info; |
662 | ubifs_err(c, "cannot initialize security for inode %lu, error %d", | ||
662 | inode->i_ino, err); | 663 | inode->i_ino, err); |
664 | } | ||
663 | return err; | 665 | return err; |
664 | } | 666 | } |