ref: 803375001a1985ae323c86fa3f6f2c4eff14e1e9
parent: 8321f180e635400137d052270e3c463a81738c1f
author: Grzegorz Kostka <kostka.grzegorz@gmail.com>
date: Fri Feb 17 08:44:05 EST 2017
ext4: remove dynamic block cache allocation in ext4_mount
--- a/src/ext4.c
+++ b/src/ext4.c
@@ -91,6 +91,9 @@
/**@brief Journal.*/
struct jbd_journal jbd_journal;
+
+ /**@brief Block cache.*/
+ struct ext4_bcache bc;
};
/**@brief Block devices descriptor.*/
@@ -414,12 +417,10 @@
bsize = ext4_sb_get_block_size(&mp->fs.sb);
ext4_block_set_lb_size(bd, bsize);
+ bc = &mp->bc;
- bc = ext4_malloc(sizeof(struct ext4_bcache));
-
r = ext4_bcache_init_dynamic(bc, CONFIG_BLOCK_DEV_CACHE_SIZE, bsize);
if (r != EOK) {
- ext4_free(bc);
ext4_block_fini(bd);
return r;
}
@@ -433,11 +434,10 @@
ext4_bcache_cleanup(bc);
ext4_block_fini(bd);
ext4_bcache_fini_dynamic(bc);
- ext4_free(bc);
return r;
}
- bd->fs = &mp->fs;
+ bd->fs = &mp->fs;
return r;
}
@@ -466,7 +466,7 @@
ext4_bcache_cleanup(mp->fs.bdev->bc);
ext4_bcache_fini_dynamic(mp->fs.bdev->bc);
- ext4_free(mp->fs.bdev->bc);
+
r = ext4_block_fini(mp->fs.bdev);
Finish:
mp->fs.bdev->fs = NULL;