diff options
Diffstat (limited to 'fs/btrfs/tree-log.c')
-rw-r--r-- | fs/btrfs/tree-log.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index 528cae123dc9..3d33c4e41e5f 100644 --- a/fs/btrfs/tree-log.c +++ b/fs/btrfs/tree-log.c | |||
@@ -2713,14 +2713,12 @@ static inline void btrfs_remove_all_log_ctxs(struct btrfs_root *root, | |||
2713 | int index, int error) | 2713 | int index, int error) |
2714 | { | 2714 | { |
2715 | struct btrfs_log_ctx *ctx; | 2715 | struct btrfs_log_ctx *ctx; |
2716 | struct btrfs_log_ctx *safe; | ||
2716 | 2717 | ||
2717 | if (!error) { | 2718 | list_for_each_entry_safe(ctx, safe, &root->log_ctxs[index], list) { |
2718 | INIT_LIST_HEAD(&root->log_ctxs[index]); | 2719 | list_del_init(&ctx->list); |
2719 | return; | ||
2720 | } | ||
2721 | |||
2722 | list_for_each_entry(ctx, &root->log_ctxs[index], list) | ||
2723 | ctx->log_ret = error; | 2720 | ctx->log_ret = error; |
2721 | } | ||
2724 | 2722 | ||
2725 | INIT_LIST_HEAD(&root->log_ctxs[index]); | 2723 | INIT_LIST_HEAD(&root->log_ctxs[index]); |
2726 | } | 2724 | } |
@@ -2961,13 +2959,9 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, | |||
2961 | mutex_unlock(&root->log_mutex); | 2959 | mutex_unlock(&root->log_mutex); |
2962 | 2960 | ||
2963 | out_wake_log_root: | 2961 | out_wake_log_root: |
2964 | /* | 2962 | mutex_lock(&log_root_tree->log_mutex); |
2965 | * We needn't get log_mutex here because we are sure all | ||
2966 | * the other tasks are blocked. | ||
2967 | */ | ||
2968 | btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); | 2963 | btrfs_remove_all_log_ctxs(log_root_tree, index2, ret); |
2969 | 2964 | ||
2970 | mutex_lock(&log_root_tree->log_mutex); | ||
2971 | log_root_tree->log_transid_committed++; | 2965 | log_root_tree->log_transid_committed++; |
2972 | atomic_set(&log_root_tree->log_commit[index2], 0); | 2966 | atomic_set(&log_root_tree->log_commit[index2], 0); |
2973 | mutex_unlock(&log_root_tree->log_mutex); | 2967 | mutex_unlock(&log_root_tree->log_mutex); |
@@ -2978,10 +2972,8 @@ out_wake_log_root: | |||
2978 | if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) | 2972 | if (waitqueue_active(&log_root_tree->log_commit_wait[index2])) |
2979 | wake_up(&log_root_tree->log_commit_wait[index2]); | 2973 | wake_up(&log_root_tree->log_commit_wait[index2]); |
2980 | out: | 2974 | out: |
2981 | /* See above. */ | ||
2982 | btrfs_remove_all_log_ctxs(root, index1, ret); | ||
2983 | |||
2984 | mutex_lock(&root->log_mutex); | 2975 | mutex_lock(&root->log_mutex); |
2976 | btrfs_remove_all_log_ctxs(root, index1, ret); | ||
2985 | root->log_transid_committed++; | 2977 | root->log_transid_committed++; |
2986 | atomic_set(&root->log_commit[index1], 0); | 2978 | atomic_set(&root->log_commit[index1], 0); |
2987 | mutex_unlock(&root->log_mutex); | 2979 | mutex_unlock(&root->log_mutex); |