=head1 NAME

nbdkit-delay-filter - nbdkit delay filter

=head1 SYNOPSIS

 nbdkit --filter=delay plugin rdelay=SECS wdelay=SECS [plugin-args...]

 nbdkit --filter=delay plugin rdelay=NNms wdelay=NNms [plugin-args...]

 nbdkit --filter=delay plugin [plugin-args ...]
          delay-read=(SECS|NNms) delay-write=(SECS|NNms)
          delay-zero=(SECS|NNms) delay-trim=(SECS|NNms)
          delay-extents=(SECS|NNms) delay-cache=(SECS|NNms)
          delay-fast-zero=BOOL

=head1 DESCRIPTION

C<nbdkit-delay-filter> is a filter that delays read and write requests
by some seconds or milliseconds.  This is used to simulate a slow or
remote server, or to test certain kinds of race conditions in Linux.
To limit server bandwidth use L<nbdkit-rate-filter(1)> instead.

=head1 EXAMPLES

Delays reads and writes by 100ms:

 nbdkit --filter=delay file disk.img rdelay=100ms wdelay=100ms

Delay only zero operations by 1 second, nothing else is affected:

 nbdkit --filter=delay file disk.img delay-zero=1

=head1 PARAMETERS

=over 4

=item B<rdelay=>SECS

=item B<rdelay=>NNB<ms>

=item B<delay-read=>SECS

=item B<delay-read=>NNB<ms>

Delay read operations by C<SECS> seconds or C<NN> milliseconds.

The two forms C<rdelay> and C<delay-read> work identically.

=item B<delay-write=>SECS

=item B<delay-write=>NNB<ms>

Delay write operations by C<SECS> seconds or C<NN> milliseconds.

=item B<delay-zero=>SECS

=item B<delay-zero=>NNB<ms>

Delay zero operations by C<SECS> seconds or C<NN> milliseconds.  See
also B<delay-fast-zero>.

=item B<delay-trim=>SECS

=item B<delay-trim=>NNB<ms>

Delay trim/discard operations by C<SECS> seconds or C<NN> milliseconds.

=item B<delay-extents=>SECS

=item B<delay-extents=>NNB<ms>

Delay block status (extents) operations by C<SECS> seconds or C<NN>
milliseconds.

=item B<delay-cache=>SECS

=item B<delay-cache=>NNB<ms>

Delay advisory cache operations by C<SECS> seconds or C<NN>
milliseconds.

=item B<wdelay=>SECS

=item B<wdelay=>NNB<ms>

Delay write, zero and trim operations by C<SECS> seconds or C<NN>
milliseconds.

=item B<delay-fast-zero=>BOOL

The NBD specification documents an extension called fast zero, in
which the client may request that a server should reply with
C<ENOTSUP> as soon as possible if the zero operation offers no real
speedup over a corresponding write.  By default, this parameter is
true, and fast zero requests are serviced by the plugin after the same
delay as any other zero request; but setting this parameter to false
instantly fails a fast zero response without waiting for or consulting
the plugin.

=back

=head1 FILES

=over 4

=item F<$filterdir/nbdkit-delay-filter.so>

The filter.

Use C<nbdkit --dump-config> to find the location of C<$filterdir>.

=back

=head1 VERSION

C<nbdkit-delay-filter> first appeared in nbdkit 1.2, based on earlier
C<rdelay> and C<wdelay> options in L<nbdkit-file-plugin(1)>.

=head1 SEE ALSO

L<nbdkit(1)>,
L<nbdkit-filter(3)>,
L<nbdkit-rate-filter(1)>.

=head1 AUTHORS

Richard W.M. Jones

=head1 COPYRIGHT

Copyright (C) 2018 Red Hat Inc.
