diff options
author | Joe Perches <joe@perches.com> | 2012-02-15 18:56:43 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-03-26 19:39:24 -0400 |
commit | 9c261b33a9c417ccaf07f41796be278d09d02d49 (patch) | |
tree | 6cf47f47364647dfbba845c0fd3f05539072175a /fs/jffs2/read.c | |
parent | bf011f2ed53d587fdd8148c173c4f09ed77bdf1a (diff) |
jffs2: Convert most D1/D2 macros to jffs2_dbg
D1 and D2 macros are mostly uses to emit debugging messages.
Convert the logging uses of D1 & D2 to jffs2_dbg(level, fmt, ...)
to be a bit more consistent style with the rest of the kernel.
All jffs2_dbg output is now at KERN_DEBUG where some of
the previous uses were emitted at various KERN_<LEVEL>s.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'fs/jffs2/read.c')
-rw-r--r-- | fs/jffs2/read.c | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/fs/jffs2/read.c b/fs/jffs2/read.c index 3f39be1b0455..835dc5d28055 100644 --- a/fs/jffs2/read.c +++ b/fs/jffs2/read.c | |||
@@ -47,10 +47,10 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
47 | } | 47 | } |
48 | crc = crc32(0, ri, sizeof(*ri)-8); | 48 | crc = crc32(0, ri, sizeof(*ri)-8); |
49 | 49 | ||
50 | D1(printk(KERN_DEBUG "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n", | 50 | jffs2_dbg(1, "Node read from %08x: node_crc %08x, calculated CRC %08x. dsize %x, csize %x, offset %x, buf %p\n", |
51 | ref_offset(fd->raw), je32_to_cpu(ri->node_crc), | 51 | ref_offset(fd->raw), je32_to_cpu(ri->node_crc), |
52 | crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), | 52 | crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), |
53 | je32_to_cpu(ri->offset), buf)); | 53 | je32_to_cpu(ri->offset), buf); |
54 | if (crc != je32_to_cpu(ri->node_crc)) { | 54 | if (crc != je32_to_cpu(ri->node_crc)) { |
55 | printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", | 55 | printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", |
56 | je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw)); | 56 | je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw)); |
@@ -107,8 +107,8 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
107 | decomprbuf = readbuf; | 107 | decomprbuf = readbuf; |
108 | } | 108 | } |
109 | 109 | ||
110 | D2(printk(KERN_DEBUG "Read %d bytes to %p\n", je32_to_cpu(ri->csize), | 110 | jffs2_dbg(2, "Read %d bytes to %p\n", je32_to_cpu(ri->csize), |
111 | readbuf)); | 111 | readbuf); |
112 | ret = jffs2_flash_read(c, (ref_offset(fd->raw)) + sizeof(*ri), | 112 | ret = jffs2_flash_read(c, (ref_offset(fd->raw)) + sizeof(*ri), |
113 | je32_to_cpu(ri->csize), &readlen, readbuf); | 113 | je32_to_cpu(ri->csize), &readlen, readbuf); |
114 | 114 | ||
@@ -124,10 +124,11 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
124 | ret = -EIO; | 124 | ret = -EIO; |
125 | goto out_decomprbuf; | 125 | goto out_decomprbuf; |
126 | } | 126 | } |
127 | D2(printk(KERN_DEBUG "Data CRC matches calculated CRC %08x\n", crc)); | 127 | jffs2_dbg(2, "Data CRC matches calculated CRC %08x\n", crc); |
128 | if (ri->compr != JFFS2_COMPR_NONE) { | 128 | if (ri->compr != JFFS2_COMPR_NONE) { |
129 | D2(printk(KERN_DEBUG "Decompress %d bytes from %p to %d bytes at %p\n", | 129 | jffs2_dbg(2, "Decompress %d bytes from %p to %d bytes at %p\n", |
130 | je32_to_cpu(ri->csize), readbuf, je32_to_cpu(ri->dsize), decomprbuf)); | 130 | je32_to_cpu(ri->csize), readbuf, |
131 | je32_to_cpu(ri->dsize), decomprbuf); | ||
131 | ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize)); | 132 | ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize)); |
132 | if (ret) { | 133 | if (ret) { |
133 | printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); | 134 | printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); |
@@ -157,8 +158,8 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
157 | struct jffs2_node_frag *frag; | 158 | struct jffs2_node_frag *frag; |
158 | int ret; | 159 | int ret; |
159 | 160 | ||
160 | D1(printk(KERN_DEBUG "jffs2_read_inode_range: ino #%u, range 0x%08x-0x%08x\n", | 161 | jffs2_dbg(1, "%s(): ino #%u, range 0x%08x-0x%08x\n", |
161 | f->inocache->ino, offset, offset+len)); | 162 | __func__, f->inocache->ino, offset, offset + len); |
162 | 163 | ||
163 | frag = jffs2_lookup_node_frag(&f->fragtree, offset); | 164 | frag = jffs2_lookup_node_frag(&f->fragtree, offset); |
164 | 165 | ||
@@ -168,22 +169,27 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
168 | * (or perhaps is before it, if we've been asked to read off the | 169 | * (or perhaps is before it, if we've been asked to read off the |
169 | * end of the file). */ | 170 | * end of the file). */ |
170 | while(offset < end) { | 171 | while(offset < end) { |
171 | D2(printk(KERN_DEBUG "jffs2_read_inode_range: offset %d, end %d\n", offset, end)); | 172 | jffs2_dbg(2, "%s(): offset %d, end %d\n", |
173 | __func__, offset, end); | ||
172 | if (unlikely(!frag || frag->ofs > offset || | 174 | if (unlikely(!frag || frag->ofs > offset || |
173 | frag->ofs + frag->size <= offset)) { | 175 | frag->ofs + frag->size <= offset)) { |
174 | uint32_t holesize = end - offset; | 176 | uint32_t holesize = end - offset; |
175 | if (frag && frag->ofs > offset) { | 177 | if (frag && frag->ofs > offset) { |
176 | D1(printk(KERN_NOTICE "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", f->inocache->ino, frag->ofs, offset)); | 178 | jffs2_dbg(1, "Eep. Hole in ino #%u fraglist. frag->ofs = 0x%08x, offset = 0x%08x\n", |
179 | f->inocache->ino, frag->ofs, offset); | ||
177 | holesize = min(holesize, frag->ofs - offset); | 180 | holesize = min(holesize, frag->ofs - offset); |
178 | } | 181 | } |
179 | D1(printk(KERN_DEBUG "Filling non-frag hole from %d-%d\n", offset, offset+holesize)); | 182 | jffs2_dbg(1, "Filling non-frag hole from %d-%d\n", |
183 | offset, offset + holesize); | ||
180 | memset(buf, 0, holesize); | 184 | memset(buf, 0, holesize); |
181 | buf += holesize; | 185 | buf += holesize; |
182 | offset += holesize; | 186 | offset += holesize; |
183 | continue; | 187 | continue; |
184 | } else if (unlikely(!frag->node)) { | 188 | } else if (unlikely(!frag->node)) { |
185 | uint32_t holeend = min(end, frag->ofs + frag->size); | 189 | uint32_t holeend = min(end, frag->ofs + frag->size); |
186 | D1(printk(KERN_DEBUG "Filling frag hole from %d-%d (frag 0x%x 0x%x)\n", offset, holeend, frag->ofs, frag->ofs + frag->size)); | 190 | jffs2_dbg(1, "Filling frag hole from %d-%d (frag 0x%x 0x%x)\n", |
191 | offset, holeend, frag->ofs, | ||
192 | frag->ofs + frag->size); | ||
187 | memset(buf, 0, holeend - offset); | 193 | memset(buf, 0, holeend - offset); |
188 | buf += holeend - offset; | 194 | buf += holeend - offset; |
189 | offset = holeend; | 195 | offset = holeend; |
@@ -195,20 +201,23 @@ int jffs2_read_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f, | |||
195 | 201 | ||
196 | fragofs = offset - frag->ofs; | 202 | fragofs = offset - frag->ofs; |
197 | readlen = min(frag->size - fragofs, end - offset); | 203 | readlen = min(frag->size - fragofs, end - offset); |
198 | D1(printk(KERN_DEBUG "Reading %d-%d from node at 0x%08x (%d)\n", | 204 | jffs2_dbg(1, "Reading %d-%d from node at 0x%08x (%d)\n", |
199 | frag->ofs+fragofs, frag->ofs+fragofs+readlen, | 205 | frag->ofs+fragofs, |
200 | ref_offset(frag->node->raw), ref_flags(frag->node->raw))); | 206 | frag->ofs + fragofs+readlen, |
207 | ref_offset(frag->node->raw), | ||
208 | ref_flags(frag->node->raw)); | ||
201 | ret = jffs2_read_dnode(c, f, frag->node, buf, fragofs + frag->ofs - frag->node->ofs, readlen); | 209 | ret = jffs2_read_dnode(c, f, frag->node, buf, fragofs + frag->ofs - frag->node->ofs, readlen); |
202 | D2(printk(KERN_DEBUG "node read done\n")); | 210 | jffs2_dbg(2, "node read done\n"); |
203 | if (ret) { | 211 | if (ret) { |
204 | D1(printk(KERN_DEBUG"jffs2_read_inode_range error %d\n",ret)); | 212 | jffs2_dbg(1, "%s(): error %d\n", |
213 | __func__, ret); | ||
205 | memset(buf, 0, readlen); | 214 | memset(buf, 0, readlen); |
206 | return ret; | 215 | return ret; |
207 | } | 216 | } |
208 | buf += readlen; | 217 | buf += readlen; |
209 | offset += readlen; | 218 | offset += readlen; |
210 | frag = frag_next(frag); | 219 | frag = frag_next(frag); |
211 | D2(printk(KERN_DEBUG "node read was OK. Looping\n")); | 220 | jffs2_dbg(2, "node read was OK. Looping\n"); |
212 | } | 221 | } |
213 | } | 222 | } |
214 | return 0; | 223 | return 0; |