]> git.baikalelectronics.ru Git - kernel.git/commit
nullb: badbblocks support
authorShaohua Li <shli@fb.com>
Mon, 14 Aug 2017 22:05:00 +0000 (15:05 -0700)
committerJens Axboe <axboe@kernel.dk>
Wed, 23 Aug 2017 14:54:12 +0000 (08:54 -0600)
commitebc7fa772efcb0fb10e632186d516784d6939c75
treef79d4b313cf52ff99236c30de19f5ba223abd60f
parentbd03b7b52642bc46911d39aa0a298584ce0aa7dd
nullb: badbblocks support

Sometime disk could have tracks broken and data there is inaccessable,
but data in other parts can be accessed in normal way. MD RAID supports
such disks. But we don't have a good way to test it, because we can't
control which part of a physical disk is bad. For a virtual disk, this
can be easily controlled.

This patch adds a new 'badblock' attribute. Configure it in this way:
echo "+1-100" > xxx/badblock, this will make sector [1-100] as bad
blocks.
echo "-20-30" > xxx/badblock, this will make sector [20-30] good

If badblocks are accessed, the nullb disk will return IO error. Other
parts of the disk can accessed in normal way.

Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/null_blk.c