shithub: lwext4

Download patch

ref: b6056a57e3b1d82324da37a5f371b303144ce19e
parent: a8d8a94bfac9a6dfcbbfb463f62444f968637d5a
author: gkostka <kostka.grzegorz@gmail.com>
date: Sun Apr 6 15:36:34 EDT 2014

* STM32F429 demo in cache writeback mode
* Faster inode alocation (first fit)
* readme update

--- a/demos/stm32f429_disco/main.c
+++ b/demos/stm32f429_disco/main.c
@@ -215,7 +215,7 @@
     }
 
 
-    ext4_cache_write_back("/mp/", 1);
+
     printf("Add files to: /mp/dir1\n");
     for (i = 0; i < len; ++i) {
         sprintf(path, "/mp/dir1/f%d", i);
@@ -225,7 +225,7 @@
             return false;
         }
     }
-    ext4_cache_write_back("/mp/", 0);
+
     stop =  get_ms();
     diff = stop - start;
     dir_ls("/mp/dir1");
@@ -432,6 +432,7 @@
     if(!mount())
         return EXIT_FAILURE;
 
+    ext4_cache_write_back("/mp/", 1);
     cleanup();
 
     if(sbstat){
@@ -465,6 +466,7 @@
         block_stats();
     }
 
+    ext4_cache_write_back("/mp/", 0);
     if(!umount())
         return EXIT_FAILURE;
 
--- a/lwext4/ext4_ialloc.c
+++ b/lwext4/ext4_ialloc.c
@@ -158,7 +158,6 @@
     uint32_t bgid = fs->last_inode_bg_id;
     uint32_t bg_count = ext4_block_group_cnt(sb);
     uint32_t sb_free_inodes = ext4_get32(sb, free_inodes_count);
-    uint32_t avg_free_inodes = sb_free_inodes / bg_count;
     bool     rewind = false;
 
     /* Try to find free i-node in all block groups */
@@ -186,7 +185,7 @@
         uint32_t used_dirs = ext4_bg_get_used_dirs_count(bg, sb);
 
         /* Check if this block group is good candidate for allocation */
-        if (free_inodes >= avg_free_inodes) {
+        if (free_inodes > 0) {
             /* Load block with bitmap */
             uint32_t bitmap_block_addr = ext4_bg_get_inode_bitmap(
                     bg_ref.block_group, sb);
--- a/readme.mediawiki
+++ b/readme.mediawiki
@@ -95,6 +95,7 @@
  - ext4.h           - lwext4 client library header
  - CMakeLists.txt   - CMake config file
  - ext_images.7z    - ext2/3/4 100MB images
+ - fs_test.mk       - automatic tests definition
  - Makefile         - helper makefile to call cmake
  - readme.mediawiki - yes, you are here ;)
   
@@ -129,7 +130,7 @@
  cd build_generic
  make
 
-==Generic demo applicarion==
+==Generic demo application==
 
 Features:
  - load ext2/3/4 images
@@ -162,7 +163,23 @@
     --sbstat - superblock stats                                 
     --wpart  - windows partition mode                           
 
+==Client-server automatic test suitr==
 
+Build:
+ make
+ cd build_generic
+ make
+ 
+Unpack images:
+ make unpack_images
+ 
+Run server:
+ make server_ext2
+ 
+Run tests:
+ make all_tests
+
+
 ==Cross-Compile==
 
  Toolchain for ARM Cortex-m3/4: https://launchpad.net/gcc-arm-embedded
@@ -170,17 +187,46 @@
 
 Build bf518 library:
  make bf518
-
+ cd build_bf518
+ make lwext4
+ 
 Build cortex-m3 library:
  make cortex-m3
+ cd build_cortex-m3
+ make lwext4
 
 Build cortex-m4 library:
  make cortex-m4
+ cd build_cortex-m4
+ make lwext4
 
 ==Ports==
- *Blackfin BF518 EZKIT SD Card Demo: TBD
- *STM32F4-Discovery SD Card Demo: TBD 
+STM32F429-DISCO USB flash drive Demo 
+ 
+Build STM32F429 Demo:
+ make cortex-m4
+ cd build_cortex-m4
+ make all
 
 ==Footprint==
-                           
-TBD
\ No newline at end of file
+
+ TOOLCHAIN: arm-none-eabi-gcc
+ OPT: Os  
+ OUTPUT:
+   text    data     bss     dec     hex filename
+   5728       0       0    5728    1660 ext4.c.obj (ex liblwext4.a)
+   2264       0       0    2264     8d8 ext4_balloc.c.obj (ex liblwext4.a)
+   1324       0       0    1324     52c ext4_bcache.c.obj (ex liblwext4.a)
+    936       0       0     936     3a8 ext4_bitmap.c.obj (ex liblwext4.a)
+   2016       0       0    2016     7e0 ext4_blockdev.c.obj (ex liblwext4.a)
+    624       0       0     624     270 ext4_block_group.c.obj (ex liblwext4.a)
+     24       0       4      28      1c ext4_debug.c.obj (ex liblwext4.a)
+   2264       0       0    2264     8d8 ext4_dir.c.obj (ex liblwext4.a)
+   3204       0       0    3204     c84 ext4_dir_idx.c.obj (ex liblwext4.a)
+   3104       0       0    3104     c20 ext4_extent.c.obj (ex liblwext4.a)
+   7360       0       0    7360    1cc0 ext4_fs.c.obj (ex liblwext4.a)
+   2496       0       0    2496     9c0 ext4_hash.c.obj (ex liblwext4.a)
+    684       0       0     684     2ac ext4_ialloc.c.obj (ex liblwext4.a)
+    652       0       0     652     28c ext4_inode.c.obj (ex liblwext4.a)
+    352       0       0     352     160 ext4_super.c.obj (ex liblwext4.a)                      
+                           
\ No newline at end of file