projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
configure: add generic pshared mutex test
[fio.git]
/
backend.c
diff --git
a/backend.c
b/backend.c
index c8c6de6d69c826867f2b482bfca6ebd1c211d602..b61de7c0782bfd1400d97b2077da521c7a55e152 100644
(file)
--- a/
backend.c
+++ b/
backend.c
@@
-76,9
+76,6
@@
int shm_id = 0;
int temp_stall_ts;
unsigned long done_secs = 0;
int temp_stall_ts;
unsigned long done_secs = 0;
-#define PAGE_ALIGN(buf) \
- (char *) (((uintptr_t) (buf) + page_mask) & ~page_mask)
-
#define JOB_START_TIMEOUT (5 * 1000)
static void sig_int(int sig)
#define JOB_START_TIMEOUT (5 * 1000)
static void sig_int(int sig)
@@
-779,8
+776,8
@@
static bool io_bytes_exceeded(struct thread_data *td, uint64_t *this_bytes)
else
bytes = this_bytes[DDIR_TRIM];
else
bytes = this_bytes[DDIR_TRIM];
- if (td->o.io_
limit
)
- limit = td->o.io_
limit
;
+ if (td->o.io_
size
)
+ limit = td->o.io_
size
;
else
limit = td->o.size;
else
limit = td->o.size;
@@
-854,11
+851,11
@@
static void do_io(struct thread_data *td, uint64_t *bytes_done)
total_bytes = td->o.size;
/*
total_bytes = td->o.size;
/*
- * Allow random overwrite workloads to write up to io_
limit
+ * Allow random overwrite workloads to write up to io_
size
* before starting verification phase as 'size' doesn't apply.
*/
if (td_write(td) && td_random(td) && td->o.norandommap)
* before starting verification phase as 'size' doesn't apply.
*/
if (td_write(td) && td_random(td) && td->o.norandommap)
- total_bytes = max(total_bytes, (uint64_t) td->o.io_
limit
);
+ total_bytes = max(total_bytes, (uint64_t) td->o.io_
size
);
/*
* If verify_backlog is enabled, we'll run the verify in this
* handler as well. For that case, we may need up to twice the
/*
* If verify_backlog is enabled, we'll run the verify in this
* handler as well. For that case, we may need up to twice the
@@
-1198,7
+1195,7
@@
static int init_io_u(struct thread_data *td)
if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
td_ioengine_flagged(td, FIO_RAWIO))
if (td->o.odirect || td->o.mem_align || td->o.oatomic ||
td_ioengine_flagged(td, FIO_RAWIO))
- p = P
AGE_ALIGN(td->orig_buffer
) + td->o.mem_align;
+ p = P
TR_ALIGN(td->orig_buffer, page_mask
) + td->o.mem_align;
else
p = td->orig_buffer;
else
p = td->orig_buffer;
@@
-1264,6
+1261,10
@@
static int init_io_u(struct thread_data *td)
return 0;
}
return 0;
}
+/*
+ * This function is Linux specific.
+ * FIO_HAVE_IOSCHED_SWITCH enabled currently means it's Linux.
+ */
static int switch_ioscheduler(struct thread_data *td)
{
#ifdef FIO_HAVE_IOSCHED_SWITCH
static int switch_ioscheduler(struct thread_data *td)
{
#ifdef FIO_HAVE_IOSCHED_SWITCH
@@
-1274,7
+1275,8
@@
static int switch_ioscheduler(struct thread_data *td)
if (td_ioengine_flagged(td, FIO_DISKLESSIO))
return 0;
if (td_ioengine_flagged(td, FIO_DISKLESSIO))
return 0;
- sprintf(tmp, "%s/queue/scheduler", td->sysfs_root);
+ assert(td->files && td->files[0]);
+ sprintf(tmp, "%s/queue/scheduler", td->files[0]->du->sysfs_root);
f = fopen(tmp, "r+");
if (!f) {
f = fopen(tmp, "r+");
if (!f) {
@@
-1353,8
+1355,8
@@
static bool keep_running(struct thread_data *td)
if (exceeds_number_ios(td))
return false;
if (exceeds_number_ios(td))
return false;
- if (td->o.io_
limit
)
- limit = td->o.io_
limit
;
+ if (td->o.io_
size
)
+ limit = td->o.io_
size
;
else
limit = td->o.size;
else
limit = td->o.size;
@@
-1362,14
+1364,14
@@
static bool keep_running(struct thread_data *td)
uint64_t diff;
/*
uint64_t diff;
/*
- * If the difference is less than the m
in
imum IO size, we
+ * If the difference is less than the m
ax
imum IO size, we
* are done.
*/
diff = limit - ddir_rw_sum(td->io_bytes);
if (diff < td_max_bs(td))
return false;
* are done.
*/
diff = limit - ddir_rw_sum(td->io_bytes);
if (diff < td_max_bs(td))
return false;
- if (fio_files_done(td) && !td->o.io_
limit
)
+ if (fio_files_done(td) && !td->o.io_
size
)
return false;
return true;
return false;
return true;
@@
-1691,7
+1693,7
@@
static void *thread_main(void *data)
prune_io_piece_log(td);
prune_io_piece_log(td);
- if (td->o.verify_only &&
(td_write(td) || td_rw(td)
))
+ if (td->o.verify_only &&
td_write(td
))
verify_bytes = do_dry_run(td);
else {
uint64_t bytes_done[DDIR_RWDIR_CNT];
verify_bytes = do_dry_run(td);
else {
uint64_t bytes_done[DDIR_RWDIR_CNT];
@@
-2054,8
+2056,16
@@
static bool check_mount_writes(struct thread_data *td)
if (!td_write(td) || td->o.allow_mounted_write)
return false;
if (!td_write(td) || td->o.allow_mounted_write)
return false;
+ /*
+ * If FIO_HAVE_CHARDEV_SIZE is defined, it's likely that chrdevs
+ * are mkfs'd and mounted.
+ */
for_each_file(td, f, i) {
for_each_file(td, f, i) {
- if (f->filetype != FIO_TYPE_BD)
+#ifdef FIO_HAVE_CHARDEV_SIZE
+ if (f->filetype != FIO_TYPE_BLOCK && f->filetype != FIO_TYPE_CHAR)
+#else
+ if (f->filetype != FIO_TYPE_BLOCK)
+#endif
continue;
if (device_is_mounted(f->file_name))
goto mounted;
continue;
if (device_is_mounted(f->file_name))
goto mounted;
@@
-2063,7
+2073,7
@@
static bool check_mount_writes(struct thread_data *td)
return false;
mounted:
return false;
mounted:
- log_err("fio: %s appears mounted, and 'allow_mounted_write' isn't set. Aborting.", f->file_name);
+ log_err("fio: %s appears mounted, and 'allow_mounted_write' isn't set. Aborting.
\n
", f->file_name);
return true;
}
return true;
}