]> err.no Git - linux-2.6/blobdiff - fs/jffs2/readinode.c
slab allocators: Remove SLAB_DEBUG_INITIAL flag
[linux-2.6] / fs / jffs2 / readinode.c
index b09fa23abe53fa8cc985d2cd69b82679f7565594..6aff38930b50619475e4e2974341427f185298b8 100644 (file)
@@ -1,14 +1,12 @@
 /*
  * JFFS2 -- Journalling Flash File System, Version 2.
  *
- * Copyright (C) 2001-2003 Red Hat, Inc.
+ * Copyright © 2001-2007 Red Hat, Inc.
  *
  * Created by David Woodhouse <dwmw2@infradead.org>
  *
  * For licensing information, see the file 'LICENCE' in this directory.
  *
- * $Id: readinode.c,v 1.143 2005/11/07 11:14:41 gleixner Exp $
- *
  */
 
 #include <linux/kernel.h>
@@ -1134,7 +1132,7 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
                                        struct jffs2_raw_inode *latest_node)
 {
        struct jffs2_readinode_info rii;
-       uint32_t crc;
+       uint32_t crc, new_size;
        size_t retlen;
        int ret;
 
@@ -1235,7 +1233,12 @@ static int jffs2_do_read_inode_internal(struct jffs2_sb_info *c,
 
        case S_IFREG:
                /* If it was a regular file, truncate it to the latest node's isize */
-               jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(latest_node->isize));
+               new_size = jffs2_truncate_fragtree(c, &f->fragtree, je32_to_cpu(latest_node->isize));
+               if (new_size != je32_to_cpu(latest_node->isize)) {
+                       JFFS2_WARNING("Truncating ino #%u to %d bytes failed because it only had %d bytes to start with!\n",
+                                     f->inocache->ino, je32_to_cpu(latest_node->isize), new_size);
+                       latest_node->isize = cpu_to_je32(new_size);
+               }
                break;
 
        case S_IFLNK: