diff options
Diffstat (limited to 'fs/btrfs/extent-tree.c')
| -rw-r--r-- | fs/btrfs/extent-tree.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index b15afeae16df..d81035b7ea7d 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -2456,12 +2456,10 @@ static int run_and_cleanup_extent_op(struct btrfs_trans_handle *trans, | |||
| 2456 | return ret ? ret : 1; | 2456 | return ret ? ret : 1; |
| 2457 | } | 2457 | } |
| 2458 | 2458 | ||
| 2459 | static void cleanup_ref_head_accounting(struct btrfs_trans_handle *trans, | 2459 | void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info, |
| 2460 | struct btrfs_delayed_ref_head *head) | 2460 | struct btrfs_delayed_ref_root *delayed_refs, |
| 2461 | struct btrfs_delayed_ref_head *head) | ||
| 2461 | { | 2462 | { |
| 2462 | struct btrfs_fs_info *fs_info = trans->fs_info; | ||
| 2463 | struct btrfs_delayed_ref_root *delayed_refs = | ||
| 2464 | &trans->transaction->delayed_refs; | ||
| 2465 | int nr_items = 1; /* Dropping this ref head update. */ | 2463 | int nr_items = 1; /* Dropping this ref head update. */ |
| 2466 | 2464 | ||
| 2467 | if (head->total_ref_mod < 0) { | 2465 | if (head->total_ref_mod < 0) { |
| @@ -2544,7 +2542,7 @@ static int cleanup_ref_head(struct btrfs_trans_handle *trans, | |||
| 2544 | } | 2542 | } |
| 2545 | } | 2543 | } |
| 2546 | 2544 | ||
| 2547 | cleanup_ref_head_accounting(trans, head); | 2545 | btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); |
| 2548 | 2546 | ||
| 2549 | trace_run_delayed_ref_head(fs_info, head, 0); | 2547 | trace_run_delayed_ref_head(fs_info, head, 0); |
| 2550 | btrfs_delayed_ref_unlock(head); | 2548 | btrfs_delayed_ref_unlock(head); |
| @@ -4954,6 +4952,15 @@ static void flush_space(struct btrfs_fs_info *fs_info, | |||
| 4954 | ret = 0; | 4952 | ret = 0; |
| 4955 | break; | 4953 | break; |
| 4956 | case COMMIT_TRANS: | 4954 | case COMMIT_TRANS: |
| 4955 | /* | ||
| 4956 | * If we have pending delayed iputs then we could free up a | ||
| 4957 | * bunch of pinned space, so make sure we run the iputs before | ||
| 4958 | * we do our pinned bytes check below. | ||
| 4959 | */ | ||
| 4960 | mutex_lock(&fs_info->cleaner_delayed_iput_mutex); | ||
| 4961 | btrfs_run_delayed_iputs(fs_info); | ||
| 4962 | mutex_unlock(&fs_info->cleaner_delayed_iput_mutex); | ||
| 4963 | |||
| 4957 | ret = may_commit_transaction(fs_info, space_info); | 4964 | ret = may_commit_transaction(fs_info, space_info); |
| 4958 | break; | 4965 | break; |
| 4959 | default: | 4966 | default: |
| @@ -7188,7 +7195,7 @@ static noinline int check_ref_cleanup(struct btrfs_trans_handle *trans, | |||
| 7188 | if (head->must_insert_reserved) | 7195 | if (head->must_insert_reserved) |
| 7189 | ret = 1; | 7196 | ret = 1; |
| 7190 | 7197 | ||
| 7191 | cleanup_ref_head_accounting(trans, head); | 7198 | btrfs_cleanup_ref_head_accounting(trans->fs_info, delayed_refs, head); |
| 7192 | mutex_unlock(&head->mutex); | 7199 | mutex_unlock(&head->mutex); |
| 7193 | btrfs_put_delayed_ref_head(head); | 7200 | btrfs_put_delayed_ref_head(head); |
| 7194 | return ret; | 7201 | return ret; |
