btrfs: Make clone_update_extent_map take btrfs_inode

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Nikolay Borisov 2017-02-20 13:51:04 +02:00 committed by David Sterba
parent 6fc0ef6870
commit a2f392e401
1 changed files with 13 additions and 14 deletions

View File

@ -3311,20 +3311,19 @@ out:
return ret;
}
static void clone_update_extent_map(struct inode *inode,
static void clone_update_extent_map(struct btrfs_inode *inode,
const struct btrfs_trans_handle *trans,
const struct btrfs_path *path,
const u64 hole_offset,
const u64 hole_len)
{
struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
struct extent_map_tree *em_tree = &inode->extent_tree;
struct extent_map *em;
int ret;
em = alloc_extent_map();
if (!em) {
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags);
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags);
return;
}
@ -3333,13 +3332,12 @@ static void clone_update_extent_map(struct inode *inode,
fi = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_file_extent_item);
btrfs_extent_item_to_extent_map(BTRFS_I(inode), path, fi,
false, em);
btrfs_extent_item_to_extent_map(inode, path, fi, false, em);
em->generation = -1;
if (btrfs_file_extent_type(path->nodes[0], fi) ==
BTRFS_FILE_EXTENT_INLINE)
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags);
&inode->runtime_flags);
} else {
em->start = hole_offset;
em->len = hole_len;
@ -3360,13 +3358,12 @@ static void clone_update_extent_map(struct inode *inode,
free_extent_map(em);
break;
}
btrfs_drop_extent_cache(BTRFS_I(inode), em->start,
btrfs_drop_extent_cache(inode, em->start,
em->start + em->len - 1, 0);
}
if (ret)
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC,
&BTRFS_I(inode)->runtime_flags);
set_bit(BTRFS_INODE_NEEDS_FULL_SYNC, &inode->runtime_flags);
}
/*
@ -3792,11 +3789,12 @@ process_slot:
/* If we have an implicit hole (NO_HOLES feature). */
if (drop_start < new_key.offset)
clone_update_extent_map(inode, trans,
clone_update_extent_map(BTRFS_I(inode), trans,
NULL, drop_start,
new_key.offset - drop_start);
clone_update_extent_map(inode, trans, path, 0, 0);
clone_update_extent_map(BTRFS_I(inode), trans,
path, 0, 0);
btrfs_mark_buffer_dirty(leaf);
btrfs_release_path(path);
@ -3846,8 +3844,9 @@ process_slot:
btrfs_end_transaction(trans);
goto out;
}
clone_update_extent_map(inode, trans, NULL, last_dest_end,
destoff + len - last_dest_end);
clone_update_extent_map(BTRFS_I(inode), trans, NULL,
last_dest_end,
destoff + len - last_dest_end);
ret = clone_finish_inode_update(trans, inode, destoff + len,
destoff, olen, no_time_update);
}