From: Jens Axboe Date: Mon, 5 Jun 2017 15:36:23 +0000 (-0600) Subject: Merge branch 'master' of https://github.com/cbwest3/fio X-Git-Tag: fio-2.21~24 X-Git-Url: https://git.kernel.dk/?p=fio.git;a=commitdiff_plain;h=2293bf6886095fc180a77a958511bd6385840874;hp=-c Merge branch 'master' of https://github.com/cbwest3/fio --- 2293bf6886095fc180a77a958511bd6385840874 diff --combined HOWTO index 6c9e9a4e,e39111fa..5c5ac26f --- a/HOWTO +++ b/HOWTO @@@ -1072,10 -1072,11 +1072,11 @@@ I/O typ .. option:: offset=int - Start I/O at the given offset in the file. The data before the given offset - will not be touched. This effectively caps the file size at `real_size - - offset`. Can be combined with :option:`size` to constrain the start and - end range that I/O will be done within. + Start I/O at the provided offset in the file, given as either a fixed size or + a percentage. If a percentage is given, the next ``blockalign``-ed offset + will be used. Data before the given offset will not be touched. This + effectively caps the file size at `real_size - offset`. Can be combined with + :option:`size` to constrain the start and end range of the I/O workload. .. option:: offset_increment=int @@@ -1290,7 -1291,7 +1291,7 @@@ Block siz means default for reads, 8k for writes and trims. **bs=,8k,** - means default for reads, 8k for writes, and default for writes. + means default for reads, 8k for writes, and default for trims. .. option:: blocksize_range=irange[,irange][,irange], bsrange=irange[,irange][,irange] @@@ -2467,7 -2468,6 +2468,7 @@@ Verificatio contents to one or more separate threads. If using this offload option, even sync I/O engines can benefit from using an :option:`iodepth` setting higher than 1, as it allows them to have I/O in flight while verifies are running. + Defaults to 0 async threads, i.e. verification is not asynchronous. .. option:: verify_async_cpus=str @@@ -2504,7 -2504,7 +2505,7 @@@ is "local" for a local run, "sock" for a client/server socket connection, and "ip" (192.168.0.1, for instance) for a networked - client/server connection. + client/server connection. Defaults to true. .. option:: verify_state_load=bool diff --combined filesetup.c index 8a0968d6,25ce0c0d..e548d21d --- a/filesetup.c +++ b/filesetup.c @@@ -833,12 -833,35 +833,35 @@@ static unsigned long long get_fs_free_c uint64_t get_start_offset(struct thread_data *td, struct fio_file *f) { struct thread_options *o = &td->o; + unsigned long long align_bs; /* align the offset to this block size */ + unsigned long long offset; /* align_bs-aligned offset */ if (o->file_append && f->filetype == FIO_TYPE_FILE) return f->real_file_size; - return td->o.start_offset + - td->subjob_number * td->o.offset_increment; + if (o->start_offset_percent > 0) { + + /* if blockalign is provided, find the min across read, write, and trim */ + if (fio_option_is_set(o, ba)) { + align_bs = (unsigned long long) min(o->ba[DDIR_READ], o->ba[DDIR_WRITE]); + align_bs = min((unsigned long long) o->ba[DDIR_TRIM], align_bs); + } else { /* else take the minimum block size */ + align_bs = td_min_bs(td); + } + + /* calculate the raw offset */ + offset = (f->real_file_size * o->start_offset_percent / 100) + + (td->subjob_number * o->offset_increment); + + /* block align the offset at the next available boundary at + ceiling(offset / align_bs) * align_bs */ + offset = (offset / align_bs + (offset % align_bs != 0)) * align_bs; + + } else { /* start_offset_percent not set */ + offset = o->start_offset + o->start_offset + + td->subjob_number * o->offset_increment; + } + return offset; } /* @@@ -986,14 -1009,7 +1009,14 @@@ int setup_files(struct thread_data *td total_size = -1ULL; else { if (o->size_percent) { - f->io_size = (f->io_size * o->size_percent) / 100; + uint64_t file_size; + + file_size = f->io_size + f->file_offset; + f->io_size = (file_size * + o->size_percent) / 100; + if (f->io_size > (file_size - f->file_offset)) + f->io_size = file_size - f->file_offset; + f->io_size -= (f->io_size % td_min_bs(td)); } total_size += f->io_size; diff --combined fio.1 index 99568676,31eb161c..39ccd63d --- a/fio.1 +++ b/fio.1 @@@ -1,4 -1,4 +1,4 @@@ -.TH fio 1 "March 2017" "User Manual" +.TH fio 1 "May 2017" "User Manual" .SH NAME fio \- flexible I/O tester .SH SYNOPSIS @@@ -533,7 -533,7 +533,7 @@@ bs=256k means 256k for reads, write bs=8k,32k means 8k for reads, 32k for writes and trims bs=8k,32k, means 8k for reads, 32k for writes, and default for trims bs=,8k means default for reads, 8k for writes and trims -bs=,8k, means default for reads, 8k for writes, and default for writes +bs=,8k, means default for reads, 8k for writes, and default for trims .fi .TP .BI blocksize_range \fR=\fPirange[,irange][,irange] "\fR,\fB bsrange" \fR=\fPirange[,irange][,irange] @@@ -904,7 -904,11 +904,11 @@@ If true, use buffered I/O. This is th Default: true. .TP .BI offset \fR=\fPint - Offset in the file to start I/O. Data before the offset will not be touched. + Start I/O at the provided offset in the file, given as either a fixed size or a + percentage. If a percentage is given, the next \fBblockalign\fR-ed offset will + be used. Data before the given offset will not be touched. This effectively + caps the file size at (real_size - offset). Can be combined with \fBsize\fR to + constrain the start and end range of the I/O workload. .TP .BI offset_increment \fR=\fPint If this is provided, then the real offset becomes the @@@ -2594,7 -2598,7 +2598,7 @@@ Sample jobfiles are available in the \f .br These are typically located under /usr/share/doc/fio. -\fBHOWTO\fR: http://git.kernel.dk/?p=fio.git;a=blob_plain;f=HOWTO +\fBHOWTO\fR: http://git.kernel.dk/cgit/fio/plain/HOWTO .br -\fBREADME\fR: http://git.kernel.dk/?p=fio.git;a=blob_plain;f=README +\fBREADME\fR: http://git.kernel.dk/cgit/fio/plain/README .br