Allow randommap allocation to fail
[fio.git] / filesetup.c
index bb43ee5829f9dfff3231ebb3ca7f4b50ac1e7bab..6c5770b463b035b6a77cbe7300855a65967eff8f 100644 (file)
@@ -37,6 +37,7 @@ static int extend_file(struct thread_data *td, struct fio_file *f)
                unlink_file = 1;
 
        if (unlink_file || new_layout) {
+               dprint(FD_FILE, "layout unlink %s\n", f->file_name);
                if ((unlink(f->file_name) < 0) && (errno != ENOENT)) {
                        td_verror(td, errno, "unlink");
                        return 1;
@@ -116,7 +117,6 @@ err:
        return 1;
 }
 
-               dprint(FD_FILE, "layout unlink %s\n", f->file_name);
 static unsigned long long get_rand_file_size(struct thread_data *td)
 {
        unsigned long long ret, size_d;
@@ -575,13 +575,14 @@ int init_random_map(struct thread_data *td)
                num_maps = (blocks + BLOCKS_PER_MAP - 1) /
                                (unsigned long long) BLOCKS_PER_MAP;
                f->file_map = smalloc(num_maps * sizeof(long));
-               if (!f->file_map) {
-                       log_err("fio: failed allocating random map. If running"
-                               " a large number of jobs, try the 'norandommap'"
-                               " option\n");
-                       return 1;
+               if (f->file_map) {
+                       f->num_maps = num_maps;
+                       continue;
                }
-               f->num_maps = num_maps;
+
+               log_info("fio: file %s failed allocating random map. Running "
+                        "job without.\n", f->file_name);
+               f->num_maps = 0;
        }
 
        return 0;