From patchwork Wed Sep 6 16:03:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9941037 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 69F9260350 for ; Wed, 6 Sep 2017 16:03:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 59CE628BD3 for ; Wed, 6 Sep 2017 16:03:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4F09528BDA; Wed, 6 Sep 2017 16:03:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D42D228BD3 for ; Wed, 6 Sep 2017 16:03:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753839AbdIFQDb (ORCPT ); Wed, 6 Sep 2017 12:03:31 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:33756 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753326AbdIFQDa (ORCPT ); Wed, 6 Sep 2017 12:03:30 -0400 Received: by mail-qk0-f179.google.com with SMTP id o129so20599183qkd.0 for ; Wed, 06 Sep 2017 09:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=V1lyYnbJPcHJL3wvhJhSv4+rdwG7dcLqKut9b/3Cciw=; b=ZBOfiefVSLu9OcHzmXpT3upx4H0Zus7Ke/aimmGmROkGy2BZaKudcrfNroTGtqIIQ/ o+BY2iaOi+5xkJ1292RRMvc6wdWhyLuV/cgRxXBhLNpyFklft6E5dzFV0QpctezlKamx o2G7xq311D8AFISkAOZxh1PPyErPdp1BPAyhUrvRsYwBq/1lRBZp/FJnbljlT4d8z45h rqDZZlTSwpx6baDIPIRK70/mvwwc7MeDy45oRwfxLCsD2OWqSe3FoPRvcUYVhfjKOtpp MKZI471OpMcOYik6Q/+R3GGAWZ/76Qn5MLk3jrXm5qLAg0OXqOgE1R3Q/w9ERDEa7Ekp BiHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=V1lyYnbJPcHJL3wvhJhSv4+rdwG7dcLqKut9b/3Cciw=; b=VPodlnwKaXsTgp5bd6hwPgwb/GLgYr6R5QkKuCCw7yG6PqK2zXZ6bqrtPLS/zKALyD /2gRQr9sY0HjDSZZSMzcGiw4nmTCiQfeIk4hIUVFTwMUoCw0bm/7R7EOzRWcBBxpRrUu 4mpxEu76lJfEBrt64YbCUpBKIy7JkFCoc2Y4oGNr/63B3ej67cku0o/sw/KkfvxFFJZj u4nm3LGGzs3RxgSYrDKhaRI+lbCFiRcjCvXSqWpI4329uOt9ybrxcEB5E6dQc1lUFrO8 j0YXaRJe3c/Nasrtde1HYlwLTLxsupUux9UDYO+43GbyfSLUsTRyzTVnF6XdYdIVOmOM DWkg== X-Gm-Message-State: AHPjjUj6YmyyVMfzi4x0tkRnq1fkyYV224/ajQ43SxCtwmLLTQ71HhvX VfzhcU+iXoQabVNOa34= X-Google-Smtp-Source: ADKCNb7qOPvTomkIff3djcCnsthL03iwfLu2W5uncTg76aeqaxFrZWIzz6/KR2l4NdtUDA5Ae5NqhQ== X-Received: by 10.233.237.77 with SMTP id c74mr4309381qkg.256.1504713809491; Wed, 06 Sep 2017 09:03:29 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id j7sm118484qth.25.2017.09.06.09.03.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Sep 2017 09:03:28 -0700 (PDT) From: josef@toxicpanda.com X-Google-Original-From: jbacik@fb.com To: linux-btrfs@vger.kernel.org, kernel-team@fb.com Cc: Josef Bacik Subject: [PATCH] Btrfs: only check delayed ref usage in should_end_transaction Date: Wed, 6 Sep 2017 12:03:27 -0400 Message-Id: <1504713807-8250-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Josef Bacik We were only doing btrfs_check_space_for_delayed_refs() if the metadata space was full, ie we couldn't allocate chunks. This assumes we'll be able to allocate chunks during transaction commit, but since nothing does a LIMIT flush during the transaction commit this won't actually happen unless we happen to run shy of actual space. We already take into account a full fs in btrfs_check_space_for_delayed_refs() so just kill this extra check to make sure we're ending the transaction when we need to. Signed-off-by: Josef Bacik --- fs/btrfs/transaction.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index f615d59..02548ff 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c @@ -797,8 +797,7 @@ static int should_end_transaction(struct btrfs_trans_handle *trans) { struct btrfs_fs_info *fs_info = trans->fs_info; - if (fs_info->global_block_rsv.space_info->full && - btrfs_check_space_for_delayed_refs(trans, fs_info)) + if (btrfs_check_space_for_delayed_refs(trans, fs_info)) return 1; return !!btrfs_block_rsv_check(&fs_info->global_block_rsv, 5);