btrfs: Remove BUG_ON from __finish_chunk_alloc()
authorMark Fasheh <mfasheh@suse.de>
Fri, 9 Sep 2011 00:40:01 +0000 (17:40 -0700)
committerDavid Sterba <dsterba@suse.cz>
Thu, 22 Mar 2012 00:45:39 +0000 (01:45 +0100)
btrfs_alloc_chunk() unconditionally BUGs on any error returned from
__finish_chunk_alloc() so there's no need for two BUG_ON lines. Remove the
one from __finish_chunk_alloc().

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
fs/btrfs/volumes.c

index f002973959d0053a8f1e8b441e43419b43dc558c..394bf15ea18c938f4840f53c4b5d0228bb1470c1 100644 (file)
@@ -3383,7 +3383,8 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans,
                device = map->stripes[index].dev;
                device->bytes_used += stripe_size;
                ret = btrfs_update_device(trans, device);
-               BUG_ON(ret);
+               if (ret)
+                       goto out_free;
                index++;
        }
 
@@ -3430,6 +3431,7 @@ static int __finish_chunk_alloc(struct btrfs_trans_handle *trans,
                                             item_size);
        }
 
+out_free:
        kfree(chunk);
        return ret;
 }