FIX: ext4_extent.c failed to be compiled.
authorngkaho1234 <ngkaho1234@gmail.com>
Tue, 27 Oct 2015 14:25:17 +0000 (22:25 +0800)
committerngkaho1234 <ngkaho1234@gmail.com>
Tue, 27 Oct 2015 14:25:17 +0000 (22:25 +0800)
lwext4/ext4_extent.c

index 5e1ec8c5e9e97d827be3413b0ef685f63d1369f0..67d6b70dde366a2b93978f55bd52a1a6eaba0bd4 100644 (file)
@@ -43,6 +43,7 @@
 #include "ext4_extent.h"
 #include "ext4_inode.h"
 #include "ext4_super.h"
+#include "ext4_crc32c.h"
 #include "ext4_blockdev.h"
 #include "ext4_balloc.h"
 #include "ext4_fs.h"
@@ -151,6 +152,18 @@ static uint32_t ext4_ext_block_csum(struct ext4_inode_ref *inode_ref,
        return checksum;
 }
 
+static struct ext4_extent_header *ext_block_hdr(struct ext4_block *block)
+{
+       return (struct ext4_extent_header *)block->data;
+}
+
+static struct ext4_extent_tail *
+find_ext4_extent_tail(struct ext4_extent_header *eh)
+{
+       return (struct ext4_extent_tail *)(((char *)eh) +
+                                          EXT4_EXTENT_TAIL_OFFSET(eh));
+}
+
 /*
  * BIG FAT NOTES:
  *       Currently we do not verify the checksum of extent
@@ -465,7 +478,7 @@ int ext4_extent_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
        }
 
        ext4_extent_header_set_entries_count(path_ptr->header, entries);
-       ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
        path_ptr->block.dirty = true;
 
        /* If leaf node is empty, parent entry must be modified */
@@ -507,7 +520,7 @@ int ext4_extent_remove_space(struct ext4_inode_ref *inode_ref, ext4_lblk_t from,
                }
 
                ext4_extent_header_set_entries_count(path_ptr->header, entries);
-               ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+               ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
                path_ptr->block.dirty = true;
 
                /* Free the node if it is empty */
@@ -635,7 +648,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                                                     path_ptr->depth);
                        ext4_extent_header_set_generation(path_ptr->header, 0);
 
-                       ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
                        path_ptr->block.dirty = true;
 
                        /* Jump to the preceding item */
@@ -661,7 +674,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
 
                        ext4_extent_header_set_entries_count(path_ptr->header,
                                                             entries + 1);
-                       ext4_extent_block_csum_set(inode_ref, path_ptr->header);
+                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
                        path_ptr->block.dirty = true;
 
                        /* No more splitting needed */
@@ -744,7 +757,7 @@ static int ext4_extent_append_extent(struct ext4_inode_ref *inode_ref,
                ext4_extent_header_set_max_entries_count(old_root->header,
                                                         limit);
 
-               ext4_extent_block_csum_set(inode_ref, ext_block_hdr(old_root->block));
+               ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&old_root->block));
                old_root->block.dirty = true;
 
                /* Re-initialize new root metadata */
@@ -859,7 +872,7 @@ ext4_extent_append_block(struct ext4_inode_ref *inode_ref, uint32_t *iblock,
                                inode_ref->dirty = true;
                        }
 
-                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
                        path_ptr->block.dirty = true;
 
                        goto finish;
@@ -901,7 +914,7 @@ ext4_extent_append_block(struct ext4_inode_ref *inode_ref, uint32_t *iblock,
                                inode_ref->dirty = true;
                        }
 
-                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+                       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
                        path_ptr->block.dirty = true;
 
                        goto finish;
@@ -942,7 +955,7 @@ append_extent:
                inode_ref->dirty = true;
        }
 
-       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(path_ptr->block));
+       ext4_extent_block_csum_set(inode_ref, ext_block_hdr(&path_ptr->block));
        path_ptr->block.dirty = true;
 
 finish: