Btrfs: add owner and type fields to the extents aand block headers
Signed-off-by: Chris Mason <chris.mason@oracle.com>
This commit is contained in:

committed by
David Woodhouse

parent
33ade1f826
commit
4d77567309
@@ -460,9 +460,10 @@ error:
|
||||
*
|
||||
* returns 0 if everything worked, non-zero otherwise.
|
||||
*/
|
||||
int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||
*root, u64 num_blocks, u64 search_start, u64
|
||||
search_end, struct btrfs_key *ins)
|
||||
int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root, u64 owner,
|
||||
u8 type, u64 num_blocks, u64 search_start,
|
||||
u64 search_end, struct btrfs_key *ins)
|
||||
{
|
||||
int ret;
|
||||
int pending_ret;
|
||||
@@ -472,6 +473,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||
struct btrfs_extent_item extent_item;
|
||||
|
||||
btrfs_set_extent_refs(&extent_item, 1);
|
||||
btrfs_set_extent_owner(&extent_item, owner);
|
||||
btrfs_set_extent_type(&extent_item, type);
|
||||
|
||||
if (root == extent_root) {
|
||||
BUG_ON(extent_root->fs_info->current_insert.offset == 0);
|
||||
@@ -508,13 +511,15 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans, struct btrfs_root
|
||||
* returns the tree buffer or NULL.
|
||||
*/
|
||||
struct buffer_head *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
|
||||
struct btrfs_root *root)
|
||||
struct btrfs_root *root)
|
||||
{
|
||||
struct btrfs_key ins;
|
||||
int ret;
|
||||
struct buffer_head *buf;
|
||||
|
||||
ret = btrfs_alloc_extent(trans, root, 1, 0, (unsigned long)-1, &ins);
|
||||
ret = btrfs_alloc_extent(trans, root, root->root_key.objectid,
|
||||
BTRFS_EXTENT_TREE,
|
||||
1, 0, (unsigned long)-1, &ins);
|
||||
if (ret) {
|
||||
BUG();
|
||||
return NULL;
|
||||
|
Reference in New Issue
Block a user