shithub: lwext4

Download patch

ref: e9ef4e35940f806cd40959d5b641d6687fa93b17
parent: 1cd9e263f29e4f5d596fc17515d014a721ac2f11
author: ngkaho1234 <[email protected]>
date: Sat Oct 24 04:37:33 EDT 2015

ext4_extent_full.c: very minor code optimisations on checksum handling

--- a/lwext4/ext4_extent_full.c
+++ b/lwext4/ext4_extent_full.c
@@ -348,10 +348,9 @@
 static int ext4_ext_dirty(struct ext4_inode_ref *inode_ref,
 			  struct ext4_extent_path *path)
 {
-	if (path->block.lb_id) {
-		ext4_extent_block_csum_set(inode_ref, path->header);
+	if (path->block.lb_id)
 		path->block.dirty = true;
-	} else
+	else
 		inode_ref->dirty = true;
 
 	return EOK;
@@ -371,6 +370,10 @@
 
 	for (i = 0; i <= depth; i++, path++) {
 		if (path->block.lb_id) {
+			if (path->block.dirty)
+				ext4_extent_block_csum_set(inode_ref,
+						path->header);
+
 			ext4_block_set(inode_ref->fs->bdev, &path->block);
 		}
 	}