From patchwork Fri Sep 29 19:43:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9978581 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 2A54E60311 for ; Fri, 29 Sep 2017 19:45:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CE59298AD for ; Fri, 29 Sep 2017 19:45:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1206F298AF; Fri, 29 Sep 2017 19:45:13 +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 B53A4298AD for ; Fri, 29 Sep 2017 19:45:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752606AbdI2TpG (ORCPT ); Fri, 29 Sep 2017 15:45:06 -0400 Received: from mail-qt0-f181.google.com ([209.85.216.181]:54923 "EHLO mail-qt0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752380AbdI2ToT (ORCPT ); Fri, 29 Sep 2017 15:44:19 -0400 Received: by mail-qt0-f181.google.com with SMTP id i13so903198qtc.11 for ; Fri, 29 Sep 2017 12:44:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=xyYnE557c70xX0//+isdA1LvpO0E7AlgPWETks14Zvg=; b=eXI0sfK4bm5al9h4ORJaM08dgYX1BvI1iADwxTCqMR4DUfqGtlyv9dqvUid/zQzzsY UhkCVG+dqxjYpnvseRKjs652xxI/d/fEJNDwxlVjBXsRcIIHJxdy3J1/B6LGuzmGg3iZ pMV/e/Td/C3slchcLA2WclSSFrksKM6/x/NtwG0HZcEs0Na0rICii5cWUWLL4agO698B nk5ABAW822duXHiSzwnWPWv0IZiy3ttLuymZOCHt4u0ckHbyOIfF8W5tksPwibWjMkwr zrwCW8GRg03zRYRv6kgJcHrSjUmkkOS5r9v5g2dNkQQ7tXyaGKAA6JmbBgHQD/gCQjKt q8RA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=xyYnE557c70xX0//+isdA1LvpO0E7AlgPWETks14Zvg=; b=ee+Xhnb3D1Z8QzayF15Lr3XGG1LN0EewLYMr7Wd8XA63/nWUYbRmbY1vzlRxKIMec2 LXxR+F5lTPu8RIL81S6CVieY33l8l+5dEZRgGdTxifHxk6AHFVEu3IMcXWJCtGTKHFWT g8A9Su8C3T0QF2WN0gprY+SNn05TuXZt8nIO96IRNmcdPTKKVi7yLE9rtSlZNqKCIwpS WaaRJT6hZ+TT67mN76QvYU2MwATwb6CuyfQmXosKfbc2Zi7SnGCuDKTwSOa5G6UOt7YI e3veaMGaIaVToU8Aw69b9Xzb+dXu8NQ2rxPkLS98uZNJ5nDPnnqD3ANabUnXJDblsmCK Fdwg== X-Gm-Message-State: AMCzsaWSyyvvsU+1ZzFWxwBfKEVfsFlm5CJRVaz3LVKSTFFzbgzYTbx6 PhdWyqQaYMZaaSPtjw4LXBcb7A== X-Google-Smtp-Source: AOwi7QDKfAls4OyUooJW5i8CtNaotBnvzqRo37caxh9VjY0rCgllOQyJ/1b0v+XYY8mc0ix8P73gtQ== X-Received: by 10.200.48.185 with SMTP id v54mr7562507qta.245.1506714259138; Fri, 29 Sep 2017 12:44:19 -0700 (PDT) Received: from localhost ([2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id n85sm3058362qke.53.2017.09.29.12.44.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Sep 2017 12:44:18 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: kernel-team@fb.com, linux-btrfs@vger.kernel.org Subject: [PATCH 07/21] Btrfs: only check delayed ref usage in should_end_transaction Date: Fri, 29 Sep 2017 15:43:51 -0400 Message-Id: <1506714245-23072-8-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1506714245-23072-1-git-send-email-jbacik@fb.com> References: <1506714245-23072-1-git-send-email-jbacik@fb.com> 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 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 Reviewed-by: David Sterba --- 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 9c5f126064bd..68c3e1c04bca 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);