ext4_balloc: fix not invaliding cache correctly
authorKaho Ng <ngkaho1234@gmail.com>
Wed, 21 Jun 2017 18:26:19 +0000 (02:26 +0800)
committerKaho Ng <ngkaho1234@gmail.com>
Thu, 22 Jun 2017 10:13:59 +0000 (18:13 +0800)
We fix ext4_balloc_free_blocks() not invaliding cache
correctly according to start block and block count parameter
from caller.

src/ext4_balloc.c

index a308fbbb990a708473f311bf605c786b1cc84f86..8e5e26c7a02fb6266277b9a7fe018268609606da 100644 (file)
@@ -235,6 +235,7 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
 {
        int rc = EOK;
        uint32_t blk_cnt = count;
+       ext4_fsblk_t start_block = first;
        struct ext4_fs *fs = inode_ref->fs;
        struct ext4_sblock *sb = &fs->sb;
 
@@ -341,7 +342,7 @@ int ext4_balloc_free_blocks(struct ext4_inode_ref *inode_ref,
 
        }
 
-       ext4_bcache_invalidate_lba(fs->bdev->bc, first, count);
+       ext4_bcache_invalidate_lba(fs->bdev->bc, start_block, blk_cnt);
        /*All blocks should be released*/
        ext4_assert(count == 0);