ubifs: Don't compress when a compression is failed
authorDonggeun Kim <dg77.kim@samsung.com>
Tue, 16 Nov 2010 05:36:54 +0000 (14:36 +0900)
committerDonggeun Kim <dg77.kim@samsung.com>
Tue, 16 Nov 2010 05:36:54 +0000 (14:36 +0900)
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
fs/ubifs/mkfs.ubifs.c

index 80528d0..f992a17 100644 (file)
@@ -572,15 +572,11 @@ static int add_data_node(unsigned long file_size, void *src_addr, ino_t inum)
                        return err;
                dn->compr_type = cpu_to_le16(MKFS_UBIFS_COMPR_LZO);
 
+               /* No compression */
                if (out_len > UBIFS_BLOCK_SIZE) {
-                       bytes_read = UBIFS_BLOCK_SIZE - UBIFS_DATA_NODE_SZ;
-                       dn->size = cpu_to_le32(bytes_read);
-                       memset(buf, 0, UBIFS_BLOCK_SIZE);
-                       memcpy(buf, src_addr + offset, bytes_read);
-
-                       err = lzo1x_1_compress(buf, bytes_read, dn->data, &out_len, lzo_mem);
-                       if (err != LZO_E_OK)
-                               return err;
+                       memcpy(dn->data, buf, bytes_read);
+                       out_len = bytes_read;
+                       dn->compr_type = cpu_to_le16(MKFS_UBIFS_COMPR_NONE);
                }
 
                dn_len = UBIFS_DATA_NODE_SZ + out_len;