btrfs-progs: volumes: Remove BUG_ON in raid56 write routine
authorQu Wenruo <quwenruo@cn.fujitsu.com>
Tue, 25 Oct 2016 02:11:04 +0000 (10:11 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 25 Oct 2016 12:28:25 +0000 (14:28 +0200)
commit4d958295d2c7608c8c695d8fc3e9e9e94bae089b
tree4a8cd347b599c36b198e669423b1621aa740b0d7
parentfd48a96b9abab6845c0b148e91f520e74d385d85
btrfs-progs: volumes: Remove BUG_ON in raid56 write routine

Remove various BUG_ON in raid56 write routine, including:
1) Memory allocation error
   Old codes allocates memory when code needs new memory in a loop, and
   catch the error using BUG_ON().
   New codes allocates memory in a allocation loop first, if any failure
   is caught, freeing already allocated memories then throw -ENOMEM.

2) Write error
   Change BUG_ON() to correct return value.

3) Validation check
   Same as write error.

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