]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: rip the first_ticket_bytes logic from fail_all_tickets
authorJosef Bacik <josef@toxicpanda.com>
Tue, 22 Jun 2021 12:52:00 +0000 (15:52 +0300)
committerDavid Sterba <dsterba@suse.com>
Tue, 22 Jun 2021 12:51:48 +0000 (14:51 +0200)
This was a trick implemented to handle the case where we had a giant
reservation in front of a bunch of little reservations in the ticket
queue.  If the giant reservation was too large for the transaction
commit to make a difference we'd ENOSPC everybody out instead of
committing the transaction.  This logic was put in to force us to go
back and re-try the transaction commit logic to see if we could make
progress.

Instead now we know we've committed the transaction, so any space that
would have been recovered is now available, and would be caught by the
btrfs_try_granting_tickets() in this loop, so we no longer need this
code and can simply delete it.

Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/space-info.c

index ec18fed8ec80deb01d096020a36829fc905fd6e9..c3e1d5e2ea0dadf61a2f26a6c4e47330fb5cfa81 100644 (file)
@@ -830,7 +830,6 @@ static bool maybe_fail_all_tickets(struct btrfs_fs_info *fs_info,
 {
        struct reserve_ticket *ticket;
        u64 tickets_id = space_info->tickets_id;
-       u64 first_ticket_bytes = 0;
 
        if (btrfs_test_opt(fs_info, ENOSPC_DEBUG)) {
                btrfs_info(fs_info, "cannot satisfy tickets, dumping space info");
@@ -846,21 +845,6 @@ static bool maybe_fail_all_tickets(struct btrfs_fs_info *fs_info,
                    steal_from_global_rsv(fs_info, space_info, ticket))
                        return true;
 
-               /*
-                * may_commit_transaction will avoid committing the transaction
-                * if it doesn't feel like the space reclaimed by the commit
-                * would result in the ticket succeeding.  However if we have a
-                * smaller ticket in the queue it may be small enough to be
-                * satisfied by committing the transaction, so if any
-                * subsequent ticket is smaller than the first ticket go ahead
-                * and send us back for another loop through the enospc flushing
-                * code.
-                */
-               if (first_ticket_bytes == 0)
-                       first_ticket_bytes = ticket->bytes;
-               else if (first_ticket_bytes > ticket->bytes)
-                       return true;
-
                if (btrfs_test_opt(fs_info, ENOSPC_DEBUG))
                        btrfs_info(fs_info, "failing ticket with %llu bytes",
                                   ticket->bytes);