aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ubifs/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ubifs/io.c')
-rw-r--r--fs/ubifs/io.c40
1 files changed, 20 insertions, 20 deletions
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
290out_len: 290out_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);
293out: 293out:
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
835out: 835out:
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
954out: 954out:
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;