Re: fio offset with ba

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

 



On 24 October 2017 at 00:56, Jeff Furlong <jeff.furlong@xxxxxxx> wrote:
>
> diff --git a/HOWTO b/HOWTO
> index 22a5849..c611fae 100644
> --- a/HOWTO
> +++ b/HOWTO
> @@ -1128,13 +1128,19 @@ I/O type
>  .. option:: offset=int
>
>         Start I/O at the provided offset in the file, given as either a fixed size in
> -       bytes or a percentage. If a percentage is given, the next ``blockalign``-ed
> +       bytes or a percentage. If a percentage is given, the next ``bs`` ``blockalign``-ed

I'd stop referencing blockalign here to avoid confusion and say something like:

When a percentage is given, the generated offset will be aligned up to
the minimum ``blocksize`` or to the value of ``offset_align``.

>         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.
>         A percentage can be specified by a number between 1 and 100 followed by '%',
>         for example, ``offset=20%`` to specify 20%.
>
> +.. option:: offset_align=int
> +
> +       If a precentage offset is given, the provided offset is ``blockalign``-ed to
> +       the ``blocksize``. This value will align the initial I/O to a new alignment
> +       Applies to sequential workloads only.

Actually it will should apply to all workloads because a random
workload won't be able to generate an offset that is less than the
aligned offset. I'd go with something like the following:

If set to a non-zero number, the value generated by a percentage
``offset`` is aligned upwards to this value. Defaults to 0 meaning
that a percentage offset is aligned to the minimum block size.

> --- a/filesetup.c
> +++ b/filesetup.c
> @@ -869,10 +869,15 @@ uint64_t get_start_offset(struct thread_data *td, struct fio_file *f)
>
>         if (o->start_offset_percent > 0) {
>                 /*
> +                * if offset_align is provided, set initial offset
> +                */
> +               if (fio_option_is_set(o, start_offset_align)) {
> +                       align_bs = o->start_offset_align;
> +               /*
>                  * if blockalign is provided, find the min across read, write,
>                  * and trim
>                  */
> -               if (fio_option_is_set(o, ba)) {
> +               } else 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);

Why check ba here? I don't think we get anything from trying to align
the offset to blockalign given its behaviour.

>                 } else {
> diff --git a/fio.1 b/fio.1
> index 7787ef2..098ca2e 100644
> --- a/fio.1
> +++ b/fio.1
> @@ -913,13 +913,18 @@ should be associated with them.
>  .TP
>  .BI offset \fR=\fPint
>  Start I/O at the provided offset in the file, given as either a fixed size in
> -bytes or a percentage. If a percentage is given, the next \fBblockalign\fR\-ed
> +bytes or a percentage. If a percentage is given, the next \fBbs\fR \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.
>  A percentage can be specified by a number between 1 and 100 followed by '%',
>  for example, `offset=20%' to specify 20%.

See above for documentation suggestions.

>  .TP
> +.BI offset_align \fR=\fPint
> +If a precentage offset is given, the provided offset is \fBblockalign\fR\-ed to
> +the \fBblocksize\fR. This value will align the initial I/O to a new alignment.
> +Applies to sequential workloads only.
> +.TP
>  .BI offset_increment \fR=\fPint
>  If this is provided, then the real offset becomes `\fBoffset\fR + \fBoffset_increment\fR
>  * thread_number', where the thread number is a counter that starts at 0 and
> diff --git a/options.c b/options.c
> index ddcc4e5..a7821d7 100644
> --- a/options.c
> +++ b/options.c
> @@ -2019,6 +2019,17 @@ struct fio_option fio_options[FIO_MAX_OPTS] = {
>                 .group  = FIO_OPT_G_INVALID,
>         },
>         {
> +               .name   = "offset_align",
> +               .lname  = "IO offset alignment",
> +               .type   = FIO_OPT_STR_VAL,

Isn't FIO_OPT_INT more appropriate?

> +               .off1   = offsetof(struct thread_options, start_offset_align),
> +               .help   = "Start IO from this offset alignment",
> +               .def    = "0",
> +               .interval = 1024 * 1024,

Actually here's a question - what does .interval do?

> +               .category = FIO_OPT_C_IO,
> +               .group  = FIO_OPT_G_INVALID,
> +       },
> +       {
>                 .name   = "offset_increment",
>                 .lname  = "IO offset increment",
>                 .type   = FIO_OPT_STR_VAL,
> diff --git a/thread_options.h b/thread_options.h
> index 1813cdc..5a037bf 100644
> --- a/thread_options.h
> +++ b/thread_options.h
> @@ -78,6 +78,7 @@ struct thread_options {
>         unsigned long long file_size_low;
>         unsigned long long file_size_high;
>         unsigned long long start_offset;
> +       unsigned long long start_offset_align;
>
>         unsigned int bs[DDIR_RWDIR_CNT];
>         unsigned int ba[DDIR_RWDIR_CNT];
> @@ -355,6 +356,7 @@ struct thread_options_pack {
>         uint64_t file_size_low;
>         uint64_t file_size_high;
>         uint64_t start_offset;
> +       uint64_t start_offset_align;
>
>         uint32_t bs[DDIR_RWDIR_CNT];
>         uint32_t ba[DDIR_RWDIR_CNT];
>
>
>
> Regards,
> Jeff

Thanks for trying this out Jeff!

-- 
Sitsofe | http://sucs.org/~sits/
--
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