Whamcloud - gitweb
badblocks: implement read throttling
authorIustin Pop <iustin@google.com>
Thu, 12 Jun 2008 07:30:04 +0000 (09:30 +0200)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 17 Jun 2008 11:47:25 +0000 (07:47 -0400)
commit264f64a5a8bb7225ab8513de6f1c6ac9e7448790
tree7e469e7049b09d80f6397160a34f6aa5bb1873dc
parenteb594251b6d1a06d2acbb281b3816c017d7066eb
badblocks: implement read throttling

Currently, badblocks will read as fast as it can from the drive. While
this is what one wants usually, if badblocks is run in read-only mode on
a drive that is in use, it will greatly degrade the other users of this
disk.

This patch adds a throttling mode for reads where each read will be
delayed by a percentage of the time the previous read took; i.e., an
invocation of '-d 100' will cause the sleep to be the same as the read
took, a value of 200 will cause the sleep to be twice as high, and a
value of 50 will cause it to be half.  This will not be done if the
previous read had errors, since then the hardware will possibly have
timeouts and that would decrease the speed too much.

This algorithm helps when the disk is used by other processes as then,
due to the increased load, the time spent doing the reads will be
higher, and correspondingly badblocks will sleep even more and thus it
will use less of the drive's bandwidth. This is different from using
ionice, as it is a voluntary (and partial) throttling.

Signed-off-by: Iustin Pop <iustin@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
misc/badblocks.8.in
misc/badblocks.c