Commit 9d122629 authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba

btrfs: Make btrfs_log_changed_extents take btrfs_inode

Signed-off-by: default avatarNikolay Borisov <n.borisov.lkml@gmail.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 22346637
...@@ -4053,7 +4053,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans, ...@@ -4053,7 +4053,7 @@ static int wait_ordered_extents(struct btrfs_trans_handle *trans,
} }
static int log_one_extent(struct btrfs_trans_handle *trans, static int log_one_extent(struct btrfs_trans_handle *trans,
struct inode *inode, struct btrfs_root *root, struct btrfs_inode *inode, struct btrfs_root *root,
const struct extent_map *em, const struct extent_map *em,
struct btrfs_path *path, struct btrfs_path *path,
const struct list_head *logged_list, const struct list_head *logged_list,
...@@ -4070,7 +4070,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -4070,7 +4070,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
int extent_inserted = 0; int extent_inserted = 0;
bool ordered_io_err = false; bool ordered_io_err = false;
ret = wait_ordered_extents(trans, inode, root, em, logged_list, ret = wait_ordered_extents(trans, &inode->vfs_inode, root, em, logged_list,
&ordered_io_err); &ordered_io_err);
if (ret) if (ret)
return ret; return ret;
...@@ -4082,14 +4082,14 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -4082,14 +4082,14 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
btrfs_init_map_token(&token); btrfs_init_map_token(&token);
ret = __btrfs_drop_extents(trans, log, inode, path, em->start, ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start,
em->start + em->len, NULL, 0, 1, em->start + em->len, NULL, 0, 1,
sizeof(*fi), &extent_inserted); sizeof(*fi), &extent_inserted);
if (ret) if (ret)
return ret; return ret;
if (!extent_inserted) { if (!extent_inserted) {
key.objectid = btrfs_ino(BTRFS_I(inode)); key.objectid = btrfs_ino(inode);
key.type = BTRFS_EXTENT_DATA_KEY; key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = em->start; key.offset = em->start;
...@@ -4148,7 +4148,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -4148,7 +4148,7 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct inode *inode, struct btrfs_inode *inode,
struct btrfs_path *path, struct btrfs_path *path,
struct list_head *logged_list, struct list_head *logged_list,
struct btrfs_log_ctx *ctx, struct btrfs_log_ctx *ctx,
...@@ -4157,14 +4157,14 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4157,14 +4157,14 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
{ {
struct extent_map *em, *n; struct extent_map *em, *n;
struct list_head extents; struct list_head extents;
struct extent_map_tree *tree = &BTRFS_I(inode)->extent_tree; struct extent_map_tree *tree = &inode->extent_tree;
u64 test_gen; u64 test_gen;
int ret = 0; int ret = 0;
int num = 0; int num = 0;
INIT_LIST_HEAD(&extents); INIT_LIST_HEAD(&extents);
down_write(&BTRFS_I(inode)->dio_sem); down_write(&inode->dio_sem);
write_lock(&tree->lock); write_lock(&tree->lock);
test_gen = root->fs_info->last_trans_committed; test_gen = root->fs_info->last_trans_committed;
...@@ -4193,7 +4193,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4193,7 +4193,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
} }
list_sort(NULL, &extents, extent_cmp); list_sort(NULL, &extents, extent_cmp);
btrfs_get_logged_extents(BTRFS_I(inode), logged_list, start, end); btrfs_get_logged_extents(inode, logged_list, start, end);
/* /*
* Some ordered extents started by fsync might have completed * Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which * before we could collect them into the list logged_list, which
...@@ -4204,7 +4204,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4204,7 +4204,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
* without writing to the log tree and the fsync must report the * without writing to the log tree and the fsync must report the
* file data write error and not commit the current transaction. * file data write error and not commit the current transaction.
*/ */
ret = filemap_check_errors(inode->i_mapping); ret = filemap_check_errors(inode->vfs_inode.i_mapping);
if (ret) if (ret)
ctx->io_err = ret; ctx->io_err = ret;
process: process:
...@@ -4233,7 +4233,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4233,7 +4233,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
} }
WARN_ON(!list_empty(&extents)); WARN_ON(!list_empty(&extents));
write_unlock(&tree->lock); write_unlock(&tree->lock);
up_write(&BTRFS_I(inode)->dio_sem); up_write(&inode->dio_sem);
btrfs_release_path(path); btrfs_release_path(path);
return ret; return ret;
...@@ -4938,7 +4938,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -4938,7 +4938,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
goto out_unlock; goto out_unlock;
} }
if (fast_search) { if (fast_search) {
ret = btrfs_log_changed_extents(trans, root, inode, dst_path, ret = btrfs_log_changed_extents(trans, root, BTRFS_I(inode), dst_path,
&logged_list, ctx, start, end); &logged_list, ctx, start, end);
if (ret) { if (ret) {
err = ret; err = ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment