Re: scrub backing device
From: Kent Overstreet <hidden>
Date: 2016-05-13 22:21:37
On Wed, May 11, 2016 at 04:57:48PM -0700, Marc MERLIN wrote:
On Thu, May 12, 2016 at 07:34:26AM +0800, ching wrote:quoted
for example https://btrfs.wiki.kernel.org/index.php/Manpage/btrfs-scrubbtrfs scrub is designed to make sure all the blocks and checksums are consistent. Ching makes a good point that it would be helpful to have a way to access the underlying backing device directly to ensure it is consistent. I think currently you can use dmsetup with an offset to get the real filesystem past the bcache header, mount that read only somewhere and scrub that. Not ideal because scrub will not be able to fix issues that are fixable, but at least it should report errors.
Look at the verify code in drivers/md/bcache/debug.c, there's a CONFIG_BCACHE_DEBUG mode where every time it reads clean cached data it reads the data from the backing device and compares. But for a scrub though you really want to walk all the _cached_ data, so it'd take a bit more code than that.