btrfs progs: fix extra metadata chunk allocation in --mixed case
authorArne Jansen <sensille@gmx.net>
Thu, 5 May 2011 14:16:12 +0000 (16:16 +0200)
committerChris Mason <chris.mason@oracle.com>
Tue, 25 Oct 2011 13:18:58 +0000 (09:18 -0400)
commit2689259501c1a52a95c934f464460ed362bc0489
tree7781b1b914ad7cbdb4b2c3f19de650fdba81adff
parentde07f367c4fa42e257e8a04eb0637a54825b3a9a
btrfs progs: fix extra metadata chunk allocation in --mixed case

When creating a mixed fs with mkfs, an extra metadata chunk got allocated.
This is because btrfs_reserve_extent calls do_chunk_alloc for METADATA,
which in turn wasn't able to find the proper space_info, as __find_space_info
did a hard compare of the flags. It is now sufficient for the space_info to
include the proper flag. This reflects the change done to the kernel code
to support mixed chunks.
Also for a subsequent chunk allocation (which should not be hit in the mkfs
case), the chunk is now created with the flags from the space_info instead
of the requested flags. A better solution would be to pull the full changeset
for the mixed case from the kernel into the user mode (or, even better, share
the code)

The additional chunk probably confused block_rsv calculation, which in turn
led to severeal ENOSPC Oopses.

Signed-off-by: Arne Jansen <sensille@gmx.net>
Signed-off-by: Hugo Mills <hugo@carfax.org.uk>
extent-tree.c