shithub: lwext4

Download patch

ref: 34dd7330431c99292c332c724e0e493b08e40bd6
parent: a160f264f3affc3e32bba0933399c5074cd7d5c7
author: gkostka <kostka.grzegorz@gmail.com>
date: Mon Apr 7 17:07:55 EDT 2014

Add new tests (large files tests).
Server mount in write back mode.

--- a/fs_test.mk
+++ b/fs_test.mk
@@ -426,6 +426,74 @@
 	$(LWEXT4_CLIENT) -c "stats_check /"
 	$(LWEXT4_CLIENT) -c "umount /"	
 	
+t21:	
+	@echo "T21: 128MB file write/read:"
+	$(LWEXT4_CLIENT) -c "device_register 0 0 bdev"
+	$(LWEXT4_CLIENT) -c "mount bdev /"
+	$(LWEXT4_CLIENT) -c "stats_save /"
+	$(LWEXT4_CLIENT) -c "dir_mk $(TEST_DIR)"
+	
+	$(LWEXT4_CLIENT) -c "fopen 0 $(TEST_DIR)/test.txt wb+"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 0"
+	$(LWEXT4_CLIENT) -c "fsize 0 0"
+	
+	$(LWEXT4_CLIENT) -c "fwrite 0 0 134217728 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 134217728"
+	$(LWEXT4_CLIENT) -c "fsize 0 134217728"
+	
+	$(LWEXT4_CLIENT) -c "fseek 0 0 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 0"
+	$(LWEXT4_CLIENT) -c "fsize 0 134217728"
+	
+	$(LWEXT4_CLIENT) -c "fread 0 0  134217728 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 134217728"
+	$(LWEXT4_CLIENT) -c "fsize 0 134217728"
+	
+	$(LWEXT4_CLIENT) -c "fclose 0"
+
+	$(LWEXT4_CLIENT) -c "fremove $(TEST_DIR)/test.txt"	
+	$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)"
+	$(LWEXT4_CLIENT) -c "stats_check /"
+	$(LWEXT4_CLIENT) -c "umount /"	
+	
+t22:	
+	@echo "T22: 1GB file write/read:"
+	$(LWEXT4_CLIENT) -c "device_register 0 0 bdev"
+	$(LWEXT4_CLIENT) -c "mount bdev /"
+	$(LWEXT4_CLIENT) -c "stats_save /"
+	$(LWEXT4_CLIENT) -c "dir_mk $(TEST_DIR)"
+	
+	$(LWEXT4_CLIENT) -c "fopen 0 $(TEST_DIR)/test.txt wb+"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 0"
+	$(LWEXT4_CLIENT) -c "fsize 0 0"
+	
+	$(LWEXT4_CLIENT) -c "fwrite 0 0 1073741824 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 1073741824"
+	$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
+	
+	$(LWEXT4_CLIENT) -c "fseek 0 0 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 0"
+	$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
+	
+	$(LWEXT4_CLIENT) -c "fread 0 0  1073741824 0"
+	
+	$(LWEXT4_CLIENT) -c "ftell 0 1073741824"
+	$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
+	
+	$(LWEXT4_CLIENT) -c "fclose 0"
+	
+	$(LWEXT4_CLIENT) -c "fremove $(TEST_DIR)/test.txt"	
+	$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)"
+	$(LWEXT4_CLIENT) -c "stats_check /"
+	$(LWEXT4_CLIENT) -c "umount /"	
+	
 
 server_ext2:
 	$(LWEXT4_SERVER) -i ext_images/ext2
--- a/fs_test/lwext4_server.c
+++ b/fs_test/lwext4_server.c
@@ -52,6 +52,8 @@
 /**@brief   Blockdev handle*/
 static struct ext4_blockdev *bd;
 
+static int cache_wb = 0;
+
 static char read_buffer[MAX_RW_BUFFER];
 static char write_buffer[MAX_RW_BUFFER];
 
@@ -60,10 +62,11 @@
 Welcome in lwext4_server.                                       \n\
 Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com)  \n\
 Usage:                                                          \n\
-    --image    (-i) - ext2/3/4 image file                       \n\
-    --port     (-p) - server port                               \n\
-    --verbose  (-v) - verbose mode                              \n\
-    --winpart  (-w) - windows_partition mode                    \n\
+    --image     (-i) - ext2/3/4 image file                      \n\
+    --port      (-p) - server port                              \n\
+    --verbose   (-v) - verbose mode                             \n\
+    --winpart   (-w) - windows_partition mode                   \n\
+    --cache_wb  (-c) - cache writeback_mode                     \n\
 \n";
 
 
@@ -275,10 +278,11 @@
             {"port",    required_argument, 0, 'p'},
             {"verbose", required_argument, 0, 'v'},
             {"winpart", required_argument, 0, 'w'},
+            {"cache_wb",required_argument, 0, 'c'},
             {0, 0, 0, 0}
     };
 
-    while(-1 != (c = getopt_long (argc, argv, "i:p:v:w:", long_options, &option_index))) {
+    while(-1 != (c = getopt_long (argc, argv, "i:p:v:w:c:", long_options, &option_index))) {
 
         switch(c){
         case 'i':
@@ -290,8 +294,8 @@
         case 'v':
             verbose = atoi(optarg);
             break;
-        case 'w':
-            winpart = atoi(optarg);
+        case 'c':
+            cache_wb = atoi(optarg);
             break;
         default:
             printf("%s", usage);
@@ -383,7 +387,10 @@
         return -1;
     }
 
-    return ext4_mount(dev_name, mount_point);
+    rc = ext4_mount(dev_name, mount_point);
+    if(cache_wb)
+        ext4_cache_write_back(mount_point, 1);
+    return rc;
 }
 
 int _umount(char *p)
@@ -394,6 +401,9 @@
         printf("Param list error\n");
         return -1;
     }
+
+    if(cache_wb)
+        ext4_cache_write_back(mount_point, 0);
 
     return ext4_umount(mount_point);
 }