Avoid irrelevant "offset extend ends" error message
[fio.git] / filesetup.c
index eb28826698811058a317fa6544b92bd8f388a368..3217e4f3080cad0e782fc22e302304e49ae6531e 100644 (file)
@@ -374,12 +374,22 @@ static int get_file_size(struct thread_data *td, struct fio_file *f)
                ret = bdev_size(td, f);
        else if (f->filetype == FIO_TYPE_CHAR)
                ret = char_size(td, f);
                ret = bdev_size(td, f);
        else if (f->filetype == FIO_TYPE_CHAR)
                ret = char_size(td, f);
-       else
+       else {
                f->real_file_size = -1;
                f->real_file_size = -1;
+               log_info("%s: failed to get file size of %s\n", td->o.name,
+                                       f->file_name);
+               return 1; /* avoid offset extends end error message */
+       }
 
        if (ret)
                return ret;
 
 
        if (ret)
                return ret;
 
+       /*
+        * ->file_offset normally hasn't been initialized yet, so this
+        * is basically always false unless ->real_file_size is -1, but
+        * if ->real_file_size is -1 this message doesn't make sense.
+        * As a result, this message is basically useless.
+        */
        if (f->file_offset > f->real_file_size) {
                log_err("%s: offset extends end (%llu > %llu)\n", td->o.name,
                                        (unsigned long long) f->file_offset,
        if (f->file_offset > f->real_file_size) {
                log_err("%s: offset extends end (%llu > %llu)\n", td->o.name,
                                        (unsigned long long) f->file_offset,
@@ -498,9 +508,6 @@ int file_lookup_open(struct fio_file *f, int flags)
        __f = lookup_file_hash(f->file_name);
        if (__f) {
                dprint(FD_FILE, "found file in hash %s\n", f->file_name);
        __f = lookup_file_hash(f->file_name);
        if (__f) {
                dprint(FD_FILE, "found file in hash %s\n", f->file_name);
-               /*
-                * racy, need the __f->lock locked
-                */
                f->lock = __f->lock;
                from_hash = 1;
        } else {
                f->lock = __f->lock;
                from_hash = 1;
        } else {
@@ -996,8 +1003,8 @@ int setup_files(struct thread_data *td)
         * stored entries.
         */
        if (!o->read_iolog_file) {
         * stored entries.
         */
        if (!o->read_iolog_file) {
-               if (o->io_limit)
-                       td->total_io_size = o->io_limit * o->loops;
+               if (o->io_size)
+                       td->total_io_size = o->io_size * o->loops;
                else
                        td->total_io_size = o->size * o->loops;
        }
                else
                        td->total_io_size = o->size * o->loops;
        }