btrfs-progs: Check sb_bytenr with device size before scanning one device.
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Wed, 12 Nov 2014 05:52:11 +0000 (13:52 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 14 Nov 2014 10:02:16 +0000 (11:02 +0100)
commit0c44c195fecad7db4bba064e6785faadf5c686b8
treedd5d3c5c911f7a7a2918ed2b4deb8c5f56c17674
parent1e3da6d65ebdcf83b1d85f11284cde79777277b9
btrfs-progs: Check sb_bytenr with device size before scanning one device.

When using btrfs check with -s option, if using '-s 2' on a small
device which doesn't have the third superblock, "No valid Btrfs found"
will be output, but it is not appropriate.

So check sb_bytenr against device size before scanning a device and
output proper error message.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
disk-io.c