Commit da320f05 authored by Joe Perches's avatar Joe Perches Committed by David Woodhouse

jffs2: Convert printks to pr_<level>

Use the more current logging style.

Coalesce formats, align arguments.
Convert uses of embedded function names to %s, __func__.

A couple of long line checkpatch errors I don't care about exist.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 9c261b33
...@@ -42,7 +42,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c) ...@@ -42,7 +42,8 @@ int jffs2_start_garbage_collect_thread(struct jffs2_sb_info *c)
tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index); tsk = kthread_run(jffs2_garbage_collect_thread, c, "jffs2_gcd_mtd%d", c->mtd->index);
if (IS_ERR(tsk)) { if (IS_ERR(tsk)) {
printk(KERN_WARNING "fork failed for JFFS2 garbage collect thread: %ld\n", -PTR_ERR(tsk)); pr_warn("fork failed for JFFS2 garbage collect thread: %ld\n",
-PTR_ERR(tsk));
complete(&c->gc_thread_exit); complete(&c->gc_thread_exit);
ret = PTR_ERR(tsk); ret = PTR_ERR(tsk);
} else { } else {
...@@ -152,7 +153,7 @@ static int jffs2_garbage_collect_thread(void *_c) ...@@ -152,7 +153,7 @@ static int jffs2_garbage_collect_thread(void *_c)
jffs2_dbg(1, "%s(): pass\n", __func__); jffs2_dbg(1, "%s(): pass\n", __func__);
if (jffs2_garbage_collect_pass(c) == -ENOSPC) { if (jffs2_garbage_collect_pass(c) == -ENOSPC) {
printk(KERN_NOTICE "No space for garbage collection. Aborting GC thread\n"); pr_notice("No space for garbage collection. Aborting GC thread\n");
goto die; goto die;
} }
} }
......
...@@ -79,7 +79,7 @@ static int jffs2_selected_compress(u8 compr, unsigned char *data_in, ...@@ -79,7 +79,7 @@ static int jffs2_selected_compress(u8 compr, unsigned char *data_in,
output_buf = kmalloc(*cdatalen, GFP_KERNEL); output_buf = kmalloc(*cdatalen, GFP_KERNEL);
if (!output_buf) { if (!output_buf) {
printk(KERN_WARNING "JFFS2: No memory for compressor allocation. Compression failed.\n"); pr_warn("JFFS2: No memory for compressor allocation. Compression failed.\n");
return ret; return ret;
} }
orig_slen = *datalen; orig_slen = *datalen;
...@@ -188,7 +188,8 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -188,7 +188,8 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
tmp_buf = kmalloc(orig_slen, GFP_KERNEL); tmp_buf = kmalloc(orig_slen, GFP_KERNEL);
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
if (!tmp_buf) { if (!tmp_buf) {
printk(KERN_WARNING "JFFS2: No memory for compressor allocation. (%d bytes)\n", orig_slen); pr_warn("JFFS2: No memory for compressor allocation. (%d bytes)\n",
orig_slen);
continue; continue;
} }
else { else {
...@@ -235,7 +236,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -235,7 +236,7 @@ uint16_t jffs2_compress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
cpage_out, datalen, cdatalen); cpage_out, datalen, cdatalen);
break; break;
default: default:
printk(KERN_ERR "JFFS2: unknown compression mode.\n"); pr_err("JFFS2: unknown compression mode\n");
} }
if (ret == JFFS2_COMPR_NONE) { if (ret == JFFS2_COMPR_NONE) {
...@@ -277,7 +278,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -277,7 +278,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
ret = this->decompress(cdata_in, data_out, cdatalen, datalen); ret = this->decompress(cdata_in, data_out, cdatalen, datalen);
spin_lock(&jffs2_compressor_list_lock); spin_lock(&jffs2_compressor_list_lock);
if (ret) { if (ret) {
printk(KERN_WARNING "Decompressor \"%s\" returned %d\n", this->name, ret); pr_warn("Decompressor \"%s\" returned %d\n",
this->name, ret);
} }
else { else {
this->stat_decompr_blocks++; this->stat_decompr_blocks++;
...@@ -287,7 +289,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -287,7 +289,8 @@ int jffs2_decompress(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
return ret; return ret;
} }
} }
printk(KERN_WARNING "JFFS2 compression type 0x%02x not available.\n", comprtype); pr_warn("JFFS2 compression type 0x%02x not available\n",
comprtype);
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
return -EIO; return -EIO;
} }
...@@ -299,7 +302,7 @@ int jffs2_register_compressor(struct jffs2_compressor *comp) ...@@ -299,7 +302,7 @@ int jffs2_register_compressor(struct jffs2_compressor *comp)
struct jffs2_compressor *this; struct jffs2_compressor *this;
if (!comp->name) { if (!comp->name) {
printk(KERN_WARNING "NULL compressor name at registering JFFS2 compressor. Failed.\n"); pr_warn("NULL compressor name at registering JFFS2 compressor. Failed.\n");
return -1; return -1;
} }
comp->compr_buf_size=0; comp->compr_buf_size=0;
...@@ -340,7 +343,7 @@ int jffs2_unregister_compressor(struct jffs2_compressor *comp) ...@@ -340,7 +343,7 @@ int jffs2_unregister_compressor(struct jffs2_compressor *comp)
if (comp->usecount) { if (comp->usecount) {
spin_unlock(&jffs2_compressor_list_lock); spin_unlock(&jffs2_compressor_list_lock);
printk(KERN_WARNING "JFFS2: Compressor module is in use. Unregister failed.\n"); pr_warn("JFFS2: Compressor module is in use. Unregister failed.\n");
return -1; return -1;
} }
list_del(&comp->list); list_del(&comp->list);
......
...@@ -79,7 +79,7 @@ static int jffs2_zlib_compress(unsigned char *data_in, ...@@ -79,7 +79,7 @@ static int jffs2_zlib_compress(unsigned char *data_in,
mutex_lock(&deflate_mutex); mutex_lock(&deflate_mutex);
if (Z_OK != zlib_deflateInit(&def_strm, 3)) { if (Z_OK != zlib_deflateInit(&def_strm, 3)) {
printk(KERN_WARNING "deflateInit failed\n"); pr_warn("deflateInit failed\n");
mutex_unlock(&deflate_mutex); mutex_unlock(&deflate_mutex);
return -1; return -1;
} }
...@@ -169,7 +169,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, ...@@ -169,7 +169,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) { if (Z_OK != zlib_inflateInit2(&inf_strm, wbits)) {
printk(KERN_WARNING "inflateInit failed\n"); pr_warn("inflateInit failed\n");
mutex_unlock(&inflate_mutex); mutex_unlock(&inflate_mutex);
return 1; return 1;
} }
...@@ -177,7 +177,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in, ...@@ -177,7 +177,7 @@ static int jffs2_zlib_decompress(unsigned char *data_in,
while((ret = zlib_inflate(&inf_strm, Z_FINISH)) == Z_OK) while((ret = zlib_inflate(&inf_strm, Z_FINISH)) == Z_OK)
; ;
if (ret != Z_STREAM_END) { if (ret != Z_STREAM_END) {
printk(KERN_NOTICE "inflate returned %d\n", ret); pr_notice("inflate returned %d\n", ret);
} }
zlib_inflateEnd(&inf_strm); zlib_inflateEnd(&inf_strm);
mutex_unlock(&inflate_mutex); mutex_unlock(&inflate_mutex);
......
...@@ -262,11 +262,14 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c) ...@@ -262,11 +262,14 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
} }
#define check(sz) \ #define check(sz) \
do { \
if (sz != c->sz##_size) { \ if (sz != c->sz##_size) { \
printk(KERN_WARNING #sz "_size mismatch counted 0x%x, c->" #sz "_size 0x%x\n", \ pr_warn("%s_size mismatch counted 0x%x, c->%s_size 0x%x\n", \
sz, c->sz##_size); \ #sz, #sz, sz, c->sz##_size); \
dump = 1; \ dump = 1; \
} } \
} while (0)
check(free); check(free);
check(dirty); check(dirty);
check(used); check(used);
...@@ -274,10 +277,11 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c) ...@@ -274,10 +277,11 @@ void __jffs2_dbg_superblock_counts(struct jffs2_sb_info *c)
check(unchecked); check(unchecked);
check(bad); check(bad);
check(erasing); check(erasing);
#undef check #undef check
if (nr_counted != c->nr_blocks) { if (nr_counted != c->nr_blocks) {
printk(KERN_WARNING "%s counted only 0x%x blocks of 0x%x. Where are the others?\n", pr_warn("%s counted only 0x%x blocks of 0x%x. Where are the others?\n",
__func__, nr_counted, c->nr_blocks); __func__, nr_counted, c->nr_blocks);
dump = 1; dump = 1;
} }
......
...@@ -103,7 +103,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target, ...@@ -103,7 +103,7 @@ static struct dentry *jffs2_lookup(struct inode *dir_i, struct dentry *target,
if (ino) { if (ino) {
inode = jffs2_iget(dir_i->i_sb, ino); inode = jffs2_iget(dir_i->i_sb, ino);
if (IS_ERR(inode)) if (IS_ERR(inode))
printk(KERN_WARNING "iget() failed for ino #%u\n", ino); pr_warn("iget() failed for ino #%u\n", ino);
} }
return d_splice_alias(inode, target); return d_splice_alias(inode, target);
...@@ -365,7 +365,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char ...@@ -365,7 +365,7 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
/* We use f->target field to store the target path. */ /* We use f->target field to store the target path. */
f->target = kmemdup(target, targetlen + 1, GFP_KERNEL); f->target = kmemdup(target, targetlen + 1, GFP_KERNEL);
if (!f->target) { if (!f->target) {
printk(KERN_WARNING "Can't allocate %d bytes of memory\n", targetlen + 1); pr_warn("Can't allocate %d bytes of memory\n", targetlen + 1);
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
ret = -ENOMEM; ret = -ENOMEM;
...@@ -860,7 +860,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry, ...@@ -860,7 +860,8 @@ static int jffs2_rename (struct inode *old_dir_i, struct dentry *old_dentry,
f->inocache->pino_nlink++; f->inocache->pino_nlink++;
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
printk(KERN_NOTICE "jffs2_rename(): Link succeeded, unlink failed (err %d). You now have a hard link\n", ret); pr_notice("%s(): Link succeeded, unlink failed (err %d). You now have a hard link\n",
__func__, ret);
/* Might as well let the VFS know */ /* Might as well let the VFS know */
d_instantiate(new_dentry, old_dentry->d_inode); d_instantiate(new_dentry, old_dentry->d_inode);
ihold(old_dentry->d_inode); ihold(old_dentry->d_inode);
......
...@@ -51,7 +51,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, ...@@ -51,7 +51,7 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
jeb->offset, jeb->offset, jeb->offset + c->sector_size); jeb->offset, jeb->offset, jeb->offset + c->sector_size);
instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL); instr = kmalloc(sizeof(struct erase_info) + sizeof(struct erase_priv_struct), GFP_KERNEL);
if (!instr) { if (!instr) {
printk(KERN_WARNING "kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n"); pr_warn("kmalloc for struct erase_info in jffs2_erase_block failed. Refiling block for later\n");
mutex_lock(&c->erase_free_sem); mutex_lock(&c->erase_free_sem);
spin_lock(&c->erase_completion_lock); spin_lock(&c->erase_completion_lock);
list_move(&jeb->list, &c->erase_pending_list); list_move(&jeb->list, &c->erase_pending_list);
...@@ -99,9 +99,11 @@ static void jffs2_erase_block(struct jffs2_sb_info *c, ...@@ -99,9 +99,11 @@ static void jffs2_erase_block(struct jffs2_sb_info *c,
} }
if (ret == -EROFS) if (ret == -EROFS)
printk(KERN_WARNING "Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n", jeb->offset); pr_warn("Erase at 0x%08x failed immediately: -EROFS. Is the sector locked?\n",
jeb->offset);
else else
printk(KERN_WARNING "Erase at 0x%08x failed immediately: errno %d\n", jeb->offset, ret); pr_warn("Erase at 0x%08x failed immediately: errno %d\n",
jeb->offset, ret);
jffs2_erase_failed(c, jeb, bad_offset); jffs2_erase_failed(c, jeb, bad_offset);
} }
...@@ -217,7 +219,7 @@ static void jffs2_erase_callback(struct erase_info *instr) ...@@ -217,7 +219,7 @@ static void jffs2_erase_callback(struct erase_info *instr)
struct erase_priv_struct *priv = (void *)instr->priv; struct erase_priv_struct *priv = (void *)instr->priv;
if(instr->state != MTD_ERASE_DONE) { if(instr->state != MTD_ERASE_DONE) {
printk(KERN_WARNING "Erase at 0x%08llx finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n", pr_warn("Erase at 0x%08llx finished, but state != MTD_ERASE_DONE. State is 0x%x instead.\n",
(unsigned long long)instr->addr, instr->state); (unsigned long long)instr->addr, instr->state);
jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr); jffs2_erase_failed(priv->c, priv->jeb, instr->fail_addr);
} else { } else {
...@@ -284,7 +286,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, ...@@ -284,7 +286,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
printk(KERN_DEBUG); printk(KERN_DEBUG);
while(this) { while(this) {
printk(KERN_CONT "0x%08x(%d)->", pr_cont("0x%08x(%d)->",
ref_offset(this), ref_flags(this)); ref_offset(this), ref_flags(this));
if (++i == 5) { if (++i == 5) {
printk(KERN_DEBUG); printk(KERN_DEBUG);
...@@ -292,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, ...@@ -292,7 +294,7 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c,
} }
this = this->next_in_ino; this = this->next_in_ino;
} }
printk(KERN_CONT "\n"); pr_cont("\n");
}); });
switch (ic->class) { switch (ic->class) {
...@@ -364,8 +366,10 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl ...@@ -364,8 +366,10 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
} while(--retlen); } while(--retlen);
mtd_unpoint(c->mtd, jeb->offset, c->sector_size); mtd_unpoint(c->mtd, jeb->offset, c->sector_size);
if (retlen) { if (retlen) {
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08tx\n",
*wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); *wordebuf,
jeb->offset +
c->sector_size-retlen * sizeof(*wordebuf));
return -EIO; return -EIO;
} }
return 0; return 0;
...@@ -373,7 +377,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl ...@@ -373,7 +377,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
do_flash_read: do_flash_read:
ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL); ebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (!ebuf) { if (!ebuf) {
printk(KERN_WARNING "Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n", jeb->offset); pr_warn("Failed to allocate page buffer for verifying erase at 0x%08x. Refiling\n",
jeb->offset);
return -EAGAIN; return -EAGAIN;
} }
...@@ -387,12 +392,14 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl ...@@ -387,12 +392,14 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
ret = mtd_read(c->mtd, ofs, readlen, &retlen, ebuf); ret = mtd_read(c->mtd, ofs, readlen, &retlen, ebuf);
if (ret) { if (ret) {
printk(KERN_WARNING "Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n", ofs, ret); pr_warn("Read of newly-erased block at 0x%08x failed: %d. Putting on bad_list\n",
ofs, ret);
ret = -EIO; ret = -EIO;
goto fail; goto fail;
} }
if (retlen != readlen) { if (retlen != readlen) {
printk(KERN_WARNING "Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n", ofs, readlen, retlen); pr_warn("Short read from newly-erased block at 0x%08x. Wanted %d, got %zd\n",
ofs, readlen, retlen);
ret = -EIO; ret = -EIO;
goto fail; goto fail;
} }
...@@ -401,7 +408,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl ...@@ -401,7 +408,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl
unsigned long *datum = ebuf + i; unsigned long *datum = ebuf + i;
if (*datum + 1) { if (*datum + 1) {
*bad_offset += i; *bad_offset += i;
printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08x\n", *datum, *bad_offset); pr_warn("Newly-erased block contained word 0x%lx at offset 0x%08x\n",
*datum, *bad_offset);
ret = -EIO; ret = -EIO;
goto fail; goto fail;
} }
...@@ -456,10 +464,10 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb ...@@ -456,10 +464,10 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb
if (ret || retlen != sizeof(marker)) { if (ret || retlen != sizeof(marker)) {
if (ret) if (ret)
printk(KERN_WARNING "Write clean marker to block at 0x%08x failed: %d\n", pr_warn("Write clean marker to block at 0x%08x failed: %d\n",
jeb->offset, ret); jeb->offset, ret);
else else
printk(KERN_WARNING "Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n", pr_warn("Short write to newly-erased block at 0x%08x: Wanted %zd, got %zd\n",
jeb->offset, sizeof(marker), retlen); jeb->offset, sizeof(marker), retlen);
goto filebad; goto filebad;
......
...@@ -320,14 +320,16 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) ...@@ -320,14 +320,16 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
/* Read the device numbers from the media */ /* Read the device numbers from the media */
if (f->metadata->size != sizeof(jdev.old_id) && if (f->metadata->size != sizeof(jdev.old_id) &&
f->metadata->size != sizeof(jdev.new_id)) { f->metadata->size != sizeof(jdev.new_id)) {
printk(KERN_NOTICE "Device node has strange size %d\n", f->metadata->size); pr_notice("Device node has strange size %d\n",
f->metadata->size);
goto error_io; goto error_io;
} }
jffs2_dbg(1, "Reading device numbers from flash\n"); jffs2_dbg(1, "Reading device numbers from flash\n");
ret = jffs2_read_dnode(c, f, f->metadata, (char *)&jdev, 0, f->metadata->size); ret = jffs2_read_dnode(c, f, f->metadata, (char *)&jdev, 0, f->metadata->size);
if (ret < 0) { if (ret < 0) {
/* Eep */ /* Eep */
printk(KERN_NOTICE "Read device numbers for inode %lu failed\n", (unsigned long)inode->i_ino); pr_notice("Read device numbers for inode %lu failed\n",
(unsigned long)inode->i_ino);
goto error; goto error;
} }
if (f->metadata->size == sizeof(jdev.old_id)) if (f->metadata->size == sizeof(jdev.old_id))
...@@ -342,7 +344,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino) ...@@ -342,7 +344,8 @@ struct inode *jffs2_iget(struct super_block *sb, unsigned long ino)
break; break;
default: default:
printk(KERN_WARNING "jffs2_read_inode(): Bogus imode %o for ino %lu\n", inode->i_mode, (unsigned long)inode->i_ino); pr_warn("%s(): Bogus i_mode %o for ino %lu\n",
__func__, inode->i_mode, (unsigned long)inode->i_ino);
} }
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
...@@ -510,11 +513,11 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) ...@@ -510,11 +513,11 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
#ifndef CONFIG_JFFS2_FS_WRITEBUFFER #ifndef CONFIG_JFFS2_FS_WRITEBUFFER
if (c->mtd->type == MTD_NANDFLASH) { if (c->mtd->type == MTD_NANDFLASH) {
printk(KERN_ERR "jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n"); pr_err("jffs2: Cannot operate on NAND flash unless jffs2 NAND support is compiled in.\n");
return -EINVAL; return -EINVAL;
} }
if (c->mtd->type == MTD_DATAFLASH) { if (c->mtd->type == MTD_DATAFLASH) {
printk(KERN_ERR "jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n"); pr_err("jffs2: Cannot operate on DataFlash unless jffs2 DataFlash support is compiled in.\n");
return -EINVAL; return -EINVAL;
} }
#endif #endif
...@@ -528,12 +531,13 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent) ...@@ -528,12 +531,13 @@ int jffs2_do_fill_super(struct super_block *sb, void *data, int silent)
*/ */
if ((c->sector_size * blocks) != c->flash_size) { if ((c->sector_size * blocks) != c->flash_size) {
c->flash_size = c->sector_size * blocks; c->flash_size = c->sector_size * blocks;
printk(KERN_INFO "jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n", pr_info("jffs2: Flash size not aligned to erasesize, reducing to %dKiB\n",
c->flash_size / 1024); c->flash_size / 1024);
} }
if (c->flash_size < 5*c->sector_size) { if (c->flash_size < 5*c->sector_size) {
printk(KERN_ERR "jffs2: Too few erase blocks (%d)\n", c->flash_size / c->sector_size); pr_err("jffs2: Too few erase blocks (%d)\n",
c->flash_size / c->sector_size);
return -EINVAL; return -EINVAL;
} }
...@@ -658,7 +662,7 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c, ...@@ -658,7 +662,7 @@ struct jffs2_inode_info *jffs2_gc_fetch_inode(struct jffs2_sb_info *c,
return ERR_CAST(inode); return ERR_CAST(inode);
} }
if (is_bad_inode(inode)) { if (is_bad_inode(inode)) {
printk(KERN_NOTICE "Eep. read_inode() failed for ino #%u. unlinked %d\n", pr_notice("Eep. read_inode() failed for ino #%u. unlinked %d\n",
inum, unlinked); inum, unlinked);
/* NB. This will happen again. We need to do something appropriate here. */ /* NB. This will happen again. We need to do something appropriate here. */
iput(inode); iput(inode);
......
This diff is collapsed.
...@@ -687,7 +687,7 @@ int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb ...@@ -687,7 +687,7 @@ int jffs2_scan_dirty_space(struct jffs2_sb_info *c, struct jffs2_eraseblock *jeb
if (!size) if (!size)
return 0; return 0;
if (unlikely(size > jeb->free_size)) { if (unlikely(size > jeb->free_size)) {
printk(KERN_CRIT "Dirty space 0x%x larger then free_size 0x%x (wasted 0x%x)\n", pr_crit("Dirty space 0x%x larger then free_size 0x%x (wasted 0x%x)\n",
size, jeb->free_size, jeb->wasted_size); size, jeb->free_size, jeb->wasted_size);
BUG(); BUG();
} }
...@@ -726,8 +726,10 @@ static inline uint32_t __ref_totlen(struct jffs2_sb_info *c, ...@@ -726,8 +726,10 @@ static inline uint32_t __ref_totlen(struct jffs2_sb_info *c,
/* Last node in block. Use free_space */ /* Last node in block. Use free_space */
if (unlikely(ref != jeb->last_node)) { if (unlikely(ref != jeb->last_node)) {
printk(KERN_CRIT "ref %p @0x%08x is not jeb->last_node (%p @0x%08x)\n", pr_crit("ref %p @0x%08x is not jeb->last_node (%p @0x%08x)\n",
ref, ref_offset(ref), jeb->last_node, jeb->last_node?ref_offset(jeb->last_node):0); ref, ref_offset(ref), jeb->last_node,
jeb->last_node ?
ref_offset(jeb->last_node) : 0);
BUG(); BUG();
} }
ref_end = jeb->offset + c->sector_size - jeb->free_size; ref_end = jeb->offset + c->sector_size - jeb->free_size;
...@@ -747,16 +749,20 @@ uint32_t __jffs2_ref_totlen(struct jffs2_sb_info *c, struct jffs2_eraseblock *je ...@@ -747,16 +749,20 @@ uint32_t __jffs2_ref_totlen(struct jffs2_sb_info *c, struct jffs2_eraseblock *je
if (!jeb) if (!jeb)
jeb = &c->blocks[ref->flash_offset / c->sector_size]; jeb = &c->blocks[ref->flash_offset / c->sector_size];
printk(KERN_CRIT "Totlen for ref at %p (0x%08x-0x%08x) miscalculated as 0x%x instead of %x\n", pr_crit("Totlen for ref at %p (0x%08x-0x%08x) miscalculated as 0x%x instead of %x\n",
ref, ref_offset(ref), ref_offset(ref)+ref->__totlen, ref, ref_offset(ref), ref_offset(ref) + ref->__totlen,
ret, ref->__totlen); ret, ref->__totlen);
if (ref_next(ref)) { if (ref_next(ref)) {
printk(KERN_CRIT "next %p (0x%08x-0x%08x)\n", ref_next(ref), ref_offset(ref_next(ref)), pr_crit("next %p (0x%08x-0x%08x)\n",
ref_offset(ref_next(ref))+ref->__totlen); ref_next(ref), ref_offset(ref_next(ref)),
ref_offset(ref_next(ref)) + ref->__totlen);
} else } else
printk(KERN_CRIT "No next ref. jeb->last_node is %p\n", jeb->last_node); pr_crit("No next ref. jeb->last_node is %p\n",
jeb->last_node);
printk(KERN_CRIT "jeb->wasted_size %x, dirty_size %x, used_size %x, free_size %x\n", jeb->wasted_size, jeb->dirty_size, jeb->used_size, jeb->free_size); pr_crit("jeb->wasted_size %x, dirty_size %x, used_size %x, free_size %x\n",
jeb->wasted_size, jeb->dirty_size, jeb->used_size,
jeb->free_size);
#if defined(JFFS2_DBG_DUMPS) || defined(JFFS2_DBG_PARANOIA_CHECKS) #if defined(JFFS2_DBG_DUMPS) || defined(JFFS2_DBG_PARANOIA_CHECKS)
__jffs2_dbg_dump_node_refs_nolock(c, jeb); __jffs2_dbg_dump_node_refs_nolock(c, jeb);
......
...@@ -262,9 +262,11 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c) ...@@ -262,9 +262,11 @@ static int jffs2_find_nextblock(struct jffs2_sb_info *c)
if (!c->nr_erasing_blocks) { if (!c->nr_erasing_blocks) {
/* Ouch. We're in GC, or we wouldn't have got here. /* Ouch. We're in GC, or we wouldn't have got here.
And there's no space left. At all. */ And there's no space left. At all. */
printk(KERN_CRIT "Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n", pr_crit("Argh. No free space left for GC. nr_erasing_blocks is %d. nr_free_blocks is %d. (erasableempty: %s, erasingempty: %s, erasependingempty: %s)\n",
c->nr_erasing_blocks, c->nr_free_blocks, list_empty(&c->erasable_list)?"yes":"no", c->nr_erasing_blocks, c->nr_free_blocks,
list_empty(&c->erasing_list)?"yes":"no", list_empty(&c->erase_pending_list)?"yes":"no"); list_empty(&c->erasable_list) ? "yes" : "no",
list_empty(&c->erasing_list) ? "yes" : "no",
list_empty(&c->erase_pending_list) ? "yes" : "no");
return -ENOSPC; return -ENOSPC;
} }
...@@ -403,7 +405,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize, ...@@ -403,7 +405,8 @@ static int jffs2_do_reserve_space(struct jffs2_sb_info *c, uint32_t minsize,
jeb = c->nextblock; jeb = c->nextblock;
if (jeb->free_size != c->sector_size - c->cleanmarker_size) { if (jeb->free_size != c->sector_size - c->cleanmarker_size) {
printk(KERN_WARNING "Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n", jeb->offset, jeb->free_size); pr_warn("Eep. Block 0x%08x taken from free_list had free_size of 0x%08x!!\n",
jeb->offset, jeb->free_size);
goto restart; goto restart;
} }
} }
...@@ -459,12 +462,14 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c, ...@@ -459,12 +462,14 @@ struct jffs2_raw_node_ref *jffs2_add_physical_node_ref(struct jffs2_sb_info *c,
even after refiling c->nextblock */ even after refiling c->nextblock */
if ((c->nextblock || ((ofs & 3) != REF_OBSOLETE)) if ((c->nextblock || ((ofs & 3) != REF_OBSOLETE))
&& (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) { && (jeb != c->nextblock || (ofs & ~3) != jeb->offset + (c->sector_size - jeb->free_size))) {
printk(KERN_WARNING "argh. node added in wrong place at 0x%08x(%d)\n", ofs & ~3, ofs & 3); pr_warn("argh. node added in wrong place at 0x%08x(%d)\n",
ofs & ~3, ofs & 3);
if (c->nextblock) if (c->nextblock)
printk(KERN_WARNING "nextblock 0x%08x", c->nextblock->offset); pr_warn("nextblock 0x%08x", c->nextblock->offset);
else else
printk(KERN_WARNING "No nextblock"); pr_warn("No nextblock");
printk(", expected at %08x\n", jeb->offset + (c->sector_size - jeb->free_size)); pr_cont(", expected at %08x\n",
jeb->offset + (c->sector_size - jeb->free_size));
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
#endif #endif
...@@ -529,7 +534,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -529,7 +534,7 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
uint32_t freed_len; uint32_t freed_len;
if(unlikely(!ref)) { if(unlikely(!ref)) {
printk(KERN_NOTICE "EEEEEK. jffs2_mark_node_obsolete called with NULL node\n"); pr_notice("EEEEEK. jffs2_mark_node_obsolete called with NULL node\n");
return; return;
} }
if (ref_obsolete(ref)) { if (ref_obsolete(ref)) {
...@@ -539,7 +544,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -539,7 +544,8 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
} }
blocknr = ref->flash_offset / c->sector_size; blocknr = ref->flash_offset / c->sector_size;
if (blocknr >= c->nr_blocks) { if (blocknr >= c->nr_blocks) {
printk(KERN_NOTICE "raw node at 0x%08x is off the end of device!\n", ref->flash_offset); pr_notice("raw node at 0x%08x is off the end of device!\n",
ref->flash_offset);
BUG(); BUG();
} }
jeb = &c->blocks[blocknr]; jeb = &c->blocks[blocknr];
...@@ -561,8 +567,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -561,8 +567,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
if (ref_flags(ref) == REF_UNCHECKED) { if (ref_flags(ref) == REF_UNCHECKED) {
D1(if (unlikely(jeb->unchecked_size < freed_len)) { D1(if (unlikely(jeb->unchecked_size < freed_len)) {
printk(KERN_NOTICE "raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n", pr_notice("raw unchecked node of size 0x%08x freed from erase block %d at 0x%08x, but unchecked_size was already 0x%08x\n",
freed_len, blocknr, ref->flash_offset, jeb->used_size); freed_len, blocknr,
ref->flash_offset, jeb->used_size);
BUG(); BUG();
}) })
jffs2_dbg(1, "Obsoleting previously unchecked node at 0x%08x of len %x\n", jffs2_dbg(1, "Obsoleting previously unchecked node at 0x%08x of len %x\n",
...@@ -571,8 +578,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -571,8 +578,9 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
c->unchecked_size -= freed_len; c->unchecked_size -= freed_len;
} else { } else {
D1(if (unlikely(jeb->used_size < freed_len)) { D1(if (unlikely(jeb->used_size < freed_len)) {
printk(KERN_NOTICE "raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n", pr_notice("raw node of size 0x%08x freed from erase block %d at 0x%08x, but used_size was already 0x%08x\n",
freed_len, blocknr, ref->flash_offset, jeb->used_size); freed_len, blocknr,
ref->flash_offset, jeb->used_size);
BUG(); BUG();
}) })
jffs2_dbg(1, "Obsoleting node at 0x%08x of len %#x: ", jffs2_dbg(1, "Obsoleting node at 0x%08x of len %#x: ",
...@@ -697,15 +705,18 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -697,15 +705,18 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
ref_offset(ref)); ref_offset(ref));
ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); ret = jffs2_flash_read(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
if (ret) { if (ret) {
printk(KERN_WARNING "Read error reading from obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); pr_warn("Read error reading from obsoleted node at 0x%08x: %d\n",
ref_offset(ref), ret);
goto out_erase_sem; goto out_erase_sem;
} }
if (retlen != sizeof(n)) { if (retlen != sizeof(n)) {
printk(KERN_WARNING "Short read from obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); pr_warn("Short read from obsoleted node at 0x%08x: %zd\n",
ref_offset(ref), retlen);
goto out_erase_sem; goto out_erase_sem;
} }
if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) { if (PAD(je32_to_cpu(n.totlen)) != PAD(freed_len)) {
printk(KERN_WARNING "Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n", je32_to_cpu(n.totlen), freed_len); pr_warn("Node totlen on flash (0x%08x) != totlen from node ref (0x%08x)\n",
je32_to_cpu(n.totlen), freed_len);
goto out_erase_sem; goto out_erase_sem;
} }
if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) { if (!(je16_to_cpu(n.nodetype) & JFFS2_NODE_ACCURATE)) {
...@@ -717,11 +728,13 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref ...@@ -717,11 +728,13 @@ void jffs2_mark_node_obsolete(struct jffs2_sb_info *c, struct jffs2_raw_node_ref
n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE); n.nodetype = cpu_to_je16(je16_to_cpu(n.nodetype) & ~JFFS2_NODE_ACCURATE);
ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n); ret = jffs2_flash_write(c, ref_offset(ref), sizeof(n), &retlen, (char *)&n);
if (ret) { if (ret) {
printk(KERN_WARNING "Write error in obliterating obsoleted node at 0x%08x: %d\n", ref_offset(ref), ret); pr_warn("Write error in obliterating obsoleted node at 0x%08x: %d\n",
ref_offset(ref), ret);
goto out_erase_sem; goto out_erase_sem;
} }
if (retlen != sizeof(n)) { if (retlen != sizeof(n)) {
printk(KERN_WARNING "Short write in obliterating obsoleted node at 0x%08x: %zd\n", ref_offset(ref), retlen); pr_warn("Short write in obliterating obsoleted node at 0x%08x: %zd\n",
ref_offset(ref), retlen);
goto out_erase_sem; goto out_erase_sem;
} }
......
...@@ -36,12 +36,13 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -36,12 +36,13 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri); ret = jffs2_flash_read(c, ref_offset(fd->raw), sizeof(*ri), &readlen, (char *)ri);
if (ret) { if (ret) {
jffs2_free_raw_inode(ri); jffs2_free_raw_inode(ri);
printk(KERN_WARNING "Error reading node from 0x%08x: %d\n", ref_offset(fd->raw), ret); pr_warn("Error reading node from 0x%08x: %d\n",
ref_offset(fd->raw), ret);
return ret; return ret;
} }
if (readlen != sizeof(*ri)) { if (readlen != sizeof(*ri)) {
jffs2_free_raw_inode(ri); jffs2_free_raw_inode(ri);
printk(KERN_WARNING "Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n", pr_warn("Short read from 0x%08x: wanted 0x%zx bytes, got 0x%zx\n",
ref_offset(fd->raw), sizeof(*ri), readlen); ref_offset(fd->raw), sizeof(*ri), readlen);
return -EIO; return -EIO;
} }
...@@ -52,7 +53,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -52,7 +53,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize), crc, je32_to_cpu(ri->dsize), je32_to_cpu(ri->csize),
je32_to_cpu(ri->offset), buf); je32_to_cpu(ri->offset), buf);
if (crc != je32_to_cpu(ri->node_crc)) { if (crc != je32_to_cpu(ri->node_crc)) {
printk(KERN_WARNING "Node CRC %08x != calculated CRC %08x for node at %08x\n", pr_warn("Node CRC %08x != calculated CRC %08x for node at %08x\n",
je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw)); je32_to_cpu(ri->node_crc), crc, ref_offset(fd->raw));
ret = -EIO; ret = -EIO;
goto out_ri; goto out_ri;
...@@ -66,7 +67,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -66,7 +67,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
} }
D1(if(ofs + len > je32_to_cpu(ri->dsize)) { D1(if(ofs + len > je32_to_cpu(ri->dsize)) {
printk(KERN_WARNING "jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n", pr_warn("jffs2_read_dnode() asked for %d bytes at %d from %d-byte node\n",
len, ofs, je32_to_cpu(ri->dsize)); len, ofs, je32_to_cpu(ri->dsize));
ret = -EINVAL; ret = -EINVAL;
goto out_ri; goto out_ri;
...@@ -119,7 +120,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -119,7 +120,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
crc = crc32(0, readbuf, je32_to_cpu(ri->csize)); crc = crc32(0, readbuf, je32_to_cpu(ri->csize));
if (crc != je32_to_cpu(ri->data_crc)) { if (crc != je32_to_cpu(ri->data_crc)) {
printk(KERN_WARNING "Data CRC %08x != calculated CRC %08x for node at %08x\n", pr_warn("Data CRC %08x != calculated CRC %08x for node at %08x\n",
je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw)); je32_to_cpu(ri->data_crc), crc, ref_offset(fd->raw));
ret = -EIO; ret = -EIO;
goto out_decomprbuf; goto out_decomprbuf;
...@@ -131,7 +132,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f, ...@@ -131,7 +132,7 @@ int jffs2_read_dnode(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
je32_to_cpu(ri->dsize), decomprbuf); je32_to_cpu(ri->dsize), decomprbuf);
ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize)); ret = jffs2_decompress(c, f, ri->compr | (ri->usercompr << 8), readbuf, decomprbuf, je32_to_cpu(ri->csize), je32_to_cpu(ri->dsize));
if (ret) { if (ret) {
printk(KERN_WARNING "Error: jffs2_decompress returned %d\n", ret); pr_warn("Error: jffs2_decompress returned %d\n", ret);
goto out_decomprbuf; goto out_decomprbuf;
} }
} }
......
This diff is collapsed.
...@@ -442,13 +442,16 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras ...@@ -442,13 +442,16 @@ static int jffs2_sum_process_sum_data(struct jffs2_sb_info *c, struct jffs2_eras
/* This should never happen, but https://dev.laptop.org/ticket/4184 */ /* This should never happen, but https://dev.laptop.org/ticket/4184 */
checkedlen = strnlen(spd->name, spd->nsize); checkedlen = strnlen(spd->name, spd->nsize);
if (!checkedlen) { if (!checkedlen) {
printk(KERN_ERR "Dirent at %08x has zero at start of name. Aborting mount.\n", pr_err("Dirent at %08x has zero at start of name. Aborting mount.\n",
jeb->offset + je32_to_cpu(spd->offset)); jeb->offset +
je32_to_cpu(spd->offset));
return -EIO; return -EIO;
} }
if (checkedlen < spd->nsize) { if (checkedlen < spd->nsize) {
printk(KERN_ERR "Dirent at %08x has zeroes in name. Truncating to %d chars\n", pr_err("Dirent at %08x has zeroes in name. Truncating to %d chars\n",
jeb->offset + je32_to_cpu(spd->offset), checkedlen); jeb->offset +
je32_to_cpu(spd->offset),
checkedlen);
} }
......
...@@ -214,7 +214,7 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data) ...@@ -214,7 +214,7 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
JFFS2_COMPR_MODE_FORCEZLIB; JFFS2_COMPR_MODE_FORCEZLIB;
#endif #endif
else { else {
printk(KERN_ERR "JFFS2 Error: unknown compressor \"%s\"", pr_err("JFFS2 Error: unknown compressor \"%s\"",
name); name);
kfree(name); kfree(name);
return -EINVAL; return -EINVAL;
...@@ -223,7 +223,7 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data) ...@@ -223,7 +223,7 @@ static int jffs2_parse_options(struct jffs2_sb_info *c, char *data)
c->mount_opts.override_compr = true; c->mount_opts.override_compr = true;
break; break;
default: default:
printk(KERN_ERR "JFFS2 Error: unrecognized mount option '%s' or missing value\n", pr_err("JFFS2 Error: unrecognized mount option '%s' or missing value\n",
p); p);
return -EINVAL; return -EINVAL;
} }
...@@ -371,7 +371,7 @@ static int __init init_jffs2_fs(void) ...@@ -371,7 +371,7 @@ static int __init init_jffs2_fs(void)
BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68); BUILD_BUG_ON(sizeof(struct jffs2_raw_inode) != 68);
BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32); BUILD_BUG_ON(sizeof(struct jffs2_raw_summary) != 32);
printk(KERN_INFO "JFFS2 version 2.2." pr_info("JFFS2 version 2.2."
#ifdef CONFIG_JFFS2_FS_WRITEBUFFER #ifdef CONFIG_JFFS2_FS_WRITEBUFFER
" (NAND)" " (NAND)"
#endif #endif
...@@ -386,22 +386,22 @@ static int __init init_jffs2_fs(void) ...@@ -386,22 +386,22 @@ static int __init init_jffs2_fs(void)
SLAB_MEM_SPREAD), SLAB_MEM_SPREAD),
jffs2_i_init_once); jffs2_i_init_once);
if (!jffs2_inode_cachep) { if (!jffs2_inode_cachep) {
printk(KERN_ERR "JFFS2 error: Failed to initialise inode cache\n"); pr_err("JFFS2 error: Failed to initialise inode cache\n");
return -ENOMEM; return -ENOMEM;
} }
ret = jffs2_compressors_init(); ret = jffs2_compressors_init();
if (ret) { if (ret) {
printk(KERN_ERR "JFFS2 error: Failed to initialise compressors\n"); pr_err("JFFS2 error: Failed to initialise compressors\n");
goto out; goto out;
} }
ret = jffs2_create_slab_caches(); ret = jffs2_create_slab_caches();
if (ret) { if (ret) {
printk(KERN_ERR "JFFS2 error: Failed to initialise slab caches\n"); pr_err("JFFS2 error: Failed to initialise slab caches\n");
goto out_compressors; goto out_compressors;
} }
ret = register_filesystem(&jffs2_fs_type); ret = register_filesystem(&jffs2_fs_type);
if (ret) { if (ret) {
printk(KERN_ERR "JFFS2 error: Failed to register filesystem\n"); pr_err("JFFS2 error: Failed to register filesystem\n");
goto out_slab; goto out_slab;
} }
return 0; return 0;
......
...@@ -47,7 +47,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -47,7 +47,7 @@ static void *jffs2_follow_link(struct dentry *dentry, struct nameidata *nd)
*/ */
if (!p) { if (!p) {
printk(KERN_ERR "jffs2_follow_link(): can't find symlink target\n"); pr_err("%s(): can't find symlink target\n", __func__);
p = ERR_PTR(-EIO); p = ERR_PTR(-EIO);
} }
jffs2_dbg(1, "%s(): target path is '%s'\n", jffs2_dbg(1, "%s(): target path is '%s'\n",
......
...@@ -233,10 +233,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf, ...@@ -233,10 +233,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf,
ret = mtd_read(c->mtd, ofs, c->wbuf_pagesize, &retlen, c->wbuf_verify); ret = mtd_read(c->mtd, ofs, c->wbuf_pagesize, &retlen, c->wbuf_verify);
if (ret && ret != -EUCLEAN && ret != -EBADMSG) { if (ret && ret != -EUCLEAN && ret != -EBADMSG) {
printk(KERN_WARNING "jffs2_verify_write(): Read back of page at %08x failed: %d\n", c->wbuf_ofs, ret); pr_warn("%s(): Read back of page at %08x failed: %d\n",
__func__, c->wbuf_ofs, ret);
return ret; return ret;
} else if (retlen != c->wbuf_pagesize) { } else if (retlen != c->wbuf_pagesize) {
printk(KERN_WARNING "jffs2_verify_write(): Read back of page at %08x gave short read: %zd not %d.\n", ofs, retlen, c->wbuf_pagesize); pr_warn("%s(): Read back of page at %08x gave short read: %zd not %d\n",
__func__, ofs, retlen, c->wbuf_pagesize);
return -EIO; return -EIO;
} }
if (!memcmp(buf, c->wbuf_verify, c->wbuf_pagesize)) if (!memcmp(buf, c->wbuf_verify, c->wbuf_pagesize))
...@@ -249,12 +251,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf, ...@@ -249,12 +251,12 @@ static int jffs2_verify_write(struct jffs2_sb_info *c, unsigned char *buf,
else else
eccstr = "OK or unused"; eccstr = "OK or unused";
printk(KERN_WARNING "Write verify error (ECC %s) at %08x. Wrote:\n", pr_warn("Write verify error (ECC %s) at %08x. Wrote:\n",
eccstr, c->wbuf_ofs); eccstr, c->wbuf_ofs);
print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1,
c->wbuf, c->wbuf_pagesize, 0); c->wbuf, c->wbuf_pagesize, 0);
printk(KERN_WARNING "Read back:\n"); pr_warn("Read back:\n");
print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1, print_hex_dump(KERN_WARNING, "", DUMP_PREFIX_OFFSET, 16, 1,
c->wbuf_verify, c->wbuf_pagesize, 0); c->wbuf_verify, c->wbuf_pagesize, 0);
...@@ -334,7 +336,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -334,7 +336,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
buf = kmalloc(end - start, GFP_KERNEL); buf = kmalloc(end - start, GFP_KERNEL);
if (!buf) { if (!buf) {
printk(KERN_CRIT "Malloc failure in wbuf recovery. Data loss ensues.\n"); pr_crit("Malloc failure in wbuf recovery. Data loss ensues.\n");
goto read_failed; goto read_failed;
} }
...@@ -349,7 +351,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -349,7 +351,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
ret = 0; ret = 0;
if (ret || retlen != c->wbuf_ofs - start) { if (ret || retlen != c->wbuf_ofs - start) {
printk(KERN_CRIT "Old data are already lost in wbuf recovery. Data loss ensues.\n"); pr_crit("Old data are already lost in wbuf recovery. Data loss ensues.\n");
kfree(buf); kfree(buf);
buf = NULL; buf = NULL;
...@@ -383,7 +385,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -383,7 +385,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
/* ... and get an allocation of space from a shiny new block instead */ /* ... and get an allocation of space from a shiny new block instead */
ret = jffs2_reserve_space_gc(c, end-start, &len, JFFS2_SUMMARY_NOSUM_SIZE); ret = jffs2_reserve_space_gc(c, end-start, &len, JFFS2_SUMMARY_NOSUM_SIZE);
if (ret) { if (ret) {
printk(KERN_WARNING "Failed to allocate space for wbuf recovery. Data loss ensues.\n"); pr_warn("Failed to allocate space for wbuf recovery. Data loss ensues.\n");
kfree(buf); kfree(buf);
return; return;
} }
...@@ -393,7 +395,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -393,7 +395,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile); ret = jffs2_prealloc_raw_node_refs(c, c->nextblock, nr_refile);
if (ret) { if (ret) {
printk(KERN_WARNING "Failed to allocate node refs for wbuf recovery. Data loss ensues.\n"); pr_warn("Failed to allocate node refs for wbuf recovery. Data loss ensues.\n");
kfree(buf); kfree(buf);
return; return;
} }
...@@ -415,7 +417,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -415,7 +417,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
#ifdef BREAKMEHEADER #ifdef BREAKMEHEADER
static int breakme; static int breakme;
if (breakme++ == 20) { if (breakme++ == 20) {
printk(KERN_NOTICE "Faking write error at 0x%08x\n", ofs); pr_notice("Faking write error at 0x%08x\n", ofs);
breakme = 0; breakme = 0;
mtd_write(c->mtd, ofs, towrite, &retlen, brokenbuf); mtd_write(c->mtd, ofs, towrite, &retlen, brokenbuf);
ret = -EIO; ret = -EIO;
...@@ -426,7 +428,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -426,7 +428,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) { if (ret || retlen != towrite || jffs2_verify_write(c, rewrite_buf, ofs)) {
/* Argh. We tried. Really we did. */ /* Argh. We tried. Really we did. */
printk(KERN_CRIT "Recovery of wbuf failed due to a second write error\n"); pr_crit("Recovery of wbuf failed due to a second write error\n");
kfree(buf); kfree(buf);
if (retlen) if (retlen)
...@@ -434,7 +436,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c) ...@@ -434,7 +436,7 @@ static void jffs2_wbuf_recover(struct jffs2_sb_info *c)
return; return;
} }
printk(KERN_NOTICE "Recovery of wbuf succeeded to %08x\n", ofs); pr_notice("Recovery of wbuf succeeded to %08x\n", ofs);
c->wbuf_len = (end - start) - towrite; c->wbuf_len = (end - start) - towrite;
c->wbuf_ofs = ofs + towrite; c->wbuf_ofs = ofs + towrite;
...@@ -584,7 +586,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad) ...@@ -584,7 +586,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
return 0; return 0;
if (!mutex_is_locked(&c->alloc_sem)) { if (!mutex_is_locked(&c->alloc_sem)) {
printk(KERN_CRIT "jffs2_flush_wbuf() called with alloc_sem not locked!\n"); pr_crit("jffs2_flush_wbuf() called with alloc_sem not locked!\n");
BUG(); BUG();
} }
...@@ -622,7 +624,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad) ...@@ -622,7 +624,7 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
#ifdef BREAKME #ifdef BREAKME
static int breakme; static int breakme;
if (breakme++ == 20) { if (breakme++ == 20) {
printk(KERN_NOTICE "Faking write error at 0x%08x\n", c->wbuf_ofs); pr_notice("Faking write error at 0x%08x\n", c->wbuf_ofs);
breakme = 0; breakme = 0;
mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen, mtd_write(c->mtd, c->wbuf_ofs, c->wbuf_pagesize, &retlen,
brokenbuf); brokenbuf);
...@@ -634,10 +636,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad) ...@@ -634,10 +636,10 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
&retlen, c->wbuf); &retlen, c->wbuf);
if (ret) { if (ret) {
printk(KERN_WARNING "jffs2_flush_wbuf(): Write failed with %d\n", ret); pr_warn("jffs2_flush_wbuf(): Write failed with %d\n", ret);
goto wfail; goto wfail;
} else if (retlen != c->wbuf_pagesize) { } else if (retlen != c->wbuf_pagesize) {
printk(KERN_WARNING "jffs2_flush_wbuf(): Write was short: %zd instead of %d\n", pr_warn("jffs2_flush_wbuf(): Write was short: %zd instead of %d\n",
retlen, c->wbuf_pagesize); retlen, c->wbuf_pagesize);
ret = -EIO; ret = -EIO;
goto wfail; goto wfail;
...@@ -660,9 +662,9 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad) ...@@ -660,9 +662,9 @@ static int __jffs2_flush_wbuf(struct jffs2_sb_info *c, int pad)
padded. If there is less free space in the block than that, padded. If there is less free space in the block than that,
something screwed up */ something screwed up */
if (wbuf_jeb->free_size < waste) { if (wbuf_jeb->free_size < waste) {
printk(KERN_CRIT "jffs2_flush_wbuf(): Accounting error. wbuf at 0x%08x has 0x%03x bytes, 0x%03x left.\n", pr_crit("jffs2_flush_wbuf(): Accounting error. wbuf at 0x%08x has 0x%03x bytes, 0x%03x left.\n",
c->wbuf_ofs, c->wbuf_len, waste); c->wbuf_ofs, c->wbuf_len, waste);
printk(KERN_CRIT "jffs2_flush_wbuf(): But free_size for block at 0x%08x is only 0x%08x\n", pr_crit("jffs2_flush_wbuf(): But free_size for block at 0x%08x is only 0x%08x\n",
wbuf_jeb->offset, wbuf_jeb->free_size); wbuf_jeb->offset, wbuf_jeb->free_size);
BUG(); BUG();
} }
...@@ -831,11 +833,11 @@ int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *invecs, ...@@ -831,11 +833,11 @@ int jffs2_flash_writev(struct jffs2_sb_info *c, const struct kvec *invecs,
if (to != PAD(c->wbuf_ofs + c->wbuf_len)) { if (to != PAD(c->wbuf_ofs + c->wbuf_len)) {
/* We're not writing immediately after the writebuffer. Bad. */ /* We're not writing immediately after the writebuffer. Bad. */
printk(KERN_CRIT "%s(): Non-contiguous write to %08lx\n", pr_crit("%s(): Non-contiguous write to %08lx\n",
__func__, (unsigned long)to); __func__, (unsigned long)to);
if (c->wbuf_len) if (c->wbuf_len)
printk(KERN_CRIT "wbuf was previously %08x-%08x\n", pr_crit("wbuf was previously %08x-%08x\n",
c->wbuf_ofs, c->wbuf_ofs+c->wbuf_len); c->wbuf_ofs, c->wbuf_ofs + c->wbuf_len);
BUG(); BUG();
} }
...@@ -963,8 +965,8 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re ...@@ -963,8 +965,8 @@ int jffs2_flash_read(struct jffs2_sb_info *c, loff_t ofs, size_t len, size_t *re
if ( (ret == -EBADMSG || ret == -EUCLEAN) && (*retlen == len) ) { if ( (ret == -EBADMSG || ret == -EUCLEAN) && (*retlen == len) ) {
if (ret == -EBADMSG) if (ret == -EBADMSG)
printk(KERN_WARNING "mtd->read(0x%zx bytes from 0x%llx)" pr_warn("mtd->read(0x%zx bytes from 0x%llx) returned ECC error\n",
" returned ECC error\n", len, ofs); len, ofs);
/* /*
* We have the raw data without ECC correction in the buffer, * We have the raw data without ECC correction in the buffer,
* maybe we are lucky and all data or parts are correct. We * maybe we are lucky and all data or parts are correct. We
...@@ -1040,8 +1042,7 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c, ...@@ -1040,8 +1042,7 @@ int jffs2_check_oob_empty(struct jffs2_sb_info *c,
ret = mtd_read_oob(c->mtd, jeb->offset, &ops); ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
if (ret || ops.oobretlen != ops.ooblen) { if (ret || ops.oobretlen != ops.ooblen) {
printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd" pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
" bytes, read %zd bytes, error %d\n",
jeb->offset, ops.ooblen, ops.oobretlen, ret); jeb->offset, ops.ooblen, ops.oobretlen, ret);
if (!ret) if (!ret)
ret = -EIO; ret = -EIO;
...@@ -1083,8 +1084,7 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c, ...@@ -1083,8 +1084,7 @@ int jffs2_check_nand_cleanmarker(struct jffs2_sb_info *c,
ret = mtd_read_oob(c->mtd, jeb->offset, &ops); ret = mtd_read_oob(c->mtd, jeb->offset, &ops);
if (ret || ops.oobretlen != ops.ooblen) { if (ret || ops.oobretlen != ops.ooblen) {
printk(KERN_ERR "cannot read OOB for EB at %08x, requested %zd" pr_err("cannot read OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
" bytes, read %zd bytes, error %d\n",
jeb->offset, ops.ooblen, ops.oobretlen, ret); jeb->offset, ops.ooblen, ops.oobretlen, ret);
if (!ret) if (!ret)
ret = -EIO; ret = -EIO;
...@@ -1109,8 +1109,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c, ...@@ -1109,8 +1109,7 @@ int jffs2_write_nand_cleanmarker(struct jffs2_sb_info *c,
ret = mtd_write_oob(c->mtd, jeb->offset, &ops); ret = mtd_write_oob(c->mtd, jeb->offset, &ops);
if (ret || ops.oobretlen != ops.ooblen) { if (ret || ops.oobretlen != ops.ooblen) {
printk(KERN_ERR "cannot write OOB for EB at %08x, requested %zd" pr_err("cannot write OOB for EB at %08x, requested %zd bytes, read %zd bytes, error %d\n",
" bytes, read %zd bytes, error %d\n",
jeb->offset, ops.ooblen, ops.oobretlen, ret); jeb->offset, ops.ooblen, ops.oobretlen, ret);
if (!ret) if (!ret)
ret = -EIO; ret = -EIO;
...@@ -1136,7 +1135,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock * ...@@ -1136,7 +1135,7 @@ int jffs2_write_nand_badblock(struct jffs2_sb_info *c, struct jffs2_eraseblock *
if( ++jeb->bad_count < MAX_ERASE_FAILURES) if( ++jeb->bad_count < MAX_ERASE_FAILURES)
return 0; return 0;
printk(KERN_WARNING "JFFS2: marking eraseblock at %08x\n as bad", bad_offset); pr_warn("JFFS2: marking eraseblock at %08x as bad\n", bad_offset);
ret = mtd_block_markbad(c->mtd, bad_offset); ret = mtd_block_markbad(c->mtd, bad_offset);
if (ret) { if (ret) {
...@@ -1158,7 +1157,7 @@ int jffs2_nand_flash_setup(struct jffs2_sb_info *c) ...@@ -1158,7 +1157,7 @@ int jffs2_nand_flash_setup(struct jffs2_sb_info *c)
c->cleanmarker_size = 0; c->cleanmarker_size = 0;
if (!oinfo || oinfo->oobavail == 0) { if (!oinfo || oinfo->oobavail == 0) {
printk(KERN_ERR "inconsistent device description\n"); pr_err("inconsistent device description\n");
return -EINVAL; return -EINVAL;
} }
...@@ -1229,7 +1228,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) { ...@@ -1229,7 +1228,7 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
if ((c->flash_size % c->sector_size) != 0) { if ((c->flash_size % c->sector_size) != 0) {
c->flash_size = (c->flash_size / c->sector_size) * c->sector_size; c->flash_size = (c->flash_size / c->sector_size) * c->sector_size;
printk(KERN_WARNING "JFFS2 flash size adjusted to %dKiB\n", c->flash_size); pr_warn("JFFS2 flash size adjusted to %dKiB\n", c->flash_size);
}; };
c->wbuf_ofs = 0xFFFFFFFF; c->wbuf_ofs = 0xFFFFFFFF;
...@@ -1246,7 +1245,8 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) { ...@@ -1246,7 +1245,8 @@ int jffs2_dataflash_setup(struct jffs2_sb_info *c) {
} }
#endif #endif
printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size); pr_info("JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n",
c->wbuf_pagesize, c->sector_size);
return 0; return 0;
} }
...@@ -1304,7 +1304,8 @@ int jffs2_ubivol_setup(struct jffs2_sb_info *c) { ...@@ -1304,7 +1304,8 @@ int jffs2_ubivol_setup(struct jffs2_sb_info *c) {
if (!c->wbuf) if (!c->wbuf)
return -ENOMEM; return -ENOMEM;
printk(KERN_INFO "JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n", c->wbuf_pagesize, c->sector_size); pr_info("JFFS2 write-buffering enabled buffer (%d) erasesize (%d)\n",
c->wbuf_pagesize, c->sector_size);
return 0; return 0;
} }
......
...@@ -68,7 +68,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 ...@@ -68,7 +68,7 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
unsigned long cnt = 2; unsigned long cnt = 2;
D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) { D1(if(je32_to_cpu(ri->hdr_crc) != crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)) {
printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dnode()\n"); pr_crit("Eep. CRC not correct in jffs2_write_dnode()\n");
BUG(); BUG();
} }
); );
...@@ -78,7 +78,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 ...@@ -78,7 +78,9 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
vecs[1].iov_len = datalen; vecs[1].iov_len = datalen;
if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) { if (je32_to_cpu(ri->totlen) != sizeof(*ri) + datalen) {
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); pr_warn("%s(): ri->totlen (0x%08x) != sizeof(*ri) (0x%08zx) + datalen (0x%08x)\n",
__func__, je32_to_cpu(ri->totlen),
sizeof(*ri), datalen);
} }
fn = jffs2_alloc_full_dnode(); fn = jffs2_alloc_full_dnode();
...@@ -106,8 +108,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 ...@@ -106,8 +108,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
(alloc_mode==ALLOC_GC)?0:f->inocache->ino); (alloc_mode==ALLOC_GC)?0:f->inocache->ino);
if (ret || (retlen != sizeof(*ri) + datalen)) { if (ret || (retlen != sizeof(*ri) + datalen)) {
printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
sizeof(*ri)+datalen, flash_ofs, ret, retlen); sizeof(*ri) + datalen, flash_ofs, ret, retlen);
/* Mark the space as dirtied */ /* Mark the space as dirtied */
if (retlen) { if (retlen) {
...@@ -118,7 +120,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2 ...@@ -118,7 +120,8 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
this node */ this node */
jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL); jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*ri)+datalen), NULL);
} else { } else {
printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
flash_ofs);
} }
if (!retried && alloc_mode != ALLOC_NORETRY) { if (!retried && alloc_mode != ALLOC_NORETRY) {
/* Try to reallocate space and retry */ /* Try to reallocate space and retry */
...@@ -214,15 +217,15 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff ...@@ -214,15 +217,15 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
je32_to_cpu(rd->name_crc)); je32_to_cpu(rd->name_crc));
D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) { D1(if(je32_to_cpu(rd->hdr_crc) != crc32(0, rd, sizeof(struct jffs2_unknown_node)-4)) {
printk(KERN_CRIT "Eep. CRC not correct in jffs2_write_dirent()\n"); pr_crit("Eep. CRC not correct in jffs2_write_dirent()\n");
BUG(); BUG();
}); });
if (strnlen(name, namelen) != namelen) { if (strnlen(name, namelen) != namelen) {
/* This should never happen, but seems to have done on at least one /* This should never happen, but seems to have done on at least one
occasion: https://dev.laptop.org/ticket/4184 */ occasion: https://dev.laptop.org/ticket/4184 */
printk(KERN_CRIT "Error in jffs2_write_dirent() -- name contains zero bytes!\n"); pr_crit("Error in jffs2_write_dirent() -- name contains zero bytes!\n");
printk(KERN_CRIT "Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n", pr_crit("Directory inode #%u, name at *0x%p \"%s\"->ino #%u, name_crc 0x%08x\n",
je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino), je32_to_cpu(rd->pino), name, name, je32_to_cpu(rd->ino),
je32_to_cpu(rd->name_crc)); je32_to_cpu(rd->name_crc));
WARN_ON(1); WARN_ON(1);
...@@ -263,13 +266,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff ...@@ -263,13 +266,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen, ret = jffs2_flash_writev(c, vecs, 2, flash_ofs, &retlen,
(alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino)); (alloc_mode==ALLOC_GC)?0:je32_to_cpu(rd->pino));
if (ret || (retlen != sizeof(*rd) + namelen)) { if (ret || (retlen != sizeof(*rd) + namelen)) {
printk(KERN_NOTICE "Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n", pr_notice("Write of %zd bytes at 0x%08x failed. returned %d, retlen %zd\n",
sizeof(*rd)+namelen, flash_ofs, ret, retlen); sizeof(*rd) + namelen, flash_ofs, ret, retlen);
/* Mark the space as dirtied */ /* Mark the space as dirtied */
if (retlen) { if (retlen) {
jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL); jffs2_add_physical_node_ref(c, flash_ofs | REF_OBSOLETE, PAD(sizeof(*rd)+namelen), NULL);
} else { } else {
printk(KERN_NOTICE "Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n", flash_ofs); pr_notice("Not marking the space at 0x%08x as dirty because the flash driver returned retlen zero\n",
flash_ofs);
} }
if (!retried) { if (!retried) {
/* Try to reallocate space and retry */ /* 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,7 +421,7 @@ int jffs2_write_inode_range(struct jffs2_sb_info *c, struct jffs2_inode_info *f,
mutex_unlock(&f->sem); mutex_unlock(&f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
if (!datalen) { if (!datalen) {
printk(KERN_WARNING "Eep. We didn't actually write any data in jffs2_write_inode_range()\n"); pr_warn("Eep. We didn't actually write any data in jffs2_write_inode_range()\n");
ret = -EIO; ret = -EIO;
break; break;
} }
...@@ -634,8 +638,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f, ...@@ -634,8 +638,9 @@ int jffs2_do_unlink(struct jffs2_sb_info *c, struct jffs2_inode_info *dir_f,
dead_f->dents = fd->next; dead_f->dents = fd->next;
if (fd->ino) { if (fd->ino) {
printk(KERN_WARNING "Deleting inode #%u with active dentry \"%s\"->ino #%u\n", pr_warn("Deleting inode #%u with active dentry \"%s\"->ino #%u\n",
dead_f->inocache->ino, fd->name, fd->ino); dead_f->inocache->ino,
fd->name, fd->ino);
} else { } else {
jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n", jffs2_dbg(1, "Removing deletion dirent for \"%s\" from dir ino #%u\n",
fd->name, fd->name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment