Skip to content

Commit

Permalink
dir_idx: initialize entry inode before calculating csum
Browse files Browse the repository at this point in the history
Signed-off-by: Waldemar Kozaczuk <jwkozaczuk@gmail.com>
  • Loading branch information
wkozaczuk committed Mar 18, 2024
1 parent 58bcf89 commit c6fed65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ext4_dir_idx.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,8 @@ int ext4_dir_dx_init(struct ext4_inode_ref *dir, struct ext4_inode_ref *parent)
/* Fill the whole block with empty entry */
struct ext4_dir_en *be = (void *)new_block.data;

ext4_dir_en_set_inode(be, 0);

if (ext4_sb_feature_ro_com(sb, EXT4_FRO_COM_METADATA_CSUM)) {
uint16_t len = block_size - sizeof(struct ext4_dir_entry_tail);
ext4_dir_en_set_entry_len(be, len);
Expand All @@ -444,8 +446,6 @@ int ext4_dir_dx_init(struct ext4_inode_ref *dir, struct ext4_inode_ref *parent)
ext4_dir_en_set_entry_len(be, block_size);
}

ext4_dir_en_set_inode(be, 0);

ext4_trans_set_block_dirty(new_block.buf);
rc = ext4_block_set(dir->fs->bdev, &new_block);
if (rc != EOK) {
Expand Down

0 comments on commit c6fed65

Please sign in to comment.