diff options
| -rw-r--r-- | fs/btrfs/extent-tree.c | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ca4aad96f814..3d3e2c17d8d1 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
| @@ -3907,7 +3907,6 @@ static int reserve_metadata_bytes(struct btrfs_root *root, | |||
| 3907 | int flush_state = FLUSH_DELAYED_ITEMS_NR; | 3907 | int flush_state = FLUSH_DELAYED_ITEMS_NR; |
| 3908 | int ret = 0; | 3908 | int ret = 0; |
| 3909 | bool flushing = false; | 3909 | bool flushing = false; |
| 3910 | bool committed = false; | ||
| 3911 | 3910 | ||
| 3912 | again: | 3911 | again: |
| 3913 | ret = 0; | 3912 | ret = 0; |
| @@ -3970,33 +3969,12 @@ again: | |||
| 3970 | (orig_bytes * 2); | 3969 | (orig_bytes * 2); |
| 3971 | } | 3970 | } |
| 3972 | 3971 | ||
| 3973 | if (ret) { | 3972 | if (ret && can_overcommit(root, space_info, orig_bytes, flush)) { |
| 3974 | u64 avail; | 3973 | space_info->bytes_may_use += orig_bytes; |
| 3975 | 3974 | trace_btrfs_space_reservation(root->fs_info, "space_info", | |
| 3976 | /* | 3975 | space_info->flags, orig_bytes, |
| 3977 | * If we have a lot of space that's pinned, don't bother doing | 3976 | 1); |
| 3978 | * the overcommit dance yet and just commit the transaction. | 3977 | ret = 0; |
| 3979 | */ | ||
| 3980 | avail = (space_info->total_bytes - space_info->bytes_used) * 8; | ||
| 3981 | do_div(avail, 10); | ||
| 3982 | if (space_info->bytes_pinned >= avail && flush && !committed) { | ||
| 3983 | space_info->flush = 1; | ||
| 3984 | flushing = true; | ||
| 3985 | spin_unlock(&space_info->lock); | ||
| 3986 | ret = may_commit_transaction(root, space_info, | ||
| 3987 | orig_bytes, 1); | ||
| 3988 | if (ret) | ||
| 3989 | goto out; | ||
| 3990 | committed = true; | ||
| 3991 | goto again; | ||
| 3992 | } | ||
| 3993 | |||
| 3994 | if (can_overcommit(root, space_info, orig_bytes, flush)) { | ||
| 3995 | space_info->bytes_may_use += orig_bytes; | ||
| 3996 | trace_btrfs_space_reservation(root->fs_info, | ||
| 3997 | "space_info", space_info->flags, orig_bytes, 1); | ||
| 3998 | ret = 0; | ||
| 3999 | } | ||
| 4000 | } | 3978 | } |
| 4001 | 3979 | ||
| 4002 | /* | 3980 | /* |
