From patchwork Thu Aug 30 17:42:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 10582467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1A66817DE for ; Thu, 30 Aug 2018 17:43:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0A026284DA for ; Thu, 30 Aug 2018 17:43:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F1FB828676; Thu, 30 Aug 2018 17:43:10 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 9ED15284DA for ; Thu, 30 Aug 2018 17:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727683AbeH3VqY (ORCPT ); Thu, 30 Aug 2018 17:46:24 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:43088 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726878AbeH3VqX (ORCPT ); Thu, 30 Aug 2018 17:46:23 -0400 Received: by mail-qt0-f194.google.com with SMTP id g53-v6so11274580qtg.10 for ; Thu, 30 Aug 2018 10:43:08 -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=rHRaQ156gyHs+qQIoPL4cB69riQ0Y4jB65i9RwV19ws=; b=DfphsexseSCSq35787EwhzDZOUR0eRB+ib3j7Nt6D9v3NwFLLVWv5MPp/D3b2A9z6b 8HpX9xNzYxQhs7I7LFJBKdGks4THL74BF4ycRQ1rJ/w4PDda2iTySRwMN3084vBOvJh0 mF5KfB6/lu4bGBA8xciG+IYjFcgXGxgIxywJmEby9t+IXgjoA2EXeLhLPA2/ymmvR2JN D1E+rToK+nZsHZrArkcAD38xB20IVucOoNcScy/ghO/XcNpahAhsMmxWp66DYnab5BYJ roqHXN8Zvvm2a5JkldumS2m7bT+WgP21btBphUyArgBNTpm9fLxZDBCcrl/HsJKFVD3D 7UIQ== 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=rHRaQ156gyHs+qQIoPL4cB69riQ0Y4jB65i9RwV19ws=; b=J7cMAXU9ph7lfi+D1dWhi4Afy3+9rjEsV4gLOfOO/RNzH3M2O5HR44uDMLHEpcqtq3 sGojxz1HSACXanHgsYnA7Ls634qm5yzt3s8+UIVlnlmy913oAin7GRPcZscWp9EHZNsW PAIxS3tREUNL/CTy+5BJlvCc/TmPs+6+luGoVk3aoJt0uoTYmslN1ok5yMBzIfWos4yy KEuiDa+oZpq16saxZgD8ok0AH8LnpFSH03fEYjZYFAsiEnPokfQFdovjdp+vpYvM4/yP h8Dv2bSqpTeu8n/iMgfwiXKVyvrHcMSa2MIYPEW4Df88exzbun5ehMLJq9X/lDhv9Hu2 kEPg== X-Gm-Message-State: APzg51A+uYvFUS6vbkb2SUgbZmxqIryoB7N3U788oYQbcyWKPuoAziUt Kjn8SGqRcx4E8nIkympVhF6rRewaWUxv0A== X-Google-Smtp-Source: ANB0VdYANyafdz3/QtLGELOXdFIfEfyrFkX+MRUiEywLLgE5s3H0mupMcDnRu2R1TiU7/7SF2v+vuw== X-Received: by 2002:ac8:4649:: with SMTP id f9-v6mr13080944qto.34.1535650987854; Thu, 30 Aug 2018 10:43:07 -0700 (PDT) Received: from localhost ([107.15.81.208]) by smtp.gmail.com with ESMTPSA id o5-v6sm4961225qtc.63.2018.08.30.10.43.06 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 30 Aug 2018 10:43:06 -0700 (PDT) From: Josef Bacik To: linux-btrfs@vger.kernel.org Subject: [PATCH 22/35] btrfs: make sure we create all new bgs Date: Thu, 30 Aug 2018 13:42:12 -0400 Message-Id: <20180830174225.2200-23-josef@toxicpanda.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180830174225.2200-1-josef@toxicpanda.com> References: <20180830174225.2200-1-josef@toxicpanda.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 can actually allocate new chunks while we're creating our bg's, so instead of doing list_for_each_safe, just do while (!list_empty()) so we make sure to catch any new bg's that get added to the list. Signed-off-by: Josef Bacik Reviewed-by: Omar Sandoval Reviewed-by: Liu Bo --- fs/btrfs/extent-tree.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index ca98c39308f6..fc30ff96f0d6 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -10331,7 +10331,7 @@ int btrfs_read_block_groups(struct btrfs_fs_info *info) void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans) { struct btrfs_fs_info *fs_info = trans->fs_info; - struct btrfs_block_group_cache *block_group, *tmp; + struct btrfs_block_group_cache *block_group; struct btrfs_root *extent_root = fs_info->extent_root; struct btrfs_block_group_item item; struct btrfs_key key; @@ -10339,7 +10339,10 @@ void btrfs_create_pending_block_groups(struct btrfs_trans_handle *trans) bool can_flush_pending_bgs = trans->can_flush_pending_bgs; trans->can_flush_pending_bgs = false; - list_for_each_entry_safe(block_group, tmp, &trans->new_bgs, bg_list) { + while (!list_empty(&trans->new_bgs)) { + block_group = list_first_entry(&trans->new_bgs, + struct btrfs_block_group_cache, + bg_list); if (ret) goto next;