This was an old wart left over from how we previously did data
reservations. Before we could have people race in and take a
reservation while we were flushing space, so we needed to make sure we
looped a few times before giving up. Now that we're using the ticketing
infrastructure we don't have to worry about this and can drop the logic
altogether.
Signed-off-by: Josef Bacik <josef@xxxxxxxxxxxxxx>
---
fs/btrfs/space-info.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 7a401f1c3724..a456139c698d 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -1187,16 +1187,11 @@ int btrfs_reserve_data_bytes(struct btrfs_fs_info *fs_info, u64 bytes,
{
struct btrfs_space_info *data_sinfo = fs_info->data_sinfo;
u64 used;
- int commit_cycles = 2;
int ret = -ENOSPC;
bool pending_tickets;
ASSERT(!current->journal_info || flush != BTRFS_RESERVE_FLUSH_DATA);
- if (flush == BTRFS_RESERVE_FLUSH_FREE_SPACE_INODE)
- commit_cycles = 0;
-
-again:
spin_lock(&data_sinfo->lock);
used = btrfs_space_info_used(data_sinfo, true);
pending_tickets = !list_empty(&data_sinfo->tickets) ||
@@ -1214,15 +1209,12 @@ int btrfs_reserve_data_bytes(struct btrfs_fs_info *fs_info, u64 bytes,
ret = handle_reserve_ticket(fs_info, data_sinfo, &ticket,
flush);
- if (!ret || !commit_cycles)
- goto out;
- commit_cycles--;
- goto again;
+ } else {
+ btrfs_space_info_update_bytes_may_use(fs_info, data_sinfo,
+ bytes);
+ ret = 0;
}
- btrfs_space_info_update_bytes_may_use(fs_info, data_sinfo, bytes);
- ret = 0;
spin_unlock(&data_sinfo->lock);
-out:
if (ret)
trace_btrfs_space_reservation(fs_info,
"space_info:enospc",
--
2.24.1