* [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK
@ 2017-01-18 17:38 kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 2/5] Fix typo for "job" in plural kusumi.tomohiro
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: kusumi.tomohiro @ 2017-01-18 17:38 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Since character device is FIO_TYPE_CHAR, BLOCK (or BLK) makes
better sense for block device.
This may break external ioengines on compile-time, but ioengines
usually don't refer to file type which are regfile/blk/chr/pipe
(which I believe makes sense to commit this change as there's
been changes that break not only api but also abi).
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
backend.c | 2 +-
engines/binject.c | 2 +-
engines/mmap.c | 2 +-
engines/sg.c | 8 ++++----
file.h | 2 +-
filesetup.c | 10 +++++-----
ioengines.c | 4 ++--
7 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/backend.c b/backend.c
index a46101c..4570d8d 100644
--- a/backend.c
+++ b/backend.c
@@ -2055,7 +2055,7 @@ static bool check_mount_writes(struct thread_data *td)
return false;
for_each_file(td, f, i) {
- if (f->filetype != FIO_TYPE_BD)
+ if (f->filetype != FIO_TYPE_BLOCK)
continue;
if (device_is_mounted(f->file_name))
goto mounted;
diff --git a/engines/binject.c b/engines/binject.c
index 7d20a3f..932534a 100644
--- a/engines/binject.c
+++ b/engines/binject.c
@@ -351,7 +351,7 @@ static int fio_binject_open_file(struct thread_data *td, struct fio_file *f)
if (ret)
return 1;
- if (f->filetype != FIO_TYPE_BD) {
+ if (f->filetype != FIO_TYPE_BLOCK) {
log_err("fio: binject only works with block devices\n");
goto err_close;
}
diff --git a/engines/mmap.c b/engines/mmap.c
index 99e1d6a..bc038f4 100644
--- a/engines/mmap.c
+++ b/engines/mmap.c
@@ -67,7 +67,7 @@ static int fio_mmap_file(struct thread_data *td, struct fio_file *f,
}
#ifdef FIO_MADV_FREE
- if (f->filetype == FIO_TYPE_BD)
+ if (f->filetype == FIO_TYPE_BLOCK)
(void) posix_madvise(fmd->mmap_ptr, fmd->mmap_sz, FIO_MADV_FREE);
#endif
diff --git a/engines/sg.c b/engines/sg.c
index 3f7d911..2148e87 100644
--- a/engines/sg.c
+++ b/engines/sg.c
@@ -252,7 +252,7 @@ static int fio_sgio_doio(struct thread_data *td, struct io_u *io_u, int do_sync)
struct fio_file *f = io_u->file;
int ret;
- if (f->filetype == FIO_TYPE_BD) {
+ if (f->filetype == FIO_TYPE_BLOCK) {
ret = fio_sgio_ioctl_doio(td, f, io_u);
td->error = io_u->error;
} else {
@@ -504,7 +504,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
unsigned int bs = 0;
unsigned long long max_lba = 0;
- if (f->filetype == FIO_TYPE_BD) {
+ if (f->filetype == FIO_TYPE_BLOCK) {
if (ioctl(f->fd, BLKSSZGET, &bs) < 0) {
td_verror(td, errno, "ioctl");
return 1;
@@ -537,7 +537,7 @@ static int fio_sgio_type_check(struct thread_data *td, struct fio_file *f)
MAX_10B_LBA, max_lba);
}
- if (f->filetype == FIO_TYPE_BD) {
+ if (f->filetype == FIO_TYPE_BLOCK) {
td->io_ops->getevents = NULL;
td->io_ops->event = NULL;
}
@@ -789,7 +789,7 @@ static int fio_sgio_get_file_size(struct thread_data *td, struct fio_file *f)
if (fio_file_size_known(f))
return 0;
- if (f->filetype != FIO_TYPE_BD && f->filetype != FIO_TYPE_CHAR) {
+ if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR) {
td_verror(td, EINVAL, "wrong file type");
log_err("ioengine sg only works on block or character devices\n");
return 1;
diff --git a/file.h b/file.h
index 6f34dd5..ac00ff8 100644
--- a/file.h
+++ b/file.h
@@ -15,7 +15,7 @@
*/
enum fio_filetype {
FIO_TYPE_FILE = 1, /* plain file */
- FIO_TYPE_BD, /* block device */
+ FIO_TYPE_BLOCK, /* block device */
FIO_TYPE_CHAR, /* character device */
FIO_TYPE_PIPE, /* pipe */
};
diff --git a/filesetup.c b/filesetup.c
index ef94bd2..eb28826 100644
--- a/filesetup.c
+++ b/filesetup.c
@@ -370,7 +370,7 @@ static int get_file_size(struct thread_data *td, struct fio_file *f)
if (f->filetype == FIO_TYPE_FILE)
ret = file_size(td, f);
- else if (f->filetype == FIO_TYPE_BD)
+ else if (f->filetype == FIO_TYPE_BLOCK)
ret = bdev_size(td, f);
else if (f->filetype == FIO_TYPE_CHAR)
ret = char_size(td, f);
@@ -420,7 +420,7 @@ static int __file_invalidate_cache(struct thread_data *td, struct fio_file *f,
ret = posix_fadvise(f->fd, off, len, POSIX_FADV_DONTNEED);
if (ret)
errval = ret;
- } else if (f->filetype == FIO_TYPE_BD) {
+ } else if (f->filetype == FIO_TYPE_BLOCK) {
int retry_count = 0;
ret = blockdev_invalidate_cache(f);
@@ -709,7 +709,7 @@ static unsigned long long get_fs_free_counts(struct thread_data *td)
struct stat sb;
char buf[256];
- if (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_CHAR) {
+ if (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_CHAR) {
if (f->real_file_size != -1ULL)
ret += f->real_file_size;
continue;
@@ -1228,12 +1228,12 @@ static void get_file_type(struct fio_file *f)
/* \\.\ is the device namespace in Windows, where every file is
* a block device */
if (strncmp(f->file_name, "\\\\.\\", 4) == 0)
- f->filetype = FIO_TYPE_BD;
+ f->filetype = FIO_TYPE_BLOCK;
#endif
if (!stat(f->file_name, &sb)) {
if (S_ISBLK(sb.st_mode))
- f->filetype = FIO_TYPE_BD;
+ f->filetype = FIO_TYPE_BLOCK;
else if (S_ISCHR(sb.st_mode))
f->filetype = FIO_TYPE_CHAR;
else if (S_ISFIFO(sb.st_mode))
diff --git a/ioengines.c b/ioengines.c
index a1f8756..315432d 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -449,7 +449,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
goto err;
if (td->o.fadvise_hint != F_ADV_NONE &&
- (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+ (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
int flags;
if (td->o.fadvise_hint == F_ADV_TYPE) {
@@ -474,7 +474,7 @@ int td_io_open_file(struct thread_data *td, struct fio_file *f)
}
#ifdef FIO_HAVE_STREAMID
if (td->o.fadvise_stream &&
- (f->filetype == FIO_TYPE_BD || f->filetype == FIO_TYPE_FILE)) {
+ (f->filetype == FIO_TYPE_BLOCK || f->filetype == FIO_TYPE_FILE)) {
off_t stream = td->o.fadvise_stream;
if (posix_fadvise(f->fd, stream, f->io_size, POSIX_FADV_STREAMID) < 0) {
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/5] Fix typo for "job" in plural
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
@ 2017-01-18 17:38 ` kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 3/5] Refactor fio_show_ioengine_help() kusumi.tomohiro
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kusumi.tomohiro @ 2017-01-18 17:38 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
It seems this message was meant to be 1 or more "job".
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/init.c b/init.c
index 324dc7b..2d26c52 100644
--- a/init.c
+++ b/init.c
@@ -2785,7 +2785,7 @@ int parse_options(int argc, char *argv[])
if (did_arg)
return 0;
- log_err("No jobs(s) defined\n\n");
+ log_err("No job(s) defined\n\n");
if (!did_arg) {
usage(argv[0]);
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/5] Refactor fio_show_ioengine_help()
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 2/5] Fix typo for "job" in plural kusumi.tomohiro
@ 2017-01-18 17:38 ` kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 4/5] Move options_mem_dupe() to parse.c kusumi.tomohiro
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: kusumi.tomohiro @ 2017-01-18 17:38 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Since td is there only to call load_ioengine(),
ioengine ops doesn't need to be refered to as td.io_ops.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
ioengines.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/ioengines.c b/ioengines.c
index 315432d..95013d1 100644
--- a/ioengines.c
+++ b/ioengines.c
@@ -618,15 +618,15 @@ int fio_show_ioengine_help(const char *engine)
{
struct flist_head *entry;
struct thread_data td;
+ struct ioengine_ops *io_ops;
char *sep;
int ret = 1;
if (!engine || !*engine) {
log_info("Available IO engines:\n");
flist_for_each(entry, &engine_list) {
- td.io_ops = flist_entry(entry, struct ioengine_ops,
- list);
- log_info("\t%s\n", td.io_ops->name);
+ io_ops = flist_entry(entry, struct ioengine_ops, list);
+ log_info("\t%s\n", io_ops->name);
}
return 0;
}
@@ -638,16 +638,16 @@ int fio_show_ioengine_help(const char *engine)
memset(&td, 0, sizeof(td));
- td.io_ops = load_ioengine(&td, engine);
- if (!td.io_ops) {
+ io_ops = load_ioengine(&td, engine);
+ if (!io_ops) {
log_info("IO engine %s not found\n", engine);
return 1;
}
- if (td.io_ops->options)
- ret = show_cmd_help(td.io_ops->options, sep);
+ if (io_ops->options)
+ ret = show_cmd_help(io_ops->options, sep);
else
- log_info("IO engine %s has no options\n", td.io_ops->name);
+ log_info("IO engine %s has no options\n", io_ops->name);
free_ioengine(&td);
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/5] Move options_mem_dupe() to parse.c
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 2/5] Fix typo for "job" in plural kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 3/5] Refactor fio_show_ioengine_help() kusumi.tomohiro
@ 2017-01-18 17:38 ` kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 5/5] Change td_var() to take void* for the first arg kusumi.tomohiro
2017-01-19 23:10 ` [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: kusumi.tomohiro @ 2017-01-18 17:38 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
This function should be in parse.c with fio_option* argument first.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
fio.h | 1 -
init.c | 2 +-
options.c | 19 ++-----------------
parse.c | 17 +++++++++++++++++
parse.h | 1 +
5 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/fio.h b/fio.h
index 62ff7ab..b2dade9 100644
--- a/fio.h
+++ b/fio.h
@@ -518,7 +518,6 @@ extern int fio_show_option_help(const char *);
extern void fio_options_set_ioengine_opts(struct option *long_options, struct thread_data *td);
extern void fio_options_dup_and_init(struct option *);
extern void fio_options_mem_dupe(struct thread_data *);
-extern void options_mem_dupe(void *data, struct fio_option *options);
extern void td_fill_rand_seeds(struct thread_data *);
extern void td_fill_verify_state_seed(struct thread_data *);
extern void add_job_opts(const char **, int);
diff --git a/init.c b/init.c
index 2d26c52..c3cc3e5 100644
--- a/init.c
+++ b/init.c
@@ -1020,7 +1020,7 @@ int ioengine_load(struct thread_data *td)
*/
if (origeo) {
memcpy(td->eo, origeo, td->io_ops->option_struct_size);
- options_mem_dupe(td->eo, td->io_ops->options);
+ options_mem_dupe(td->io_ops->options, td->eo);
} else {
memset(td->eo, 0, td->io_ops->option_struct_size);
fill_default_options(td->eo, td->io_ops->options);
diff --git a/options.c b/options.c
index 1ca16e8..713112f 100644
--- a/options.c
+++ b/options.c
@@ -4772,34 +4772,19 @@ int fio_show_option_help(const char *opt)
return show_cmd_help(fio_options, opt);
}
-void options_mem_dupe(void *data, struct fio_option *options)
-{
- struct fio_option *o;
- char **ptr;
-
- for (o = &options[0]; o->name; o++) {
- if (o->type != FIO_OPT_STR_STORE)
- continue;
-
- ptr = td_var(data, o, o->off1);
- if (*ptr)
- *ptr = strdup(*ptr);
- }
-}
-
/*
* dupe FIO_OPT_STR_STORE options
*/
void fio_options_mem_dupe(struct thread_data *td)
{
- options_mem_dupe(&td->o, fio_options);
+ options_mem_dupe(fio_options, &td->o);
if (td->eo && td->io_ops) {
void *oldeo = td->eo;
td->eo = malloc(td->io_ops->option_struct_size);
memcpy(td->eo, oldeo, td->io_ops->option_struct_size);
- options_mem_dupe(td->eo, td->io_ops->options);
+ options_mem_dupe(td->io_ops->options, td->eo);
}
}
diff --git a/parse.c b/parse.c
index 518c2df..fc508b6 100644
--- a/parse.c
+++ b/parse.c
@@ -1319,6 +1319,23 @@ void options_init(struct fio_option *options)
}
}
+void options_mem_dupe(struct fio_option *options, void *data)
+{
+ struct fio_option *o;
+ char **ptr;
+
+ dprint(FD_PARSE, "dup options\n");
+
+ for (o = &options[0]; o->name; o++) {
+ if (o->type != FIO_OPT_STR_STORE)
+ continue;
+
+ ptr = td_var(data, o, o->off1);
+ if (*ptr)
+ *ptr = strdup(*ptr);
+ }
+}
+
void options_free(struct fio_option *options, void *data)
{
struct fio_option *o;
diff --git a/parse.h b/parse.h
index 7ba4e37..54e3948 100644
--- a/parse.h
+++ b/parse.h
@@ -86,6 +86,7 @@ extern int parse_cmd_option(const char *t, const char *l, struct fio_option *, v
extern int show_cmd_help(struct fio_option *, const char *);
extern void fill_default_options(void *, struct fio_option *);
extern void options_init(struct fio_option *);
+extern void options_mem_dupe(struct fio_option *, void *);
extern void options_free(struct fio_option *, void *);
extern void strip_blank_front(char **);
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 5/5] Change td_var() to take void* for the first arg
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
` (2 preceding siblings ...)
2017-01-18 17:38 ` [PATCH 4/5] Move options_mem_dupe() to parse.c kusumi.tomohiro
@ 2017-01-18 17:38 ` kusumi.tomohiro
2017-01-19 23:10 ` [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: kusumi.tomohiro @ 2017-01-18 17:38 UTC (permalink / raw)
To: axboe, fio; +Cc: Tomohiro Kusumi
From: Tomohiro Kusumi <tkusumi@tuxera.com>
Callers don't always pass thread_options* to td_var(),
nor is it dependent on a certain structure type,
so just take void* without pointless cast.
Signed-off-by: Tomohiro Kusumi <tkusumi@tuxera.com>
---
parse.h | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/parse.h b/parse.h
index 54e3948..fb6abd1 100644
--- a/parse.h
+++ b/parse.h
@@ -107,8 +107,7 @@ typedef int (fio_opt_str_val_fn)(void *, long long *);
typedef int (fio_opt_int_fn)(void *, int *);
struct thread_options;
-static inline void *td_var(struct thread_options *to, struct fio_option *o,
- unsigned int offset)
+static inline void *td_var(void *to, struct fio_option *o, unsigned int offset)
{
void *ret;
--
2.5.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
` (3 preceding siblings ...)
2017-01-18 17:38 ` [PATCH 5/5] Change td_var() to take void* for the first arg kusumi.tomohiro
@ 2017-01-19 23:10 ` Jens Axboe
4 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-01-19 23:10 UTC (permalink / raw)
To: kusumi.tomohiro; +Cc: fio, Tomohiro Kusumi
On Thu, Jan 19 2017, kusumi.tomohiro@gmail.com wrote:
> From: Tomohiro Kusumi <tkusumi@tuxera.com>
>
> Since character device is FIO_TYPE_CHAR, BLOCK (or BLK) makes
> better sense for block device.
>
> This may break external ioengines on compile-time, but ioengines
> usually don't refer to file type which are regfile/blk/chr/pipe
> (which I believe makes sense to commit this change as there's
> been changes that break not only api but also abi).
Thanks, applied 1-5.
--
Jens Axboe
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-01-19 23:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-18 17:38 [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 2/5] Fix typo for "job" in plural kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 3/5] Refactor fio_show_ioengine_help() kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 4/5] Move options_mem_dupe() to parse.c kusumi.tomohiro
2017-01-18 17:38 ` [PATCH 5/5] Change td_var() to take void* for the first arg kusumi.tomohiro
2017-01-19 23:10 ` [PATCH 1/5] Rename FIO_TYPE_BD to FIO_TYPE_BLOCK Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.