ref: 733c5d6645b133b60d304c38fcb1398f94d0618c
parent: 287519384276174884d7ea1c91168a4a88916276
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Sun Apr 7 19:22:48 EDT 2024
ext4srv: revisit "fix meta csum producing garbage" in a better way The entry's inode wasn't set *before* calculating the checksum. There is no reason to clear the whole block.
--- a/sys/src/cmd/ext4srv/ext4_dir_idx.c
+++ b/sys/src/cmd/ext4srv/ext4_dir_idx.c
@@ -380,10 +380,10 @@
/* 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)) {
int len = block_size - sizeof(struct ext4_dir_entry_tail);
- memset(be, 0, len);
ext4_dir_en_set_entry_len(be, len);
ext4_dir_en_set_name_len(sb, be, 0);
ext4_dir_en_set_inode_type(sb, be, EXT4_DE_UNKNOWN);
@@ -392,8 +392,6 @@
} else {
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);