[PATCH] Don't allow mlock of more than real_mem-128MiB
[fio.git] / fio-ini.c
index fc0d5eef54e0be4c056ede2f8f22234244708b8f..9b9262c9d8e0274528ce991190b01b365d86e523 100644 (file)
--- a/fio-ini.c
+++ b/fio-ini.c
@@ -50,6 +50,7 @@ int rate_quit = 0;
 int write_lat_log = 0;
 int write_bw_log = 0;
 int exitall_on_terminate = 0;
+unsigned long long mlock_size = 0;
 
 static int setup_rate(struct thread_data *td)
 {
@@ -362,7 +363,7 @@ static int str_cnv(char *p, unsigned long long *val)
        if (*val == ULONG_MAX && errno == ERANGE)
                return 1;
 
-       *val *= get_mult(str[len - 2]);
+       *val *= get_mult(str[len - 1]);
        return 0;
 }
 
@@ -807,6 +808,10 @@ int parse_jobs_ini(char *file)
                                fgetpos(f, &off);
                                continue;
                        }
+                       if (!check_strcnv(p, "lockmem", &mlock_size)) {
+                               fgetpos(f, &off);
+                               continue;
+                       }
                        if (!check_strstore(p, "directory", td->directory)) {
                                fgetpos(f, &off);
                                continue;