Commit a2120a47 authored by Josef Bacik's avatar Josef Bacik Committed by David Sterba

btrfs: clean up the left over logged_list usage

We no longer use this list we've passed around so remove it everywhere.
Also remove the extra checks for ordered/filemap errors as this is
handled higher up now that we're waiting on ordered_extents before
getting to the tree log code.
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
Reviewed-by: default avatarFilipe Manana <fdmanana@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e7175a69
...@@ -4129,7 +4129,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -4129,7 +4129,6 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
struct btrfs_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,
struct btrfs_log_ctx *ctx) struct btrfs_log_ctx *ctx)
{ {
struct btrfs_root *log = root->log_root; struct btrfs_root *log = root->log_root;
...@@ -4141,17 +4140,11 @@ static int log_one_extent(struct btrfs_trans_handle *trans, ...@@ -4141,17 +4140,11 @@ static int log_one_extent(struct btrfs_trans_handle *trans,
u64 block_len; u64 block_len;
int ret; int ret;
int extent_inserted = 0; int extent_inserted = 0;
bool ordered_io_err = false;
ret = log_extent_csums(trans, inode, root, em); ret = log_extent_csums(trans, inode, root, em);
if (ret) if (ret)
return ret; return ret;
if (ordered_io_err) {
ctx->io_err = -EIO;
return ctx->io_err;
}
btrfs_init_map_token(&token); btrfs_init_map_token(&token);
ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start, ret = __btrfs_drop_extents(trans, log, &inode->vfs_inode, path, em->start,
...@@ -4326,7 +4319,6 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4326,7 +4319,6 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_root *root,
struct btrfs_inode *inode, struct btrfs_inode *inode,
struct btrfs_path *path, struct btrfs_path *path,
struct list_head *logged_list,
struct btrfs_log_ctx *ctx, struct btrfs_log_ctx *ctx,
const u64 start, const u64 start,
const u64 end) const u64 end)
...@@ -4382,20 +4374,6 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4382,20 +4374,6 @@ 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(inode, logged_list, logged_start, logged_end);
/*
* Some ordered extents started by fsync might have completed
* before we could collect them into the list logged_list, which
* means they're gone, not in our logged_list nor in the inode's
* ordered tree. We want the application/user space to know an
* error happened while attempting to persist file data so that
* it can take proper action. If such error happened, we leave
* without writing to the log tree and the fsync must report the
* file data write error and not commit the current transaction.
*/
ret = filemap_check_errors(inode->vfs_inode.i_mapping);
if (ret)
ctx->io_err = ret;
process: process:
while (!list_empty(&extents)) { while (!list_empty(&extents)) {
em = list_entry(extents.next, struct extent_map, list); em = list_entry(extents.next, struct extent_map, list);
...@@ -4414,8 +4392,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans, ...@@ -4414,8 +4392,7 @@ static int btrfs_log_changed_extents(struct btrfs_trans_handle *trans,
write_unlock(&tree->lock); write_unlock(&tree->lock);
ret = log_one_extent(trans, inode, root, em, path, logged_list, ret = log_one_extent(trans, inode, root, em, path, ctx);
ctx);
write_lock(&tree->lock); write_lock(&tree->lock);
clear_em_logging(tree, em); clear_em_logging(tree, em);
free_extent_map(em); free_extent_map(em);
...@@ -4800,7 +4777,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -4800,7 +4777,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
struct btrfs_key min_key; struct btrfs_key min_key;
struct btrfs_key max_key; struct btrfs_key max_key;
struct btrfs_root *log = root->log_root; struct btrfs_root *log = root->log_root;
LIST_HEAD(logged_list);
u64 last_extent = 0; u64 last_extent = 0;
int err = 0; int err = 0;
int ret; int ret;
...@@ -5137,7 +5113,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -5137,7 +5113,7 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
} }
if (fast_search) { if (fast_search) {
ret = btrfs_log_changed_extents(trans, root, inode, dst_path, ret = btrfs_log_changed_extents(trans, root, inode, dst_path,
&logged_list, ctx, start, end); ctx, start, end);
if (ret) { if (ret) {
err = ret; err = ret;
goto out_unlock; goto out_unlock;
...@@ -5188,10 +5164,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans, ...@@ -5188,10 +5164,6 @@ static int btrfs_log_inode(struct btrfs_trans_handle *trans,
inode->last_log_commit = inode->last_sub_trans; inode->last_log_commit = inode->last_sub_trans;
spin_unlock(&inode->lock); spin_unlock(&inode->lock);
out_unlock: out_unlock:
if (unlikely(err))
btrfs_put_logged_extents(&logged_list);
else
btrfs_submit_logged_extents(&logged_list, log);
mutex_unlock(&inode->log_mutex); mutex_unlock(&inode->log_mutex);
btrfs_free_path(path); btrfs_free_path(path);
......
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