btrfs-progs: chunk-recover: improve error handling in insert_stripe

Switch to negative errnos, the callchain handles errors.

Signed-off-by: David Sterba <dsterba@suse.com>
master
David Sterba 2016-09-06 13:39:41 +02:00
parent 1620e2a042
commit b83e93e65d
1 changed files with 6 additions and 3 deletions

View File

@ -1947,9 +1947,12 @@ static int insert_stripe(struct list_head *devexts,
dev = btrfs_find_device_by_devid(rc->fs_devices, devext->objectid,
0);
if (!dev)
return 1;
BUG_ON(btrfs_find_device_by_devid(rc->fs_devices, devext->objectid,
1));
return -ENOENT;
if (btrfs_find_device_by_devid(rc->fs_devices, devext->objectid, 1)) {
error("unexpected: found another device with id %llu",
(unsigned long long)devext->objectid);
return -EINVAL;
}
chunk->stripes[index].devid = devext->objectid;
chunk->stripes[index].offset = devext->offset;