btrfs-progs: Return more meaningful value for btrfs_read_deve_super
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Mon, 26 Sep 2016 04:54:26 +0000 (12:54 +0800)
committerDavid Sterba <dsterba@suse.com>
Mon, 3 Oct 2016 13:07:22 +0000 (15:07 +0200)
commit50c8c995eace63599ee956980b8e525fbe6a089b
treec589518722f0cc974b283e147fa59a947ccddf07
parent6bdb1cfbc1a3ab1f1fc2eb23daef777c17bd0b1a
btrfs-progs: Return more meaningful value for btrfs_read_deve_super

btrfs_read_dev_super() only returns 0 or -1, which doesn't really help,
caller won't know if it's caused by bad superblock or superblock out of
range.

Return -errno if pread64() return -1, and return -EOF if none or part of
the super is read out, and return what check_super() returned.

So caller can get -EIO to catch real corrupted super blocks.

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