From patchwork Mon Feb 9 20:03:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 5803141 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7ED75BF440 for ; Mon, 9 Feb 2015 20:03:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 94C5B2011D for ; Mon, 9 Feb 2015 20:03:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B92982011B for ; Mon, 9 Feb 2015 20:03:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760855AbbBIUDr (ORCPT ); Mon, 9 Feb 2015 15:03:47 -0500 Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:7671 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760850AbbBIUDp (ORCPT ); Mon, 9 Feb 2015 15:03:45 -0500 Received: from pps.filterd (m0004347 [127.0.0.1]) by m0004347.ppops.net (8.14.5/8.14.5) with SMTP id t19K1SD6024638; Mon, 9 Feb 2015 12:03:43 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wit.ai; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=mx2; bh=J0ajhqZuq+fS1xoQtPfYeb0acskivVRGhTTcUALdBs8=; b=kWpTMhE4e057Jj0H9UT1SgnNXhTV7CnE38rO8nHYhpIAzyL05DpYl9qxRxP+qQb4Q+25 LsshZpeqYtwMwrIE+VkzCz/Z9itDw0G0JGR3FGbIptReuXwrEUnD1JKT4LfMwi3tOXuT rxnGEn24nzERyMiXrPA9eVxQG7sjTOOdEZY+4nfNAZwRH06qJ5yThLkrrsRZ7IWHhswD KJFDwtwm2quyQfmxJGDh5OC1nheOQrbN8GOtnFU2tF2L5O1I8mLcOKZ2qT7APjXRk+vD y2erKoZe5mX1r3sncCtWRoNrfHFDA4uYXW8IVG5fYFBQhblt/dnGaiw9k4xkMXP3vI2B 5g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fb.com; h=from : to : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=facebook; bh=J0ajhqZuq+fS1xoQtPfYeb0acskivVRGhTTcUALdBs8=; b=LNJWVD2nlz6q2efUoIstIVVxx7EulXUEe8D1t6CpXowZev0DFi5u9lzRjvfYZVlN22T4 huVlGyteGTxlo/BTJbMkP0zwZtrtcHiyJffsD6CehsXRun2ShZbtyO4OCFHQfRM92U8r b8MifRN8kl+ddrCNsQ3M1fVyEeH3qyhbwiw= Received: from mail.thefacebook.com ([199.201.64.23]) by m0004347.ppops.net with ESMTP id 1sf38pg1eq-2 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NOT); Mon, 09 Feb 2015 12:03:42 -0800 Received: from localhost (192.168.57.29) by mail.thefacebook.com (192.168.16.24) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 9 Feb 2015 12:03:41 -0800 From: Josef Bacik To: , Subject: [PATCH 10/16] Btrfs-progs: only build space info's for the main flags Date: Mon, 9 Feb 2015 15:03:13 -0500 Message-ID: <1423512199-16552-11-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1423512199-16552-1-git-send-email-jbacik@fb.com> References: <1423512199-16552-1-git-send-email-jbacik@fb.com> MIME-Version: 1.0 X-Originating-IP: [192.168.57.29] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68, 1.0.33, 0.0.0000 definitions=2015-02-09_02:2015-02-09, 2015-02-08, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=fb_default_notspam policy=fb_default score=0 kscore.is_bulkscore=0 kscore.compositescore=0 circleOfTrustscore=2.87009407511322 compositescore=0.980601274849849 urlsuspect_oldscore=0.980601274849849 suspectscore=0 recipient_domain_to_sender_totalscore=0 phishscore=0 bulkscore=0 kscore.is_spamscore=0 recipient_to_sender_totalscore=0 recipient_domain_to_sender_domain_totalscore=64355 rbsscore=0.980601274849849 spamscore=0 recipient_to_sender_domain_totalscore=0 urlsuspectscore=0.9 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1502090197 X-FB-Internal: deliver Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hitting enospc problems with a really corrupt fs uncovered the fact that we match any flag in a block group when creating space info's. This is a problem if we have a raid level set, we'll end up with only one space info that covers metadata and data because they share a raid level. We don't want this, we want to separate out the data and metadata space infos, so mask off the raid level and only use the main flags. Thanks, Signed-off-by: Josef Bacik --- extent-tree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extent-tree.c b/extent-tree.c index 1785e22..d42c572 100644 --- a/extent-tree.c +++ b/extent-tree.c @@ -1789,11 +1789,11 @@ int btrfs_write_dirty_block_groups(struct btrfs_trans_handle *trans, static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info, u64 flags) { - struct list_head *head = &info->space_info; - struct list_head *cur; struct btrfs_space_info *found; - list_for_each(cur, head) { - found = list_entry(cur, struct btrfs_space_info, list); + + flags &= BTRFS_BLOCK_GROUP_TYPE_MASK; + + list_for_each_entry(found, &info->space_info, list) { if (found->flags & flags) return found; } @@ -1825,7 +1825,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags, return -ENOMEM; list_add(&found->list, &info->space_info); - found->flags = flags; + found->flags = flags & BTRFS_BLOCK_GROUP_TYPE_MASK; found->total_bytes = total_bytes; found->bytes_used = bytes_used; found->bytes_pinned = 0;