[PATCH 2/6] Avoid irrelevant "offset extend ends" error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When ->real_file_size is -1 due to unsupported file type/etc,
"if (f->file_offset > f->real_file_size)" conditional is always true
(unless ->file_offset is also negative which is an another problem),
and results in irrelevant error message. To avoid this, just return
1 without showing the irrelevant error message and then return 1.

It's still possible that char_size() returns with ->real_file_size
set to -1 (though platform dependent), and the irrelevant error
message be shown.

Also this message itself isn't likely to show any relevant info
due to the timing it's been called as mentioned in a comment.

Signed-off-by: Tomohiro Kusumi <tkusumi@xxxxxxxxxx>
---
 filesetup.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/filesetup.c b/filesetup.c
index 74551a4..3217e4f 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -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);
-	else
+	else {
 		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;
 
+	/*
+	 * ->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,
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe fio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux