summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2012-11-20 14:07:39 -0800
committerThe Android Automerger <android-build@android.com>2012-11-29 10:47:08 -0800
commit6a73c51fbf0dfacedc21614b112a1a3f26820afb (patch)
tree9003da022ab5069c3156c0c13f64c16bbbdd59ca
parent80d69a7349b7311e6fd2769a8a2b83d0e573562b (diff)
downloadextras-jb-mr1-release.tar.gz
make_ext4fs: fix dentry padding when dentry size is 4088 or 4092android-4.2.1_r1.2android-4.2.1_r1.1jb-mr1-release
When the total dentry size is N * 4096 - 4 or N * 4096 - 8, there is not enough room in the block to insert an extra padding dentry. Instead, switch to always padding the previous dentry out to the end of the block, which matches what the kernel does when creating new directory entries. Also fix dentry_size to return the size of all the dentries without the padding, the len + 8 padding is incorrect, and the DIV_ROUND_UP will round up to the correct number of blocks. Change-Id: If11f90e4ee172c135a0eae2a50b8be213e2dd0dc
-rw-r--r--ext4_utils/contents.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index 345ab1ef..aeed31ee 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -44,11 +44,6 @@ static u32 dentry_size(u32 entries, struct dentry *dentries)
len += dentry_len;
}
- /* include size of the dentry used to pad until the end of the block */
- if (len % info.block_size + 8 > info.block_size)
- len += info.block_size - (len % info.block_size);
- len += 8;
-
return len;
}
@@ -160,11 +155,8 @@ u32 make_directory(u32 dir_inode_num, u32 entries, struct dentry *dentries,
}
}
- dentry = (struct ext4_dir_entry_2 *)(data + offset);
- dentry->inode = 0;
- dentry->rec_len = len - offset;
- dentry->name_len = 0;
- dentry->file_type = EXT4_FT_UNKNOWN;
+ /* pad the last dentry out to the end of the block */
+ dentry->rec_len += len - offset;
return inode_num;
}