aboutsummaryrefslogtreecommitdiffstats
path: root/fs/jffs2/write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/jffs2/write.c')
-rw-r--r--fs/jffs2/write.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/fs/jffs2/write.c b/fs/jffs2/write.c
index e137839a157d..d98b22036738 100644
--- a/fs/jffs2/write.c
+++ b/fs/jffs2/write.c
@@ -68,7 +68,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
68 unsigned long cnt = 2; 68 unsigned long cnt = 2;
69 69
70 D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) { 70 D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
71 printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n"); 71 pr_crit("Eep. CRC not correct in jffs2_write_dnode()\n");
72 BUG(); 72 BUG();
73 } 73 }
74 ); 74 );
@@ -78,7 +78,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
78 vecs[1].iov_len = datalen; 78 vecs[1].iov_len = datalen;
79 79
80 if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { 80 if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
81 printk(KERN_WARNING "jffs2_write_dnode: ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n", je32_to_cpu(ri->totlen), sizeof(*ri), datalen); 81 pr_warn("%s(): ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n",
82 __func__, je32_to_cpu(ri->totlen),
83 sizeof(*ri), datalen);
82 } 84 }
83 85
84 fn = jffs2_alloc_full_dnode(); 86 fn = jffs2_alloc_full_dnode();
@@ -106,8 +108,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
106 (alloc_mode==ALLOC_GC)?0:f->inocache->ino); 108 (alloc_mode==ALLOC_GC)?0:f->inocache->ino);
107 109
108 if (ret || (retlen != sizeof(*ri) + datalen)) { 110 if (ret || (retlen != sizeof(*ri) + datalen)) {
109 printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", 111 pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
110 sizeof(*ri)+datalen, flash_ofs, ret, retlen); 112 sizeof(*ri) + datalen, flash_ofs, ret, retlen);
111 113
112 /* Mark the space as dirtied */ 114 /* Mark the space as dirtied */
113 if (retlen) { 115 if (retlen) {
@@ -118,7 +120,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
118 this node */ 120 this node */
119 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL); 121 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL);
120 } else { 122 } else {
121 printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); 123 pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
124 flash_ofs);
122 } 125 }
123 if (!retried && alloc_mode != ALLOC_NORETRY) { 126 if (!retried && alloc_mode != ALLOC_NORETRY) {
124 /* Try to reallocate space and retry */ 127 /* Try to reallocate space and retry */
@@ -214,17 +217,17 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
214 je32_to_cpu(rd->name_crc)); 217 je32_to_cpu(rd->name_crc));
215 218
216 D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { 219 D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
217 printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n"); 220 pr_crit("Eep. CRC not correct in jffs2_write_dirent()\n");
218 BUG(); 221 BUG();
219 }); 222 });
220 223
221 if (strnlen(name, namelen) != namelen) { 224 if (strnlen(name, namelen) != namelen) {
222 /* This should never happen, but seems to have done on at least one 225 /* This should never happen, but seems to have done on at least one
223 occasion: https://dev.laptop.org/ticket/4184 */ 226 occasion: https://dev.laptop.org/ticket/4184 */
224 printk(KERN_CRIT "Error in jffs2_write_dirent() -- name contains zero bytes!\n"); 227 pr_crit("Error in jffs2_write_dirent() -- name contains zero bytes!\n");
225 printk(KERN_CRIT "Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n", 228 pr_crit("Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n",
226 je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino), 229 je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
227 je32_to_cpu(rd->name_crc)); 230 je32_to_cpu(rd->name_crc));
228 WARN_ON(1); 231 WARN_ON(1);
229 return ERR_PTR(-EIO); 232 return ERR_PTR(-EIO);
230 } 233 }
@@ -263,13 +266,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
263 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen, 266 ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
264 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino)); 267 (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
265 if (ret || (retlen != sizeof(*rd) + namelen)) { 268 if (ret || (retlen != sizeof(*rd) + namelen)) {
266 printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", 269 pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
267 sizeof(*rd)+namelen, flash_ofs, ret, retlen); 270 sizeof(*rd) + namelen, flash_ofs, ret, retlen);
268 /* Mark the space as dirtied */ 271 /* Mark the space as dirtied */
269 if (retlen) { 272 if (retlen) {
270 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL); 273 jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL);
271 } else { 274 } else {
272 printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); 275 pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
276 flash_ofs);
273 } 277 }
274 if (!retried) { 278 if (!retried) {
275 /* Try to reallocate space and retry */ 279 /* Try to reallocate space and retry */
@@ -417,7 +421,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
417 mutex_unlock(&f->sem); 421 mutex_unlock(&f->sem);
418 jffs2_complete_reservation(c); 422 jffs2_complete_reservation(c);
419 if (!datalen) { 423 if (!datalen) {
420 printk(KERN_WARNING "Eep. We didn't actually write any data in jffs2_write_inode_range()\n"); 424 pr_warn("Eep. We didn't actually write any data in jffs2_write_inode_range()\n");
421 ret = -EIO; 425 ret = -EIO;
422 break; 426 break;
423 } 427 }
@@ -634,8 +638,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
634 dead_f->dents = fd->next; 638 dead_f->dents = fd->next;
635 639
636 if (fd->ino) { 640 if (fd->ino) {
637 printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n", 641 pr_warn("Deleting inode #%u with active dentry \"%s\"->ino #%u\n",
638 dead_f->inocache->ino, fd->name, fd->ino); 642 dead_f->inocache->ino,
643 fd->name, fd->ino);
639 } else { 644 } else {
640 jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n", 645 jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n",
641 fd->name, 646 fd->name,