Skip to contentSkip to conversation

two small patches

PATCH Applied Vincent Fu 2 participants 4 messages Aug 4, 2021 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): CGME20210804182903uscas1p164abe67510e8fa693dbd5d999ecdf24f@uscas1p1.samsung.com

Vincent Fu

author
#1 lore raw

cover two small patches

Hello Jens,

Please consider these two small patches that (1) clarify an error message and (2) fix a segfault.

Vincent

Vincent Fu (2):
backend: clarify io scheduler setting error message
ioengines: fix crash with --enghelp option

 backend.c   |  2 +-
 ioengines.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH 1/2 backend: clarify io scheduler setting error message

If you know *how* fio tries to confirm that the IO scheduler was successfully set, then the error message "io scheduler not found" makes sense. However, if you don't know what fio does to confirm the io scheduler setting, then the error message is confusing. This patch modifies the error message to indicate that the selected IO scheduler could not be set.

---
 backend.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
backend.c +1 -1
index 6290e0d6..808e4362 100644
@@ -1407,7 +1407,7 @@ static int set_ioscheduler(struct thread_data *td, struct fio_file *file)
 
 	sprintf(tmp2, "[%s]", td->o.ioscheduler);
 	if (!strstr(tmp, tmp2)) {
-		log_err("fio: io scheduler %s not found\n", td->o.ioscheduler);
+		log_err("fio: unable to set io scheduler to %s\n", td->o.ioscheduler);
 		td_verror(td, EINVAL, "iosched_switch");
 		fclose(f);
 		return 1;
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH 2/2 ioengines: fix crash with --enghelp option

In reply to Vincent Fu

Since f6931a1dd35896433c8cc2e10de51372a2c496c4 commands like the following segfault:

fio --enghelp=sg
fio --enghelp=sg,sg_write_mode

This is because free_ioengine() assumes that td->io_ops is not NULL. Make this true when free_ioengine() is called by fio_show_ioengine_help() to avoid the crash.

---
 ioengines.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
ioengines.c +5 -5
index dd61af07..d08a511a 100644
@@ -692,17 +692,17 @@ int fio_show_ioengine_help(const char *engine)
 	}
 
 	td.o.ioengine = (char *)engine;
-	io_ops = load_ioengine(&td);
+	td.io_ops = load_ioengine(&td);
 
-	if (!io_ops) {
+	if (!td.io_ops) {
 		log_info("IO engine %s not found\n", engine);
 		return 1;
 	}
 
-	if (io_ops->options)
-		ret = show_cmd_help(io_ops->options, sep);
+	if (td.io_ops->options)
+		ret = show_cmd_help(td.io_ops->options, sep);
 	else
-		log_info("IO engine %s has no options\n", io_ops->name);
+		log_info("IO engine %s has no options\n", td.io_ops->name);
 
 	free_ioengine(&td);
 	return ret;
Signature · 1 line
2.25.1
Applied
#4 lore raw
In reply to Vincent Fu
Quoted 7 lines · Vincent Fu

Hello Jens,

Please consider these two small patches that (1) clarify an error message and (2) fix a segfault.

Vincent

Quoted 7 lines

Vincent Fu (2):
backend: clarify io scheduler setting error message
ioengines: fix crash with --enghelp option

 backend.c   |  2 +-
 ioengines.c | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

Signature · 1 line
Jens Axboe